From what I read in the dictionary, I think this should move a page from one position in the document to another. I know I can do this by hand using the Pages tab of the Navigation Panel. I’m trying to set up a script to move the pages that I can trigger with QuicKeys so I don’t have to do it manual (with the slow loading page icons) in the Pages panel. It might also be useful if someone knows if page ranges could be moved as well. I searched for any previous mention of it here and haven’t been able to find any discussion on the command. Any help would be appreciated.
Model: MacBook
AppleScript: 2.1.2
Browser: Safari 525.22
Operating System: Mac OS X (10.4)
although the dictionary says that the move command can be used with objects of class Page,
you get always error messages about “Page x of document y doesn’t understand the move command”.
But according to the Acrobat Javascript Reference it’s possible with javascript
I know you’ve been you’ve been helping people here for years and I’m pretty sure you’ve helped me in the past. (Thanks by the way :)) I was waiting to reply, hoping you were wrong and hoping somebody else might have come up with something they did in the past. I did do some testing after I posted and I did manage to get something that didn’t come up with “didn’t understand the move command” error.
tell application "Adobe Acrobat Professional"
--activate
set docName to name of active doc
(* These work *)
--bring to front document docName
--set mainPage to page number of PDF Window of document docName
(* These don't *)
-- move page 3 to page 19
-- move page 3 of document docName to page 19
-- move page 3 of PDF Window of document docName to page 19
-- move page 3 of PDF Window of document docName to page 19 of PDF Window of document docName
-- move page number 3 of PDF Window of document docName to page number 19 of PDF Window of document docName
-- move page 3 of PDF Window of document docName to last page of PDF Window of document docName
-- move page 3 of PDF Window of document docName to page "19" of PDF Window of document docName
set page 3 of PDF Window of document docName to page 19 of PDF Window of document docName
-- move page 3 of PDF Window of document docName to 19
end tell -- application "Adobe Acrobat Professional"
I’ve been using the commands below in a couple routines for years now,
tell application "Adobe Acrobat Professional"
activate
set docName to name of active doc
(* These work *)
bring to front document docName
set mainPage to page number of PDF Window of document docName
end tell -- application "Adobe Acrobat Professional"
so I thought the following might work
set page 3 of PDF Window of document docName to page 19 of PDF Window of document docName
This gave me the error "Acrobat got an error: Can’t set page 3 of PDF Window of document “001.pdf” to page 19 of PDF Window of document “001.pdf.” which makes me think I’ve got the ‘move reference’ part of the move command right, just not the ‘location reference’. (Dictionary definition down below)
But I’m out of ideas from there. I’m not sure how the location reference would work. As far as javascript, I did read a book on programming javascript for a few months awhile back without trying anything out and I’m sure I’d have to start from scratch again. I know I won’t have any time to try it until at least June. Any advice on what applications I might need to run javascript and where I might find it?
No luck SuperMacGuy. I thought you might be on to something. None of the following worked either. These all gave me the same “Acrobat can’t set page 3…” error. (The XX gave me undefined variable error.)
tell application "Adobe Acrobat Professional"
--activate
set docName to name of active doc
(* These don't work *)
-- set page 3 of PDF Window of document docName to after page 19 of PDF Window of document docName
-- set page 3 of PDF Window of document docName to before page 19 of PDF Window of document docName
-- set page 3 of PDF Window of document docName to last page of PDF Window of document docName
-- set page 3 of PDF Window of document docName to first page of PDF Window of document docName
-- set page 3 of PDF Window of document docName to destination page number 19 of PDF Window of document docName
-- set page 3 of PDF Window of document docName to destination page 19 of PDF Window of document docName
-- set page 3 of PDF Window of document docName to destination 19 of PDF Window of document docName
-- set page 3 of PDF Window of document docName to before page XX of PDF Window of document docName
-- set page 3 of PDF Window of document docName to before page "XX" of PDF Window of document docName
-- set page 3 of PDF Window of document docName to before page "19" of PDF Window of document docName
-- set page "3" of PDF Window of document docName to before page "19" of PDF Window of document docName
-- set page "3" of PDF Window of document docName to page "19" of PDF Window of document docName
end tell -- application "Adobe Acrobat Professional"
I had tried the “first” and “last” earlier but forgot to note they didn’t work. Thanks for the suggestion though.
Boy, that was really stupid of me. I decided to try a “set” just to see what would happen, and forgot to change back to “move”. Thanks Stefan for pointing that out. And then thanks to SuperMacGuy, the “after” worked! Happy Day! Working test script is
tell application "Adobe Acrobat Professional"
activate
set docName to name of active doc
move page 3 of PDF Window of document docName to after page 19 of PDF Window of document docName
end tell -- application "Adobe Acrobat Professional"