Fixing Printing droplet in 10.3

I need some help here folks. The last couple months I’ve been moving my department over to OS X. One of the conveniences of OS 9 was the ability to select multiple document (i.e. Quark docs), command+p, set up the first document’s print settings, then all the documents would print one after the other, then close. As you know the command+p from the Finder functionality was lost in OS X. I was able to track down a droplet called OSA Printer, from the resources on this site. I was working fine in 10.2.

Now that I’m moving to 10.3, it no longer works, entirely. If I drag multiple Quark docs onto it it will present the print dialog for that document but it will onll print the first document of the group! This is the same behaviour for InDesign docs dropped onto it. Drag ‘n’ drop onto a desktop printer results in the same behaviour as well.

The author of the script is no longer reachable (website and email not working) and since it’s a compiled read-only script, I can’t open it up and try to play with it to make it work.

Can anyone give me a hand with this dilemma? My team isn’t too keen on moving to 10.3 until this get sorted out.

Have you tried simply creating a desktop printer and dropping the files you want to print on that? Just wondering if you need to go for an applescript solution when the OS may provide one for you.

I guess you skipped over the part below :wink:

I seem to be getting closer. I pulled the following from another forum:

on open listOfDocs
repeat with theDoc in listOfDocs
set fileInfo to file creator of (info for theDoc)
if fileInfo = “XPR3” then
tell application “QuarkXPress™ 4.11”
print theDoc
close document 1
end tell
else if fileInfo = “InDn” then
tell application “InDesign CS”
print theDoc without print dialog
end tell
end if
delay 4
end repeat
end open

If it’s I drag 3 InDesign docs onto it will print 2 out of the 3. I inserted the delay at the end hoping it would give the script enough time to trigger the event for each subsequent doc. Nope. It doesn’t work at all for the Quark 4.11 docs.

Guess that’s what happens when I answer questions while in the middle of an infinitely boring meeting. :smiley:

Let’s see… I’m not going to be able to provide code, since I don’t have the apps, but what about some pseudo-code/advice?

Can you have the droplet create a loop stepping through extension types, selecting all of the dropped files with the same extension?

If you can, then you should be able to create a loop that steps through all INDESIGN docs, printing one at a time, if the list isn’t empty. Then if the list is not empty for QUARK, step through those, printing one at a time.

I’d also suggest using Counters for debugging purposes (plugged in with Display Dialogs that show the Doc# and Name). Once it all works, you can drop these check points.

Not having an Applescript dictionary for Preview, I pieced this together. (I couldn’t determine how Preview wants print commands, however I can see the files open/close).

on open listOfDocs
	set numDocs to count of listOfDocs
	set currentDoc to 1
	repeat with theDoc in listOfDocs
		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 = "jpg" then
			tell application "Preview"
				activate
				open theDoc
				print theDoc
				quit
			end tell
		else if fileInfo = "sql" then
			tell application "TextEdit"
				activate
				open theDoc
				print theDoc
				close document theDoc
			end tell
		end if
		delay 4
		currentDoc = currentDoc + 1
	end repeat
end open

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. =(

Did you decompress the download with StuffIt 8.0? If so, then update to 8.0.2 and try a fresh download. StuffIt 8.0 was a disaster and rendered expanded executables useless.

Jon

Hi there,

I’m new to this list, and new to Applescript, so please excuse my ignorance!

The topic you have been discussing about printing multiple files from finder using their relevent application is really usefull to me, thanks!

Though, I need to know how to get the information that tells Applescript what application to open, eg Indesign is InDn, QuarkExpress is Xpr3 etc, how do I find this out for a Freehand or Word document for example?

Thanks very much for your help,

Jamie McDonnell
Planning Technician
Dumfries and Galloway Council

Hi List,

I have now got as far as a folder script that recognises the file type being dropped in,
opens the necessary application and prints the file, but am getting halted by the dialog box…

I have used the line “print theDoc without UsingDialog” as this seems to be the command that is in Freehand’s dictionary, but no joy, and the line "print theDoc without print dialog " doesnt want to work either :frowning:

Any other ideas? Cheers all, the script so far is below…

[b]on adding folder items to this_folder after receiving these_items
– these_items will contain a list of file references to the added items

set numDocs to count of these_items
repeat with theDoc in these_items
	-- 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 = "FH11" then
		tell application "FreeHand MX"
			activate
			-- open theDoc 
			print theDoc without UsingDialog
			-- Print using the usual print dialog. NOTE: All other settings will be ignored.
			-- quit 
		end tell
	else if fileInfo = "8BIM" then
		tell application "Adobe Photoshop CS"
			activate
			open theDoc
			print theDoc without Dialog
			-- close document theDoc 
		end tell
		
	else if fileInfo = "Jpeg" then
		tell application "Preview"
			activate
			-- open theDoc 
			print theDoc without usingDialog
			close document theDoc
		end tell
	end if
	
	-- delay 4 
	-- currentDoc = currentDoc + 1 
end repeat

end adding folder items to