AppleScript to query the user data key/value pairs
Hi,
I've been working on a script to write values into the key/value user data dictionary available with shapes in the Pro version of OmniGraffle. The syntax to do this is: [CODE]make new shape with properties {text:"My Shape", url:"http://...", user data:{myKey:"myData"}… [/CODE] Whilst I can get this data into OmniGraffle so that I can see it in the interface I can't get my head around how to construct a way of getting at them. Here's what I'm trying to do: set myShapes to shapes of canvas of front window whose myKey is "myData" I get all sorts of errors about how it can't find/coerce etc. I know it has to be my limited ability to construct the right argument. I can get the dictionary out with the following script: [CODE]tell application "OmniGraffle Professional 5" user data of graphic id 3 of canvas id 1 of document "Untitled" of application "OmniGraffle Professional 5" end tell[/CODE] Any help would be appreciated. Regards Alan |
I managed to find a solution should anybody else try scripting with the key/value user data dictionary.
The following script fragment generates a list of shapes with the key/value pair of aURLkey and "Hello". [CODE]tell application "OmniGraffle Professional 5" set matchingShapes to shapes of canvas of front window whose value of user data item "aURLkey" is "Hello" end tell [/CODE] Hope it helps |
[QUOTE=apl;86519]I managed to find a solution should anybody else try scripting with the key/value user data dictionary.
The following script fragment generates a list of shapes with the key/value pair of aURLkey and "Hello". [CODE]tell application "OmniGraffle Professional 5" set matchingShapes to shapes of canvas of front window whose value of user data item "aURLkey" is "Hello" end tell [/CODE] Hope it helps[/QUOTE] Yes it does - many thanks, I have been struggling to discover the syntax to write to a user defined key value pair and your code snip was a great help. My aim is to add user key pairs to existing shapes but to edit the data in a predefined shape I'm using: [CODE]tell myGraphic set the value of user data item "MyKey" to "Some Data" end tell[/CODE] Thanks Simon |
All times are GMT -8. The time now is 04:45 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.