• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to create a task that imports a task

Graalmania

Lurker
Is there a way to create a task that imports a pre-determined tasker *.xml file and then run it or update an existing task that is already running/programmed? The xml file will be changed periodically and remotely via dropbox and dropsync app. If I keep the same filename and structure I thought it may be doable? Wishful thinking or....? Thanks in advance for any thoughts or advice.
 
Welcome to Android Forums.

Tasker has an Import action. I tried it for you and could not get it to work.

Passing a task as an XML file is a dangerous practice. When you import an xml file Tasker will prompt you to make sure you want to do it. It could easily be modified by someone else in the transmission and cause problems when installed.

You could create an APK using Tasker App Factory. When you installed the new version Tasker would also require manual intervention to complete the installation for the same reason.

What is the changing data that you are trying to update? Perhaps there is an alternate approach that is not dangerous.

... Thom
 
Here is the answer ...

AA - simulates loading the changing XML file to the SD card
BB - imports the XML file and executes it
CC - sample imported XML file

AA
A1: Copy File [ From:/sdcard/Tasker/tasks/CC.tsk.xml To:/sdcard/CC.tsk.xml Use Root:Off ]
A2: Delete File [ File:/sdcard/Tasker/tasks/CC.tsk.xml Shred Level:0 Use Root:Off ]

BB
A1: Copy File [ From:/sdcard/CC.tsk.xml To:/sdcard/Tasker/tasks/CC.tsk.xml Use Root:Off ]
A2: Read File [ File:/sdcard/Tasker/tasks/CC.tsk.xml To Var:%import ]
A3: Import Data [ Type:Task Source:Variable Variable:%import ]
A4: Perform Task [ Name:CC Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]

CC
A1: Flash [ Text:-- CC -- Long:Off ]
A2: Beep [ Frequency:8000 Duration:1000 Amplitude:50 Stream:3 ]

Run AA
Run BB and it runs CC
Delete /sdcard/Tasker/tasks/CC.tsk.xml
Run BB and it runs CC

When you go to the Tasker User Interface the task CC is not listed.
The name of the tsk being executed in BB is found at <nme></nme> in CC.tsk.xml

... Thom
 
Last edited:
Back
Top Bottom