Creating a Login Task Applet

Here is an example of how an Automator workflow can be designed to perform a system task when the computer is started, rebooted, or the user is logs into their account. This example features the use of an Automator action for running UNIX scripts, and a second action for displaying system notifications.

The Downloads List

In OS X every item downloaded to the computer is examined as to the security procedures that should applied to it when the downloaded item is attempted to be opened or launched. These security settings, commonly referred to as the GateKeeper settings, are defined in the General tab of the Security & Privacy system preference pane.

While these security procedures are invaluable in protecting your computer from malicious software, they do create a trackable record of the items you download, by storing a URL reference to each downloaded item in a system log file.

To view this list for yourself, open and run the following script that displays, in the Terminal application, a list of URLs to the items downloaded to your computer:

While this list presents no security vulnerability, some users may want to periodically clear its contents. Using Automator, you can create a login item that will automatically clear this list whenever you log into or restart your computer.

Create the Workflow

This example is a simple workflow comprised of just two Automator actions. Follow the indicated steps to create the applet.

DO THIS ►Create a new document in Automator, choosing the Application option from the template sheet. Construct the workflow shown below or DOWNLOAD a completed copy of the Clear Downloads List applet.

workflow

 1  Run Shell Script • This Automator action provides the ability to run user-provided scripts using any of the following UNIX shells or languages: bash, csh, ksh, sh, tcsh, zsh, perl, python, or ruby. Add this action to the workflow, and replace its default script with the following script command: (triple-click the text to select)

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'

 2  Display Notification • This action will display a standard notification banner containing the text entered in the action inputs. Add this action to the workflow and enter the text of your desired notification.

DO THIS ►Save the workflow as an applet into the Utilities folder in the Applications folder.

Add to Login Items

Once you’ve created and saved the workflow applet, it is ready to be added to the default list of login items. A login item is an application or document that is automatically opened when the computer is restarted or the user logs in.

Login Items are installed by adding them to a special list found in the User & Groups preference pane of the System Preferences application  (⬇ see below ) 

system-prefs

Follow the steps outlined below to add the saved workflow applet to the login items list:

DO THIS ►Display the User & Groups preference pane  1  in the System Preferences application. With the current user selected in the lefthand list  2  select the Logins Items tab  3  to display the list of login items.

DO THIS ►Click the Add Items button  4  at the bottom left of the tab to summon a choose sheet from which you select the saved workflow applet. Once the applet is selected and sheet closed, the applet will appear in the login items list. Click the Hide checkbox to the left of the applet name  5  to indicate that the applet will not appear in the Dock when it runs. You can now quit the System Preferences application.

The Applet at Work

Now that the workflow applet has been created and installed, it will run whenever you login to the specified user account. The workflow will confirm the completion of its processing with a standard notification banner, like this one:  (⬇ see below ) 

banner

TOP