Falcosc / locus-addon-tasker

Locus Maps API useable as Tasker Plugin
GNU General Public License v3.0
9 stars 2 forks source link

Trigger a Tasker task via Locus "Quick Bookmarks"? #17

Closed TapioOfTapiola closed 3 years ago

TapioOfTapiola commented 3 years ago

Hi Falco,

is there a way to do (subject)? Is there something I do not see? Currently, in order to send lat/lon to a Task, I am using Tasker scenes, which run on top of Locus GUI.

We wouldn't even need parameters from bookmarks to task, because the task itself can pull all it needs via your plugin.

thx

Falcosc commented 3 years ago

API does provide a way to trigger the location selection screen of locus maps.

Which use case do you have? I can add it if you would like to share your task as example for the new function.

If your use-case does fit the API, we can discuss how to process the point selection response (event). Either a tasker event or you configure inside the point selection call which task gets started after point selection does finish.

I ask about your use case because it may fits the point details screen "share" action better, you will find a generic run task command there.

neoaliphant commented 3 years ago

Yes This is what ive got as the url of my quickbookmark tasker://secondary?task=putnamehere

in tasker, profile with event = secondary appened which starts a task , in which i have some if loops to start another task

TapioOfTapiola commented 3 years ago

Neo, will try, I was always searching for a way to start tasks via the url scheme!

Use case is, I start a lot of tasks which need the map center lat/lon. Eg, a task which gives me position details (address from osm api, get pluscode etc.) or a task, which moves map to a close, random position. So I need a way to access those tasks without leaving Locus (ideally). One way is using Tasker scenes. But Locus Bookmarks are lovely as well.

Look, things I do: https://youtu.be/_7W2kzzaSxs

Falcosc commented 3 years ago

Ok, I thought these use cases are more easy to do with the locus maps point details screen. The point details screen can share position with other apps, like SMS your friends and you can also run tasker tasks based on the selected point.

Map center lat/lot is already availaible in the request sensor and stats tasks.

How would you like to use the pick location task? It will open the locus maps dialog with the 9 tiles of possible ways to select a loation and after using one and finishing the action the callback is received as an event.

I guess wait for result is the usual way because the UI query tasks do this as well.

neoaliphant commented 3 years ago

from point details screen, is there any way to share to specific tasks, rather than the run task as I have hundreds of tasker tasks....

which is why quickbookmark is usefull as I inly have in there the tasks that use locus

Also some of the tasks I use arent point related but general locus, so point detail isnt always applicable. It would be good if we could add specific tasker tasks as functions to panel, i tried making a task in to an app with app factory but it didnt work

Falcosc commented 3 years ago

The App Factory can only create dumb tasks without context, like https://github.com/Falcosc/locus-addon-tasker/wiki/Custom-Task-Icon-at-Locus-Panel so you dont have point data in there.

We can not add share actions dynamically, but we can configure a task name filter:

Would the share button in point details screen better than a point pick dialog? Because point pick dialog needs an additional click to select how you want to select a location.

I always thought that the request sensor and stats action field map center lon/lat would be the best thing because you don't need any additional clicks.

Is there a special feature in the locus location selection dialog which is better than map center lon/lat? Like text search in offline database or something similar?

Falcosc commented 3 years ago

But you could create an app "Send Map Center to Friends" which collects the map center lon/lat and sends it in your custom format to your friends.

If you like the location selection dialog more then map center lon/lat, I need to know how you want to process the response:

TapioOfTapiola commented 3 years ago

I need to read your comments later. I agree with neo, starting a specific task from Locus UI, as direct as possible, would be a massive step forward. Eg, as mentioned, directly from the Locus toolbar.

@neoaliphant, I tried your bookmark approach. Url: tasker://secondary?task=WorldPosition The profile in Tasker triggers, but the content of %sa_action is "android.intent.action.VIEW". Where is my "WorldPosition" here?

neoaliphant commented 3 years ago

Hi Falco

Task name filter would be brilliant, that would make share from point useable Would not then need pick from locus for location as could do all in locus. ive been going out of locus and using pick from location using tasker native, which uses google map, so not so usefull

I might try app factory again and make a task that simply calls anotehr task, and see if that will be able to be converted to an App for adding to function menu

neoaliphant commented 3 years ago

tortuosit the variable being passed is %task

so if you had a task called TaskerURL that was trigged by the tasker secondary this task could have If %task ~ WorldPosition perform task WorldPosition enf if

TapioOfTapiola commented 3 years ago

Awesome, works, thank you!

Edit: I just use perform task: %task I reckon you workaround task names containing spaces?

useless, but fun with Tasker. I have created quite a few useful position calc and (seeded) randomness functions. https://youtu.be/D66wa_qnWmU

neoaliphant commented 3 years ago

Excellent

Falcosc commented 3 years ago

@neoaliphant I can implement both ways. Would the location pick still make sense if we have a filtered share point? We may be able to hack the share points list, by registering 3 entries (hard coded in app description) but disable 2 of 3 entries to have a dynamic way of adding entries into the share point list.

I don't know where you start your "select point" usecase. If you need a locus waypoint anyway, then it would be best to change the process order and start with waypoint creation.

But if you have use cases where you don't want to save the waypoint, then it would not make sense to create a point only to get the share menu.

For exmaple send location to friends, this is an usecase where you would need a point on map anyway, otherwise you wouldn't know where your friends are waiting for you ;)

neoaliphant commented 3 years ago

If we filtered share point then I wouldnt need location pick anymore,

id rather use the point> share to task, but having all my tasks listed was unuseable

most of my info is locus waypoint or kml map items.

so yes, filtered share list would be great, and then I wouldnt need pick from locus screen.

Not sure what you mean by " We may be able to hack the share points list, by registering 3 entries (hard coded in app description) but disable 2 of 3 entries to have a dynamic way of adding entries into the share point list." but anything would be better than all the tasks listed.

Falcosc commented 3 years ago

Currenlty we have only one "Run Task" entry for all 6 places in locus maps:

https://github.com/Falcosc/locus-addon-tasker/blob/e08014643dbfa91b0c1f39898bf96537f9837609/app/src/main/AndroidManifest.xml#L51-L52

Maybe I can make this more dynamic and less hard-coded, but it is likely that at least the label "Run Task" need to be hard-coded

Falcosc commented 3 years ago

@neoaliphant @tortuosit Proof of concept is done. We can have dynamic entries in the share button (sort of)

I can create a configuration screen where you can turn the following things on and off. This is how the default settings look like:

Run Task

Run Task 2

Run Task 3

But there are the following limitations:

The Task Name Regex filter includes project name, so you have to match for projectname/taskname. This does happen based on your regex:

neoaliphant commented 3 years ago

before the above change, should Run Task be visible in the main functions list , for adding to the side panel? only I cant see it anywhere in functions , showing fine in other places

So in a use scenarion If Run Task was a menu task, theat had tasks that werent point or track dependent then it could be configured to show only in function list, searching etc

If Run Task 2 was another different menu, that had tasks that were point dependent, it could be visible only in the point screen and sub menu of points

to be honest, I would probably only need 3 filters to match each task, a menu task, otehrwise if the tasks were called Locus Task Point Share, Locus task Point Navigate and the regex was Locus task Point then there would be a list

Locus Task Point Share Locus task Point Navigate

which would look ugly, but would still work

Main issue is the Run task, Run task 2 etc

I would suggest instead Run Task Run Task on Point Run Task on Track

and have default config to show/hide these on the respective sections, ie hide Run Task on Point in the tracks menu etc

Falcosc commented 3 years ago

Run Task on Point or Run Task on Track does not work as secondary and thrid option name, because it would not make sense to call the 2nd Button "Point" if you use this button in the track share section.

You already get 7 filters to configure all 7 places of the run Task button.

I want to know how we could name the secondary and third option. For example point actions

Track.actions

So in total you can configure 21 filters, 3 buttons for each 7 places. How should we name the secondary and third button of every place?

Falcosc commented 3 years ago

For Menu Panel you better do this https://github.com/Falcosc/locus-addon-tasker/wiki/Custom-Task-Icon-at-Locus-Panel because you should use the flexibility of the panels to define a custom icon instead of using the run task action with it's hardcoded generic tasked icon.

Falcosc commented 3 years ago

"function list" Is not the panel function list. It is the main menu entry in the main menu section "functions"

I found 6 of 7 places. Only "points screen tools button" is a mystery for me. No idea where the point screen tool button could be. It is not the share button, the share button is "sub-menu of every point"

neoaliphant commented 3 years ago

"Function list"

In more functions (LM4) its not in the addons section not a problem as appfactory for side panel would be better.....ill try again with a simpler menu only task.

"points screen tools button" in point manager, if you select one or more points so they are ticked in the ^ button, there is a runtask

neoaliphant commented 3 years ago

Re the Run Task 2 or 3

I dont think I would ever remember what tasks they were, so I would probably always use a single task, one general, one in points, one in tracks, that then calls up a menu within the task. so I will probably be hiding Run Task 2 and 3 from all locations.

as its hardcoded in, I think leaving as task 2 and 3/

Thanks falco for the best addon, its so cheap as well :-)

neoaliphant commented 3 years ago

Awesome, works, thank you!

Edit: I just use perform task: %task I reckon you workaround task names containing spaces?

useless, but fun with Tasker. I have created quite a few useful position calc and (seeded) randomness functions. https://youtu.be/D66wa_qnWmU

I like your tasks, i think im going to imprve mine with some of your features i use a load of the request sensors to get a load of the data, and then email it to myself and copy to clipboard i havent got all the address data...

perform task: %task is easier i have some if loops as im doing some set variables before I call the next task so it jumps to a different part of following tasks

Its going to be all different again with falcos improvements mentioned above

TapioOfTapiola commented 3 years ago

Look what I worked on yesterday. Build a readable address from lat/lon by OSM Api. I like the api. Advantage is, buildings/manmade are added. It's specialized in building german addresses though. I wanted to create addresses well readable by my wife. If par2 true, debug values added. https://taskernet.com/shares/?user=AS35m8kdDIMDeveQcQfRglam%2Fah1mTW%2FWcg05FZ39c0i1q%2F77iY3E7cIwxCkXqJTaTA%3D&id=Task%3AfGPS_getAddr_osm

Falcosc commented 3 years ago

@neoaliphant have a look at the old run task implementation. I guess my description is a bit short "Execute your tasks and get all event data as '%data' and available fields as '%fields'

I invent the %fields variable to expose which variables are useable. Should I add % in in front of each %fields entry?

Any suggestions for a better description? I will place this description into the button filter settings screen as well.

Thanks falco for the best addon, its so cheap as well :-)

Technically, it is free. It is open source and you can compile it yourself if you don't need the convenience of an auto-updating play store app.

neoaliphant commented 3 years ago

The main problem with the current Run Task is that it lists all the tasks, which is hundreds the regex filter is the bit I would use......

i need to have a place with a bit more to see what happens with %data and % fields

Falcosc commented 3 years ago

I would put the filter in the same 1.6.0 release like important improvements to run task variables. That's why I ask you to test how useable the variables are before starting implementing the release :)

I don't even know how they are ordered, I use the order which is provided by tasker. You may have to do some tricks with your Taskname to find your Test Task in the huge list.

neoaliphant commented 3 years ago

will let you know in a few hours, just done a test task and sent data.... will report back.....

Falcosc commented 3 years ago

I would love to get an improved description based on your feedback. Describing things which I already know, like what the variables are doing and how to use the content of %fields as tasker variables (instead of JSON parsing of %data) is difficult. It is easy to forget obvious but important information.

neoaliphant commented 3 years ago

after quick look, data looks easily parseable from %data even using my old variable split method i need to look at the new json parsing in tasker....

the description of %data and %fields you already have is fine and makes sense... the only reason I havent used already is simply the filtering, which youve now fixed....

will get back to you....

Falcosc commented 3 years ago

Well, I would like to avoid parsing %data, I would like to tell people to use provided variables found in the %fields list

neoaliphant commented 3 years ago

just tried using %data.p_lon which doesnt work

can you send all all the fields in the fields list as variables?

Falcosc commented 3 years ago

is "p_lon" part of the %fields list?

if yes, then you can directly use "%p_lon"

Should I add % in front of all %fields elements to make it more clear that %fields is full of tasker variables?

neoaliphant commented 3 years ago

thanks, its working now

yes, if you add % it would show they are variables...

Falcosc commented 3 years ago

If I add % in front of all entries, would you still be able to loop the %fields variable? Or would it break if the elements already have an % in front?

neoaliphant commented 3 years ago

? whoosh, thats gone right over my head

Falcosc commented 3 years ago

You can create a for each element in array loop to output each %fields entry.

I don't remember why I did not add % to all entries. Maybe I forgot it, or it did introduce problems inside a print all variables of %fields loop

neoaliphant commented 3 years ago

that makes sense now

you could say

"All the entries in the output of the %fields variable are existing variables that get sent to tasker and can get by using %p_lon etc. in your task"

Falcosc commented 3 years ago

Please have a look at the current test version

neoaliphant commented 3 years ago

The task filter works perfectly, I have a menu for the side panel task and a task for acting on points working perfectly. Thants Falco