Guides‎ > ‎

Run Action on Script Completion

posted Mar 23, 2012, 6:30 AM by Corey Z   [ updated Apr 20, 2012, 6:50 AM ]
Essentially what you need to accomplish this are 2 events. One to trigger the script and one to respond to the variable being set by Secure Settings. The attached project uses two variables "SCRIPT" and "SCRIPT_SUCCESS" to keep track of what script is executing and whether it was successful. You can modify these to your liking but they will have to be updated inside Secure Settings as well as in the Tasker profiles.

The event that will trigger the notification responds to the "SCRIPT_SUCCESS" variable being set to 0. This is the default exit value of most shell commands but it's possible your command will output something different, so please change this accordingly. Once the variable is set, a task is fired that checks the "SCRIPT" variable for its current value. If the variable matches the Command Name set in Secure Settings, then it will proceed. For this example, the script name is "myscript". Again, you can change this to suit your needs but make sure to change it in Secure Settings as well as the Tasker profile.

Once the check passes, you can use any notification of your liking to notify you that the script has finished. After that, clear the variable values so that they will be read correctly again later.

Corey Z,
Mar 23, 2012, 6:30 AM