Command Line Automation

Command Line Automation

I was looking over a technician’s shoulder as commands were typed into a terminal window. I recognized these commands and was amazed that our equipment today could be controlled by one line of text. After a little research I discovered that this command used by the technicians, the “LPR” command line, has the power to tell a copier what drawer to use and how many copies to print plus a long list of other options. All of this information is passed directly to the equipment in one string.

A recent flow set up that required the creation of a 2D barcode was the latest challenge and I recommended to use barcode software that could generate barcodes on the command line so we could harness the power of the CLI. You can still use the program to manually create barcodes with the interface but the command line can be set up to run in an automated workflow. The “Execute Command” element in Switch can be placed in a flow and the job will be used to help create the string of information using text and variables that are available through job tickets. This barcode workflow can generate jpegs or other image formats to be used on banner sheets when printing or even use the clipboard for a copy paste.

More examples

Both Mac and PC have command line interfaces (CLI). Some examples of commands that can be used easily in automation are as follows:

cURL is part of the Mac OS and can be used to upload and download files from URLs. It can also be used to POST data to websites for status updates and notifications.

Wget runs in Windows and performs much the same tasks as cURL. Both these tools can be automated using Switch to integrate with websites and portals. They can be used to log into websites with passwords and security settings to download or upload files.

LPR that was mentioned before is a printing command line that can talk to almost any printer and, depending on the features of that printer, be controlled by the data in one string.

Most people’s eyes glaze over when thinking about this type of setup but it really only needs to be set up once and then the automation takes over. When using variables, the string will be built using the data from the file so when the files changes so does the data. For example, an online on demand ordering system that typically orders 1 to 10 copies at a time will send the quantity information with the file and in turn this can be used to control the printer. The LPR command will be built on the fly to choose the paper based on the order item and the quantity based on the number of copies.

Using the “Execute Command” element in Switch allows you to use the power of the operating system to execute any command you would like. It has built in error detection and reporting as well so if the command comes back unsuccessful you will be notified.

Look at the number of products that are already automated using plug ins in Switch then add the number of commands that are available on either Windows or Mac operating systems. Now use your imagination to get started on all of your projects because there is a way to automate almost anything.