Re: scripting OmniGraffle?
Re: scripting OmniGraffle?
- Subject: Re: scripting OmniGraffle?
- From: David Gregg <email@hidden>
- Date: Mon, 04 Jul 2016 21:25:58 -0600
> On Jul 4, 2016, at 8:46 PM, Mitchell L Model <email@hidden> wrote:
>
> Does anyone know where to find basic information or examples about scripting OmniGraffle? Specifically, all I want to do is create a new document, add a rectangle to it, and put some text in the rectangle. The critical thing is that later I need to confirm that that is what the document contains. (This is for testing, where I need to create many graphical documents, store them in a database, and be able to verify that a query retrieves the one(s) it is supposed to.)
>
> Suggestions for a different application to use for this would be welcome.
OmniGraffle is probably a good choice.
You can get the AppleScript for the rectangle and text entry just by creating it in an OmniGraffle document, choosing the AppleScript from the Copy As command in the Edit menu. Then just paste the AppleScript into a document of your favorite AppleScript Editor.
Here is an example.
set textToEnter to "Here is the text for the rectangle"
tell application id "com.omnigroup.OmniGraffle6.MacAppStore"
make new document
tell canvas of front window
make new shape at end of graphics with properties {draws shadow:false, size:{369.921263, 180.000002}, text:{size:16, alignment:center, font:"HelveticaNeue", text:textToEnter}, origin:{79.370079, 83.622048}}
end tell
end tell
I just added the following to the basic code:
1) make new document
2) using a variable for the text entry for more flexibility, you could also add variables for all the other properties as needed.
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden