RedditPP Mascot

RedditPP

r/tasker • … • u/Rich_D_sr

Need Help With Creating A URI for Tasker Action -> Pick Input Dialog -> Directory (system)

Solved....

https://www.reddit.com/r/tasker/s/WfgcYlVBRp

Thanks for all the replies....

I did try..

Tasker Function - File Path To Content Uri.

Tasker Action -> Variable Convert -> URL Encode

Both of those options did not work in these Dialogs.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I am trying to use the Default Input setting in the Tasker Action -> Pick Input Dialog -> Directory (system).

The defualt input setting has a Helper where I can choose a directory. If I use the helper it enters a encoded URI for the folder path

A Pic Folders/All pics/2007/yamaha/yz250/motorcycle

Like so

content://com.android.externalstorage.documents/document/primary%3AA%20Pic%20Folders%2FAll%20pics%2F2007%20yamaha%20yz250%20motorcycle

I need to be able to recreate this URI from a given Folder Path so I can set the Defualt Input with a Variable.

Using this code in javascriptlet I come close but it is not the exact same and does not work.

``` var path = "primary:A Pic Folders/All pics/2007 yamaha yz250 motorcycle"; var uri = "content://com.android.externalstorage.documents/document/" + encodeURI(path); ```

This returns the following result.

``` content://com.android.externalstorage.documents/document/primary:A%20Pic%20Folders/All%20pics/2007%20yamaha%20yz250%20motorcycle

``` For some reason the : is not replaced with %3A and the / are not replaced with %2F

So my question is what is the correct method to convert a folder path to the URI that this action is expecting?

Thanks, Rich..

— 0