widget V2: start tast with parameter

101 views
Skip to first unread message

Eric Kruis

unread,
May 27, 2025, 5:20:34 AMMay 27
to Tasker
I have made a widget V2 with some buttons, and I want to use a button to start a task and pass a parameter to that task. Is that possible?
The workaround is of course to start an "in between" task with only a perform task action in it, or use a variable, but I would like to avoid that.
Thanks!
Eric

João Dias

unread,
May 27, 2025, 6:02:04 AMMay 27
to tas...@googlegroups.com
Yes, you can do that! :)  Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Eric Kruis

unread,
May 28, 2025, 4:40:02 AMMay 28
to Tasker
There you go:

Task: GPS Widget

A1: Widget v2 [
     Widget Name: GPS Tracker 2
     Layout: Custom
     Custom Layout: {
       "children": [
         {
           "children": [
             {
               "type": "Row"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_device_location_searching",
               "backgroundColor": "#008000",
               "isWeighted": false,
               "size": 45,
               "task": "GPS Handmatig Aan",
               "type": "IconButton"
             },
             {
               "size": 20,
               "type": "Spacer"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_device_location_disabled",
               "backgroundColor": "#D00000",
               "size": 45,
               "task": "GPS Handmatig Uit",
               "taskVariables": {
                 "%": ""
               },
               "type": "IconButton"
             },
             {
               "size": 20,
               "type": "Spacer"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_maps_my_location",
               "backgroundColor": "#0000A0",
               "size": 45,
               "task": "10 Min Nauwkeurig Tracken",
               "type": "IconButton"
             }
           ],
           "type": "Row"
         }
       ],
       "horizontalAlignment": "Center",
       "verticalAlignment": "Center",
       "fillMaxSize": true,
       "type": "Column",
       "useMaterialYouColors": false
     }
     Material You Colors: On
     Ask To Add If Not Present: On ]

A2: [X] Widget v2 [
     Widget Name: GPS Tracker 2
     Layout: Custom
     Custom Layout: {
       "children": [
         {
           "children": [
             {
               "type": "Row"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_device_location_searching",
               "backgroundColor": "#008000",
               "isWeighted": false,
               "size": 45,
               "task": "GPS Handmatig Aan",
               "type": "IconButton"
             },
             {
               "size": 20,
               "type": "Spacer"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_device_location_disabled",
               "backgroundColor": "#D00000",
               "size": 45,
               "task": "GPS Handmatig Uit",
               "taskVariables": {
                 "%": ""
               },
               "type": "IconButton"
             },
             {
               "size": 20,
               "type": "Spacer"
             },
             {
               "buttonType": "Square",
               "contentColor": "#FFFFFF",
               "icon": "android.resource://net.dinglisch.android.taskerm/drawable/mw_maps_my_location",
               "backgroundColor": "#0000A0",
               "size": 45,
               "task": "10 Min Nauwkeurig Tracken",
               "type": "IconButton"
             }
           ],
           "type": "Row"
         },
         {
           "size": 15,
           "type": "Spacer"
         },
         {
           "children": [
             {
               "color": "#FFFFFF",
               "text": "%GPStrackpoints trackpoints",
               "type": "Text"
             }
           ],
           "type": "Row"
         }
       ],
       "horizontalAlignment": "Center",
       "verticalAlignment": "Center",
       "fillMaxSize": true,
       "type": "Column",
       "useMaterialYouColors": false
     }
     Material You Colors: On
     Ask To Add If Not Present: On ]


Op dinsdag 27 mei 2025 om 12:02:04 UTC+2 schreef joaomgcd:

João Dias

unread,
May 28, 2025, 5:02:01 AMMay 28
to tas...@googlegroups.com
Ok, so, edit the widget in the widget editor and in each element you have the "Interaction" tab. There you can set a task to be called  and you can add variables. Those variables will then be available in the task that is called :)

Eric Kruis

unread,
May 28, 2025, 11:14:42 AMMay 28
to Tasker
Thanks for your quick response.
I already figured out I could use variables, but I was just wondering if I could also use parameters to start the task with.
I will use a variable.

Thanks again!
Eric

Op woensdag 28 mei 2025 om 11:02:01 UTC+2 schreef joaomgcd:

João Dias

unread,
May 28, 2025, 1:06:09 PMMay 28
to tas...@googlegroups.com
Parameters are just variables 😅 Or do you mean something else?
Reply all
Reply to author
Forward
0 new messages