Synchronize. Backup. Bootable Backup.
Whatever your backup or sync scenario, ChronoSync has got you covered!
Back to more tech notes


TNCS-0016 - Automatically Run a Sync When a Specific Application Closes

March 23, 2014


ChronoSync does not directly support scheduling a sync to run when an application closes. Use this document to create an AppleScript that, with the use of the application Do Something When, will trigger a sync to run when a specific application closes.


Use the following steps to monitor when an application closes with 'Do Something When' and create an AppleScript that runs a sync. This procedure makes use of the AppleScript Editor which be found in the Applications->Utilities folder as well as the utility 'Do Something When' available from their website.

  1. Open the AppleScript Editor

    Open the Utilities folder, found in the Applications folder of your Mac, then open the AppleScript Editor.

  2. Create the AppleScript

    Copy the following script and paste it into the AppleScript Editor:

    tell application "Finder" to open alias "Mavericks:Users:Hartigan:Desktop:Test.sync"
    tell application "ChronoSync"
    set myDocument to document "Test"
    tell myDocument
    delay 1
    repeat while syncStatus is not 0
    delay 1
    end repeat
    end tell
    end tell

    Modify the path name in quotes after the term 'alias' to name the saved sync document, and modify "Test" after the term 'document' to the exact name of the saved sync document as displayed in the sync document's titlebar. (This would be the sync document name without any filename extension.)

  3. Compile and Test

    Click the 'Compile' button in the AppleScript Editor toolbar. Check for any errors. Now, test the script. Remember, if everything works, the sync document should open and begin syncing! Now click the 'Run' toolbar button. Does the sync get launched? Correct any errors before continuing.

  4. Save the AppleScript

    Save the AppleScript by going to the menubar and choosing File -> Save. Make sure to choose the 'Application' File Format. Choose a directory to store the AppleScript, then choose 'Save'.

  5. Download and Install 'Do Something When'

    Download Do Something When from the link below:

    Double-click DSW.pkg to run through the installer.

  6. Launch DSW from System Preferences of your Mac

    Locate the DSW icon located under Other in System Preferences of your Mac.

  1. Enable 'Automatically Start on Login' and 'Start' the service:
Enable 'Automatic Start on Login' and Start the Service
  1. Configure the AppleScript in DoSomethingWhen

    Create a rule that launches an AppleScript (that launches the sync) after an application closes. This tech note will use Spotify as an example application that will trigger the sync to run when quit. Give the rule a name, something to remind you of its purpose. Change the "Mounts" popup to "Quits". Set the "When" popup to "Select Application...":

Create a rule
  1. Choose the Application to Trigger the Sync
Choose application to trigger sync
  1. Select the AppleScript to Run the Sync

    Click the blank popup next to the What / Open popup, select "Select Application or Document", then choose the AppleScript:

Select the AppleScript to Run the Sync
  1. Setup a Delay, then save the Do Something When rule

    Enter a safe Delay value, something long enough for the application to quit before the script launches the sync. Then click Save:

Enter a delay value


If all has gone well, the sync document should run approximately 10 seconds after Spotify, or the application you've chosen, is closed.


Mar-23-2014 - Created from Internal Support Notes.