Hi there,
First I’m completely new in applescript, but because our last windows system broke down which we used for calculating in a DOS program i’m now looking for someone who can help me.
I already made it possible with Dosbox to run the old DOS program on my MAC and instead of printing directly to a printer it’s now generating .prt files to a folder called capture. It’s also possible to print these file because when I go to Terminal en give a print job with the LP or LPR instruction it prints the .prt files, so far so good.
But because the DOS program is generating a lot of .prt files I’m looking for manner to automatically print the files when they are created in the folder capture.
I found the following applescript below on Max OS X hints and it should be able to print a new files in a folder when it’s dropped in the capture folder, but I can’t get it to work.
What did I do until now:
start Automator, select Mapaciton (Mapactie in dutch), select the capture folder, select run applescript, paste the script below in the field which pops up. Then i save the script. But after dragging en dropping files or generating files in folder capture nothing happens.
on adding folder items to this_folder after receiving these_items
try
tell application "Finder"
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
set the path_string to this_item as string
set the final_path to POSIX path of the path_string
do shell script "/usr/bin/lp '" & final_path & "'"
on error error_message
tell application "Finder"
display dialog "Error for item " & (this_item as string) ¬
& ": " & error_message buttons {"Continue", "Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end repeat
end tell
on error error_message
tell application "Finder"
display dialog error_message buttons {"Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end adding folder items to
Hopefully some one can help me with this problem or can tell me what I’m doing wrong.
Model: iMac
AppleScript: Versie 2.6 (152)
Browser: Safari 537.73.11
Operating System: Mac OS X (10.8)