Script Editor automatic backups

When you activate a script in the script editor (which compiles and loads the script), the script editor first saves a backup of the script's text into the standard plugins† Scripts folder. In the event that your script goes into an infinite loop of alerts* when it loads, you can retrieve the text of your (otherwise unsaved) script from this backup.

The backups have a file extension of .mwscript.txt (so they won't load into the Command menu). They will accumulate in there, so if you edit hundreds of scripts, you might want to have a clean out from time to time.

†In v7.0.x it was custom plugins Scripts. Changed to Standard Plugins Scripts in 7.1 to avoid accidentally distributing these source code backups to all users via an Upload All.

*It is a good idea not to use Alerts for debugging. An endless loop of alerts is impossible to break out of (because the event queue containing your Cmd-period or Esc gets flushed when the alert window closes—the MWScript virtual machine will not see it). Use say("msg"), syslog("msg"), or Navigator("", "msg").

Posted in MWScript, Tip du Jour | Comments Off on Script Editor automatic backups