Applescript help
Hi,
I have a series of questions regarding applescript for omnigraffle professional 5. Let me start by this: Let's say I have 10canvases in my document, and I want my script to append/insert a new canvas after the fourth canvas. I'd imagine it'll be something like this [CODE]tell the first document set myCanvas to (make new canvas at fourth canvas) end tell [/CODE] However this script overwrite my fourth canvas instead of inserting a new canvas. Thanks |
One approach might be:
[CODE]tell application id "OGfl" tell front document set myCanvas to (make new canvas with properties {name:"New blank sheet"}) move myCanvas to after canvas 4 end tell end tell[/CODE] |
Hi RobTrew,
Thanks for the answer. It worked. I think the following is my final question before I get this script working fully.. Let's say again, I have 10 canvases, and I have a loop like this [CODE] tell application "OmniGraffle Professional 5" set theCanvases to every canvas of the first document set myCanvas to fourth canvas of the first document set numCanvas to 0 set maxItemsPerCanvas to 3 tell the first document repeat with theCanvas in theCanvases tell myCanvas --@CODE TO DRAW SOMETHING end tell set numCanvas to numCanvas + 1 if numCanvas > maxItemsPerCanvas then set myCanvas to canvas after myCanvas --@HERE set maxItemsPerCanvas to maxItemsPerCanvas + maxItemsPerCanvas end if end repeat end tell end tell [/CODE] @HERE : I wanted to set myCanvas to the next Canvas in the document after myCanvas. But this code doesn't work. It is essentially "set myCanvas to fifth canvas" but I want to do this without hardcoding it. |
May be easier, if you want to loop through the last N canvases, to loop with an index range.
[CODE]tell application id "OGfl" set oWin to front window tell front document set lngCanvas to count of canvases repeat with i from 4 to lngCanvas set oCanvas to canvas i set canvas of oWin to oCanvas end repeat set canvas of oWin to canvas 5 end tell end tell[/CODE] |
All times are GMT -8. The time now is 03:29 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.