I am trying to write a script that will save copies of all the open documents of a certain application (called “NeO”) into a certain folder. (The app has a tendency to drop data from its documents from time to time, so I’m trying to improvise an auto-save feature.) Right now I have the code below, but it doesn’t work for a couple of reasons.
set docList to every document
repeat with doc in docList
tell application "Finder" to duplicate doc to "/users/j/documents/computer/NeO/JRR_autosaves"
end repeat
Issues:
- How to specify in the first line that I only want documents from the application “NeO”?
- How to specify the destination directory? The way the code is written now produces an error:
“error “Can’t make "/users/j/documents/computer/NeO/JRR_autosaves" into type location reference.” number -1700 from “/users/j/documents/computer/NeO/JRR_autosaves” to location reference”
Note: NeO does not have built in scriptable functionality, otherwise I think I could use a solution such as below, telling NeO to list its own documents (which I’ve seen used for other apps such as QuarkXPress that I presume are scriptable), which would sovle issue (1):
tell application "NeO"
set docList to every document
repeat with doc in docList
tell application "Finder" to duplicate doc to "/users/j/documents/computer/NeO/JRR_autosaves"
end repeat
end tell
But when I try the above, I get an error (“error “NeO got an error: Can’t get every document.” number -1728 from every document”).
Thanks for any suggestions!