AppleScript: 3.0 Pro: NSCannotCreateScriptCommandError

Greg Titus greg at omnigroup.com
Thu Apr 17 10:44:01 PDT 2003


Hi Leif,

Unfortunately, because of the additional features in 3.0, the structure 
of the scripting dictionary had to change. A document doesn't have a 
list of graphics any more, it has a list of pages, each of which has 
graphics. In Pro you can also have multiple windows open on the same or 
different pages in a single document, which complicates the dictionary 
further.

If you know that you'll always want to be adding your shape to the 
first page you just need to change "end of graphics" to "end of 
graphics of first page".

But most of the time, you'll want your script to be acting on whichever 
page is currently being displayed in the frontmost window. OmniGraffle 
windows now have a "page" property (and some other new ones like 
selection and zoom). So your script should probably look like:

tell front window
	make new shape at the end of graphics of page with properties 
{origin:{4, 4}, thickness:1, size:{90, 90}, text:"I am a Shape", draws 
shadow:0, fill:radial fill, gradient center:{-1, -1}, fill 
color:{63000, 0, 0}, gradient color:{0, 50000, 50000}, text 
placement:bottom}
end tell

Hope this helps,
	- Greg

On Thursday, April 17, 2003, at 10:17  AM, Leif Smith wrote:

> This script worked prior to 3.0.
>
> Can anyone see what's wrong?
>
> tell front document
> 	make new shape at the end of graphics with properties {origin:{4, 4}, 
> thickness:1, size:{90, 90}, text:"I am a Shape", draws shadow:0, 
> fill:radial fill, gradient center:{-1, -1}, fill color:{63000, 0, 0}, 
> gradient color:{0, 50000, 50000}, text placement:bottom}
> end tell
>
> It passes "Check Syntax" but produces the following error message when 
> run:
>
> NSCannotCreateScriptCommandError
>
> Thanks ...
>
> _______________________________________________
> OmniGraffle-Users mailing list
> OmniGraffle-Users at omnigroup.com
> http://www.omnigroup.com/mailman/listinfo/omnigraffle-users




More information about the OmniGraffle-Users mailing list