Okay, it was the count that I was missing. By the way the dialog message show 1 or “x” regardless of the actual document’s number in the series. In other words, if I drag 3 documents over the droplet they each print, but the preceding dialog would say 1 of 3 for all of them. Anyhow, I commented that out, and the corresponding currentDoc. since I noticed what was missing in the first place (edit: I think I noticed what went wrong, you had set currentDoc sitting outside the repeat statement (Nope, that wasn’t it)). I also opted for defining the the fileInfo variable as the file creator versus the extension as that would be a constant. Sometimes, especially in the case of OS 9 documents, not all would have their extension appended to the end. I also removed the delay and had the document print without a dialog.
My challenge now is figure out an easier way to open the creating application and print. Instead of having to list an huge amount of possibilities like Quark, InDesign, Explorer, Photoshop, Illustrator, etc. it would be ideal to define a variable that would indentify the default application (which it can capture from the info of the variable theDoc, as it returns the full path to the app), launch and print the file. Also, the script seems to work in InDesign CS, but not for Quark 4.11 (Classic).
Is there a way to, trim down the resulting default application:
alias “PowerBook 125GHz:Applications:Adobe InDesign CS:InDesign CS.app:”
so as grab only InDesign CS or whatever the app might be?
And once I do that can I not instruct that app defined as, say creatingApp, to open and issue the print command. I imagine I’m stuck since AppleScript needs the tell statement to contain the actual appName on the computer to use its dictionary. I know the use terms code but it wouldn’t work since the variable is defined as an existing app, not an unknown.
Here is what I have so far:
on open listOfDocs
set numDocs to count of listOfDocs
repeat with theDoc in listOfDocs
-- set currentDoc to 1
set fileInfo to file creator of (info for theDoc)
set Creator to default application of (info for theDoc)
-- set fileInfo to name extension of (info for theDoc)
-- display dialog "File " & currentDoc & " of " & numDocs & " is a " & fileInfo & ": " & name of (info for theDoc) giving up after 5
if fileInfo = "InDn" or fileInfo = "AD65" then
tell application "InDesign CS"
activate
-- open theDoc
print theDoc without print dialog
-- quit
end tell
else if fileInfo = "XPR3" then
tell application "QuarkXPress™ 4.11"
activate
open theDoc
print theDoc
-- close document theDoc
end tell
end if
-- delay 4
-- currentDoc = currentDoc + 1
end repeat
end open
By the way, the cool little “convert script to Markup” doesn’t seem to work for me. I double-click on the the app it doesn’t launch. =(