I want to link a variable to the File Opened event in tasker.
But I can't...Is there any other way to check which file or folder is opened right now...but this event profile is only allowing me to review only one folder which I have selected.I want to assign a variable here...instead of a single folder name like Download
1 Answer
While this is a known limitation in Tasker there is a workaround which involves creating several events then combining them into a profile through a variable (Profiles Active)
Here is how to go about it:
Lets say you want a "File Opened Event" involving 3 seperate files, in this case I named them A.csv ; B.csv; and C.scv
Screenshot (click image for larger variant)
Event A
Go to Profile >> Event >> File Opened >> Choose A.csv (Give the Profile a name e.g FOa)
Screenshot (click image for larger variant)
Task
As you know you can't create a profile without a linking task so here is a workaround:
When it asks for the task:
Go to New Task + >>Don't write anything in New task name ( so as to keep it anonymous)
A1 Task >> Wait >> 2 seconds (Note: This is a dummy task and it won't affect anything)
Screenshot (click image for larger variant)
Event B
Go to Profile >> Event >> File File Opened >> Choose B.csv (Give the Profile a name e.g FOb)
Task
When it asks for the task:
Go to New Task + >>Don't write anything in New task name ( so as to keep it anonymous)
A1 Task >> Wait >> 2 seconds
Event C
Go to Profile >> Event >> File File Opened >> Choose C.csv (Give the Profile a name e.g FOc)
Task
When it asks for the task:
Go to New Task + >> Don't write anything in New task name ( so as to keep it anonymous)
A1 Task >> Wait >> 2 seconds
Now to create one profile which accesses all those 3 files as if its one Event proceed as follows...
Under Profiles tab: Select State >> Variables >> Variable Value >> %PACTIVE ~ FOa/FOb/*FOb (see screenshot below my aesteriks not showing with text formatting)
(Means profiles active suggesting the MAIN profile is active whenever ANY of the files is opened - much more flexible than what you had only 1 file.)
Screenshot (click image for larger variant)
Now you can then link this Profile to the real Task you wish to perform.
The consequence of this is that you have created a Profile with an Event which relates to 3 files not just one as before.
Hope it helps, even to other scenarios where multiple actions relating to on event cannot be performed.