Hi,
I'm working on an AppleScript that, among other things, needs to delete page items from the pasteboard (outside the main Page area). I can go about this one of two ways:
1) call an existing javascript already in the the Scripts palette.
2) rewrite the logic in AppleScript
for the life of me I can't find or figure out how to call it from AppleScript. I tried 'do script', but it throws up errors and does not work.
In regard to porting the logic over, I have it such that it does delete page items - all of them. I need to narrow down the ones that get deleted to those which are outside the Page workarea itself. Below is the javascript code containing the logic I need to port:
myDoc = app.activeDocument;
myObjs = myDoc.pageItems.everyItem().parent;
for (j = myObjs.length - 1; j >= 0; j--) {
if (myObjs[j].constructor.name == "Page") { continue }
myDoc.pageItems[j].remove();
}
here is the AppleScript code I've written so far:
tell application "Adobe InDesign CS2"
tell document 1
repeat with j from 1 to count of page items
try
tell page item j
delete all page items
end tell
end try
end repeat
the above deletes page items both inside and outside the page area. Here is an attempt to add the 'if (myObjs[j].constructor.name == "Page")' logic from the javascript code:
tell application "Adobe InDesign CS2"
tell document 1
repeat with j from 1 to count of page items
if name of page of page item is "Page" then
else
try
tell page item j
delete all page items
end tell
end try
end if
end repeat
the above produces the error 'Can't get name of page of page item of document 1'. I need a lil help, thx...