User Tools

Site Tools


working_with_tasker

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
working_with_tasker [2014/09/02 11:45]
pierrox created
working_with_tasker [2015/05/15 08:06] (current)
pierrox Add lightning variables
Line 2: Line 2:
 Built-in Tasker support starts with LLX 10.5b1. Built-in Tasker support starts with LLX 10.5b1.
 This support consists in  This support consists in 
-  * triggering ​Lightning actions (such as desktop navigation, script execution) from a Tasker task +  * launching ​Lightning actions ​from a Tasker task 
-  * triggering ​Tasker tasks from Lightning, through scripting+  * launching Lightning scripts from a Tasker task (starting at 12.4b2) 
 +  * setting variables inside Lightning ​from a Tasker task (starting at 12.5b1) 
 +  * launching ​Tasker tasks from Lightning, through scripting
  
 ====== Running Lightning actions from a Tasker task ====== ====== Running Lightning actions from a Tasker task ======
 All available Lightning actions can be used. This is similar to starting a Lightning action shortcut. In Tasker, create or modify a Task, add an action, select Plugin, then select Lightning Action. Once the action has been added edit its configuration:​ the Lightning action menu is displayed so that you can select one. All available Lightning actions can be used. This is similar to starting a Lightning action shortcut. In Tasker, create or modify a Task, add an action, select Plugin, then select Lightning Action. Once the action has been added edit its configuration:​ the Lightning action menu is displayed so that you can select one.
  
-The "​Run ​a script" ​Lightning action ​has particular behavior ​when run from Taskerit is possible to pass some data from Tasker ​to LLX with variable replacement. These data can be retrieved in a Lightning ​script using [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​Event.html#​getData()|Event.getData()]].+====== Running Lightning scripts from a Tasker task ====== 
 +Starting at version 12.4b2, it is possible to directly select ​a script ​as a plugin action in Tasker. This is equivalent to selecting a Lightning action ​and then select "​Run ​script"​. In addition, ​when selecting the script, there is an option to select where to execute the script (in the desktop, in the app drawer, in the lock screen or in the background). 
 + 
 +When running a Lightning script ​from Tasker it is possible to pass data to Lightning ​with variable replacement. These data can be retrieved in the script using [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​Event.html#​getData()|Event.getData()]].
 For instance, if you script is  For instance, if you script is 
 <sxh javascript;>​ <sxh javascript;>​
Line 14: Line 19:
 </​sxh>​ </​sxh>​
 Then calling this script from Tasker with the data **%TIME** will display a dialog in Lightning with something like **11:17** Then calling this script from Tasker with the data **%TIME** will display a dialog in Lightning with something like **11:17**
 +
 +====== Setting variables inside Lightning from a Tasker task ======
 +For 12.5b1 and above. Variables are primarily used in bindings (expert mode). They are used to animate items properties, such as position, transparency,​ colors, and so on. These variables can be set inside Lightning or from third party apps. In particular Lightning provides a Tasker plugin to set its own variable.
 +When adding an action in Tasker, select Plugin, then select Lightning Variable. You then need to enter the name of a variable (or pick an existing one), then enter the value for the variable.
  
 ====== Starting Tasker task from Lightning, though scripting ====== ====== Starting Tasker task from Lightning, though scripting ======
 Tasker can only be invoked from scripting at the moment. This is done using the TaskerIntent and ActionCodes classes and the [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​LL.html#​sendTaskerIntent(TaskerIntent,​ boolean)|LL.sendTaskerIntent() method]]. Tasker can only be invoked from scripting at the moment. This is done using the TaskerIntent and ActionCodes classes and the [[http://​www.pierrox.net/​android/​applications/​lightning_launcher/​script/​reference/​net/​pierrox/​lightning_launcher/​script/​api/​LL.html#​sendTaskerIntent(TaskerIntent,​ boolean)|LL.sendTaskerIntent() method]].
 +
 +====== Important notes on background scripts ======
 +Scripts run in the background are executed in a special context. Since there is no UI, not all features are available. For instance it is not possible to get the cell size of a container since it is not displayed, nor it is possible to get the list of open folders. Keep in mind that scripts in background are not executed for the desktop, the app drawer or the lock screen, but "​outside",​ without a screen. It is allowed to change items and container properties, but not to navigate into a desktop or open a folder.
 +
 +The API documentation mentions cases where a given method is not supported in background mode.
 +
 +When a script is run in the background, the Lightning Launcher app may be started by the Android system (it will remain invisible), and it may be stopped after a while. As a consequence changes made to items that are not persistent will be lost.
  
 ===== Calling an existing task ===== ===== Calling an existing task =====
working_with_tasker.1409658340.txt.gz · Last modified: 2014/09/02 11:45 by pierrox