Automatically Run Your Sync via AppleScript Create an AppleScript that will open a saved sync task, run it, save it and close it

TNCS-0015 – Automatically Run Your Sync via AppleScript

Created: March 23, 2014

Some users prefer to have an icon on their desktop that, when launched, automatically opens their sync document and runs it all in one action. Use this document to create an AppleScript that will open a saved sync document, run your sync, then save and close it.

RESOLUTION

Use the following steps to create the AppleScript to launch and run your sync. This procedure makes use of the AppleScript Editor which be found in the Applications->Utilities folder.

Open the AppleScript Editor

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

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”
activate
set myDocument to document “Test”
tell myDocument
Synchronize
delay 1
repeat while syncStatus is not 0
delay 1
end repeat
save
close
end tell
quit
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.)

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.

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, such as the Desktop, then choose Save.

CONCLUSION

If all has gone well, you should be able to open and run the saved sync document by double-clicking the AppleScript file you’ve just created.

REVISION HISTORY

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

Shopping cart0
There are no products in the cart!
Continue shopping
0