Applescript to the rescue again…

Media_httpgagravaarwo_lgofl

I have over 4000 sheets of perforated A4 paper that need to have printed on to them a 2 colour graphic in specific places. This will then be put through a special ink-jet label printing device which will print out tickets that reference a database of descriptions & prices.Simple you’d think, however here’s the problem. The paper is of low quality (I did not purchase it, it’s for a client), and the high volume laser-printer I am using simply jams after a couple of prints. I assume it’s because of the way the paper is heated as it prints.The solution (as I found out the hard way with trial and error) is to only send 1 print, let the printer cool down and then send another – 4000 times.Having realised that it wasn’t practical to babysit InDesign, pressing command P every 50 seconds, I realised that Applescript could do this. After a quick search on the internet to get the code structure correct, I came up with this:repeat 4000 timesset CR to ASCII character of 13tell application “System Events”tell application “InDesign CS” to activatekeystroke “p” using {command down}keystroke CRend telldelay 50beepend repeatIn case you don’t know the wonders of Applescript, what this script does is to set character 13 (which is return on your keyboard) to the variable CR, it then tells the background application “System Events” to tell “InDesign” to come to the front, System Events then types “command-P” and “return”. InDesign is already set up to print just one print to the correct printer. It then waits 50 seconds and does it again, 500 times.If you don’t know Applescript I suggest you try it out. I have only basic knowledge of the code, however in my view it’s perfect for solving repetitive tasks just like this.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s