InDesign AppleScript help please...

Reply

Join Date: Sep 2005
Posts: 17
Reputation: cryptyq is an unknown quantity at this point 
Solved Threads: 0
cryptyq's Avatar
cryptyq cryptyq is offline Offline
Newbie Poster

InDesign AppleScript help please...

 
0
  #1
Jan 12th, 2007
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...
Last edited by cryptyq; Jan 12th, 2007 at 6:23 pm. Reason: typo
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 89
Reputation: Lomoco is an unknown quantity at this point 
Solved Threads: 0
Lomoco's Avatar
Lomoco Lomoco is offline Offline
Junior Poster in Training

Re: InDesign AppleScript help please...

 
0
  #2
Feb 7th, 2007
Maybe it can't find what you are refering to as "Document 1". Instead of using just "Document 1", try using the actual name of your document. Be sure to put it in quotes. I am just guessing at what your problem might be, but I do have some applescript experience.
Lomoco
Mac_Hack
Lomoco.MacHack@gmail.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the OS X Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC