My needs are simple. We have many years of old quark files that need to be converted to InDesign. I am the local applescript expert; lolz made me laugh but anyways. I will be using automator to create a hot folder for people to drop a quark file in (on a dedicated mac box with ID).
Simply put at this time. I want the .qxp file to be opened in ID, saved in the same folder with the same file name with the .qxp replaced with .indd and closed. I have looked at numerous options. I tried a simple close, which pops up the save as dialog. I tried forcing the save at that point.
tell application "Adobe InDesign CS5"
close (front document) saving yes
end tell
Then i figured I would tell ID to just save the file then close the file…
tell application "Adobe InDesign CS5"
tell active document to (save) / yes
close active document
---close (front document) saving yes----
end tell
this still brings up the save as dialog and requires user intervention, even if it is to simply click the blue pulsating save button. I need to know how to bypass the dialog or automate the clicking of that blue pulsating save button.
Other thoughts have popped into my head and I need to look at either moving or deleting the .qxp file and probably saving the .indd file in a different location so the script doesn’t keep looping over and over and redoing files. But I would like to save that for a later issue. This is a learning thing for me and I as I learn I would like to make it better, but this is one roadblock I cant seem to find an answer for atm.
tell application id "com.adobe.InDesign"
open alias hfsPath
save document 1 to file ((text 1 thru -5 of hfsPath) & ".indd")
close document 1 saving no
end tell
But in practice you will probably want to save/move both files to a separate folder.
I currently have an automator folder action set up to to open files dropped in the folder to open them in InDesign, then the script is supposed to take over to tell indesign to save the file and close the file… then the next step of the automator function was to move the .qxp file to a “converted” folder. The automator part was simple… kind of, i might have a problem with it opening all the files and not doing them one at a time. but thats another probelm…
my skills in scripting are severly lacking and i see I have much reading to do before I get to this skill level…
SO I have a few questions, and they are probably newb questions…
when you type in “open alias hfsPath” in the script… what exactly is this doing? Automator is already opening the files… would this be duplicating that? Should I just skip automator for now to simplify things?
also would i replace the alias hfsPath with the actual path (which is “/Volumes/Data/Users/talton/Desktop/To Convert”
I am sorry, if this is newb stuff, i think i have jumped in to far to fast with this and may be confusing myself, which is kinda why i wanted to keep it a simple one file at a time function first. I may also be making this harder by using automater and applescript, but it just seemed like the best idea at the time.
Yes, I would avoid Automator. But however you do it, the key is that you have to know the name of the file you opened, so you can name the new file appropriately.
I used hfsPath to signify it is an HFS path, using colons instead of slashes.
I’d be inclined to use a stay-open AS applet that checked every few seconds for new files. Something like this (untested):
property folderPath : "/Path/goes/here/" -- must exist
property usedFolderName : "Used QXP files" -- subfolder name, must exist
property newFilesFolder : "New ID files" -- subfolder name, must exist
on idle
set theFiles to paragraphs of (do shell script "ls -p " & quoted form of folderPath & " |egrep '*.qxd'")
repeat with aFile in theFiles
set inputhfsPath to (POSIX file (folderPath & aFile)) as text -- QXP file HFS path
set idhfsPath to (POSIX file (folderPath & newFilesFolder & "/" & (text 1 thru -5 of aFile) & ".indd")) as text -- ID file path
tell application id "com.adobe.InDesign"
open alias inputhfsPath
save document 1 to file idhfsPath
close document 1 saving no
end tell
do shell script "mv -f " & quoted form of (folderPath & aFile) & space & quoted form of (folderPath & usedFolderName & "/" & aFile) -- move converted file
end repeat
return 10 -- seconds to wait before trying again
end idle
This is way awesome!! Thank you. I had to make a few changes… minor ones… since our files are qxp files and not qxd files… and i forgot to put a / at the end of the path…
One question… is their a way to suppress the warning dialog box that pops up if nothing is in the folder?