The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Defining global variables. (http://forums.omnigroup.com/showthread.php?t=18864)

dekdekdek 2010-11-10 01:39 AM

Defining global variables.
 
Hi all,

I've just started exploring beyond it's very basic feature-set and have stumbled across variables. Oh, how much work could I have save, had I known earlier about this! (Yes, I'm a newbie to the program.) Anyways, there are predefined system variables and then there's the possibility to create custom variables à la <%UserData myvariablename%>.

My problem is, that I can't seem to find a way to define the "data key" and "data value" globally for the whole document, but just locally for one specific object at a time. Wouldn't it make sense, to set up all variables (e.g. customer, projectname, etc.) just once and then call the variable whenever I need it. I've found several threads discussing variables, but nothing on this problem. Or am I completely missing something here?

UPDATE: To be a bit more specific. Say I'm working on a website for a product and mid-project the name of the product is changed. It would be great, to just have this one location, where I'd have to change said name, and it then is updated throughout the whole document.

Thanks for any input!

cheers.

floatgraphics 2011-03-18 09:56 AM

I am looking for the very same thing - has anyone been able to accomplish this? I'd love to use "Client Name" in multiple places in my file as well, throughout canvases.

Brian 2011-03-18 01:57 PM

Welcome to the forums, Floatgraphics! We all browse the forums as we're able on top of our other duties, but in this case, the person that saw your post has Graffle-fu that is insufficient to provide an answer.

That said, if you send email to our [EMAIL="omnigraffle@omnigroup.com"]support ninjas[/EMAIL], you're guaranteed an answer from someone who'll know more than I do. Hope that still helps. :-)

whpalmer4 2011-03-20 10:12 AM

1 Attachment(s)
Here's a little script that will prompt for a key name and value and add them to the user data of every object in your document. Then you can put things like

[code]
Document prepared for <%userdata ClientName%>
[/code]

in your document, and update them whenever needed by simply running the script again. Note: user data keys cannot have spaces in them, so "Client Name" won't work, but "ClientName" will.

Thanks to RobTrew for showing the way to someone so unwilling to actually sit down and learn Applescript properly :-)

[code]

tell application id "OGfl"
set MykeyName to my PromptKeyInfo("Name of key to create/set", "MyKey", false)
set MydataVal to my PromptKeyInfo("Value of data to set", "<None>", true)


set MyScript to "
tell application id \"OGfl\"
repeat with aCanvas in every canvas of document of front window
set canvas of front window to aCanvas

repeat with aGraphic in every graphic of aCanvas
if (count of user data of aGraphic is not 0) then
set user data of aGraphic to {" & MykeyName & ":\"" & MydataVal & "\"} & user data of aGraphic
else
set user data of aGraphic to {" & MykeyName & ":\"" & MydataVal & "\"}
end if
end repeat
end repeat
end tell
"

run script MyScript
end tell

on PromptKeyInfo(Prompt, DefaultAnswer, SpacesAllowed)
set Successful to false
repeat while (Successful is not true)
set recReturned to display dialog Prompt default answer DefaultAnswer buttons {"OK", "Cancel"} default button {"OK"}
set retVal to (text returned of recReturned)
set Successful to true
if (not SpacesAllowed) then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set wordCount to count of every text item of retVal
if (wordCount is not 1) then
display dialog "Key names may not contain spaces"
set Successful to false
end if
end if
end repeat
return retVal
end PromptKeyInfo
[/code]

trouble clef 2011-08-19 11:55 AM

There is a simple way to store something that applies to the whole document.

In the same way that you can add a user data key for an object you can do so for the drawing canvas itself. Click on the canvas background and add, say a key called 'approvedBy' and enter a value.

All you then need to do is in any graphic shape that needs the value you enter the string:

[CODE]<%UserData approvedBy%>[/CODE]

It really is that simple. It also works for the standard keys for each document by using a slightly different form:

[CODE]<%Authors%>, <%Organizations%>, <%CreationDate%>[/CODE] to give:

[IMG]http://sourceforge.net/p/trakomnigraffle/screenshot/trakomnigraffle_stencil.jpg[/IMG]

namtastic 2011-11-07 03:08 PM

[QUOTE=trouble clef;100756]There is a simple way to store something that applies to the whole document.

In the same way that you can add a user data key for an object you can do so for the drawing canvas itself. Click on the canvas background and add, say a key called 'approvedBy' and enter a value.

All you then need to do is in any graphic shape that needs the value you enter the string:

[CODE]<%UserData approvedBy%>[/CODE]

It really is that simple. It also works for the standard keys for each document by using a slightly different form:

[CODE]<%Authors%>, <%Organizations%>, <%CreationDate%>[/CODE] to give:
[/QUOTE]

Actually, this doesn't work.

[url]https://img.skitch.com/20111108-fxb58m5uyiqdg6ci4ykbd772iy.png[/url]

RobTrew 2011-11-07 09:56 PM

There's a very helpful [URL="http://forums.omnigroup.com/showpost.php?p=98574&postcount=15"]post[/URL] by john.gersh on approaches to this problem.

A [B]Help > Send Feedback[/B] request for the extension of user data items from shapes, lines and subgraphs to layers, canvases and documents might also be worth a try.


All times are GMT -8. The time now is 03:59 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.