1. Download our Official Android App: Forums for Android!

How to create a task that imports a task

Discussion in 'Android Apps & Games' started by Graalmania, Jul 24, 2016.

  1. Graalmania

    Graalmania Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jul 24, 2016

    Jul 24, 2016
    2
    0
    5
    Male
    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.
     

    Advertisement

  2. lareya

    lareya Lurker
    Rank:
    None
    Points:
    6
    Posts:
    7
    Joined:
    Feb 24, 2011

    Feb 24, 2011
    7
    3
    6
    Female
    Check Reddit, someone posted this already.
     
  3. Graalmania

    Graalmania Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jul 24, 2016

    Jul 24, 2016
    2
    0
    5
    Male
    Ok thanks. I searched around and couldn't find it. Can you share the link?
     
  4. Thom

    Thom  
    VIP Member
    Rank:
     #24
    Points:
    1,318
    Posts:
    11,902
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,902
    4,909
    1,318
    Male
    Software Developer
    Keene, NH USA
    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
     
  5. lareya

    lareya Lurker
    Rank:
    None
    Points:
    6
    Posts:
    7
    Joined:
    Feb 24, 2011

    Feb 24, 2011
    7
    3
    6
    Female
  6. Thom

    Thom  
    VIP Member
    Rank:
     #24
    Points:
    1,318
    Posts:
    11,902
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,902
    4,909
    1,318
    Male
    Software Developer
    Keene, NH USA
    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
     
    #6 Thom, Jul 31, 2016
    Last edited: Jul 31, 2016

Share This Page

Loading...