Print a ps file dropped in a folder

Hey,
This should be an easy one for all you scripters.

I want to create a script that prints a .ps file with a one of my desktop printers.
I´m using Folder Action Plus for this and my first attempt looks like this.


on adding folder items to this_folder
	
	tell application "Desktop Printer Manager"
		set default printer to desktop printer "myPrinter"
	end tell
	
	if button returned of (display dialog "Do you wish to print?" buttons {"Print", "Cancel"} default button 1) is "Print" then
	

Need help with this part. Everything I´ve tried so far doesn´t work. I want to print the document saved in this folder and then delete it.


	end if
	
end adding folder items to

This wouldn´t be to hard to solve I guess. Man, I must be tired! :?
Thanks!
Tobbe

If you’re using Mac OS X 10.2 you can use the “lpr” command. Since I don’t know if you’re using 10.2 I won’t go into detail. But you can type “man lpr” at the terminal for more information on how to use it. If you’re using Mac OS 9 or earlier, I think that desktop printers are treated as folders, so just tell Finder to move your file into the folder on the desktop that bears the printer name.

Best of Luck,

Hey Justin,
I´m using Mac OS 9.2.2. I´ve tried your suggestion but no luck. My script looks like this now.


on adding folder items to this_folder
	
	tell application "Desktop Printer Manager"
		set default printer to desktop printer "l394s-01"
	end tell
	
	
	if button returned of (display dialog "Do you wish to print?" buttons {"Print", "Cancel"} default button 1) is "Print" then
		tell application "Finder"
			select every item of folder "test" of startup disk
			move selection to folder "l394s-01" of desktop
		end tell
	end if
	
end adding folder items to

Any tip?
Thanks!
Tobbe

Not that I want to upset any script in the making…

…but have you considered this free app at Bare Bones Software called “Drop PS”?

Check out:

http://www.barebones.com/products/freeware.shtml

to download.

"Drop•PS is a PostScript downloader; with it, you can transmit text files containing PostScript commands to any AppleTalk-connected PostScript printer. "

Regards

Thanks, but if it´s like they say AppleTalk-connected printers only then I can´t use it due to us printing via a NT-printspooler server. I´ll check it out though.
Thanks.
/Tobbe

If you can create Desktop printer files on your mac then it should work.

Dave. :slight_smile:

To support the previous post, it should be noted that WindowsNT and other “server” versions of windows speak AppleTalk.

Yes we know that. But we are not able to use appletalk due to switchconfigurations. And we can´t do anything about it. We´re forced to adapt our Macs to this situation.
We can´t use appletalk at all on our network. We use Dave to connect to printers and homedirectorys.
Thanks!
Tobbe

You could use DropPS aiming at an ‘LPR’ desktop printer. Have you tried to set one up using Desktop Printer Utility, under 9?

Steve