Am I using Applescript's "duplicate" wrong?
I'm trying to duplicate an object from one Omnigraffle document into another. I can get it to duplicate and place the copy in the same spot, but when I try to place the copy in a different file, I get an error: "OmniGraffle 5 got an error: Can’t make or move that element into that container."
The script is below. Any suggestions would be greatly appreciated. [code] set myDocument to "[the pathname of my file]" tell application "OmniGraffle 5" set oDoc to open myDocument set canvasCount to count of canvases of oDoc set allGroups to {} repeat with theCanvas in every canvas of the first document repeat with theLayer in every layer in theCanvas set allGroups to allGroups & every group in theLayer end repeat end repeat set groupcount to length of allGroups set allDocNames to {} repeat with currentGroup in allGroups set currentID to id of currentGroup set currentName to "test" & currentID & ".graffle" set allDocNames to allDocNames & currentName set preNewDoc to (make new document at end of documents with properties {name:currentName}) save the front window set newDoc to the front window duplicate currentGroup to newDoc -- causes error! (* in new document, select all ungroup keep list of origins export as psd in illustrator import each component to the location specified by its origins *) end repeat end tell [/code] |
[QUOTE=Daria;63731]when I try to place the copy in a different file, I get an error: "OmniGraffle 5 got an error: Can’t make or move that element into that container."
set preNewDoc to (make new document at end of documents with properties {name:currentName}) save the front window set newDoc to the front window duplicate currentGroup to newDoc -- causes error! [/QUOTE] Hi Daria- I didn't try your script, but doesn't "make" return a reference to a DOCUMENT, but you need a reference to a CANVAS to contain the graphic group? Best, Charles |
Charles,
You're right. Thanks for helping me! - Daria |
Glad I could. Have fun!
Charles |
All times are GMT -8. The time now is 10:04 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.