Help with missed call task.

1,429 views
Skip to first unread message

Mike L

unread,
May 11, 2013, 3:42:27 PM5/11/13
to tas...@googlegroups.com
So I am trying to set up a profile to alert me if I get 2 missed calls from the same person in a certain time period (5 min). I've been messing with this profile for some time now, hope someone can give me a hand. When testing using the little play button in Tasker, it seems to work okay. %LastCall has the correct info in it and everything. But this does not actually work with actual missed calls.
Any help appreciated.

Profile: 2 Missed Calls = Notify (40)
Event: Missed Call [ Caller:* ]
Enter: Anon (41)
A1: If [ %CNUM !~ %LastCall ]
A2: Delete File [ File:DCIM/Tasker/MissedCall Shred Level:0 Use Root:Off 
A3: Write File [ File:/sdcard/DCIM/Tasker/MissedCall Text:%CNUM Append:On Add Newline:Off ] 
A4: Read Line [ File:DCIM/Tasker/MissedCall Line: To Var:%LastCall ] 
A5: End If 
A6: If [ %CNUM ~ %LastCall ]
A7: Media Volume [ Level:15 Display:Off Sound:Off ] 
A8: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A9: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A10: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A11: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A12: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A13: Notify [ Title:Better Be An Emergency! Text:CALL NOW >>> %CNAME-%CNUM Icon:cust_warning Number:0 Permanent:Off Priority:3 ] 
A14: End If 
A15: Wait [ MS:0 Seconds:0 Minutes:5 Hours:0 Days:0 ] 
A16: Variable Clear [ Name:%LastCall Pattern Matching:Off ] 

Bob Hansen

unread,
May 11, 2013, 5:52:34 PM5/11/13
to tas...@googlegroups.com
You don't explain what it is doing wrong, so I have to do a bit of guessing. I suspect that it says every call matches the last call. Here's what I see that is possibly a problem. My fix follows....

Profile: 2 Missed Calls = Notify (40)
Event: Missed Call [ Caller:* ]
Enter: Anon (41)
A1: If [ %CNUM !~ %LastCall ]  here they didn't match
A2: Delete File [ File:DCIM/Tasker/MissedCall Shred Level:0 Use Root:Off 
A3: Write File [ File:/sdcard/DCIM/Tasker/MissedCall Text:%CNUM Append:On Add Newline:Off ] 
                you just wrote %CNUM  to the missedcall file
        A4: Read Line [ File:DCIM/Tasker/MissedCall Line: To Var:%LastCall ] 
                you just read  %CNUM  from the missedcall file
A5: End If 
now %CNUM and %LastCall are the same 
A6: If [ %CNUM ~ %LastCall ]         So this is now going to run
A7: Media Volume [ Level:15 Display:Off Sound:Off ] 
A8: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A9: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A10: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A11: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A12: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A13: Notify [ Title:Better Be An Emergency! Text:CALL NOW >>> %CNAME-%CNUM Icon:cust_warning Number:0 Permanent:Off Priority:3 ] 
A14: End If 
A15: Wait [ MS:0 Seconds:0 Minutes:5 Hours:0 Days:0 ] 
A16: Variable Clear [ Name:%LastCall Pattern Matching:Off ] 

To Fix it move your %CNUM matches %LastCall check ahead of the not matching check. Like this:

Event: Missed Call [ Caller:* ]
Enter: Anon (41)
A6: If [ %CNUM ~ %LastCall ]
A7: Media Volume [ Level:15 Display:Off Sound:Off ] 
A8: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A9: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A10: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A11: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A12: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A13: Notify [ Title:Better Be An Emergency! Text:CALL NOW >>> %CNAME-%CNUM Icon:cust_warning Number:0 Permanent:Off Priority:3 ] 
A14: End If 
A1: If [ %CNUM !~ %LastCall ]

Mike L

unread,
May 11, 2013, 6:33:36 PM5/11/13
to tas...@googlegroups.com
I have no idea what it's doing wrong. %LastCaller shows the correct information when testing it, but the profile does not work when tested with actual missed calls.

The reason for writing, and then reading %CNUM to a different variable is because I don't want this profile to go off if 2 people call me in 5 minutes, only if the same person calls me twice. As %CNUM changes with each new caller, I needed a static variable (%LastCaller) to hold onto the first callers name. Hence writing/reading from a text file.

The profile is just 2 "If" statements, so I don't see how ordering them the other way around would do anything. %LastCaller variable doesn't exist yet to match %CNUM to in the first "If" statement, so it will always go off first. Which was my plan...

I may have to start from scratch with this one and go about it a different way

Bob Hansen

unread,
May 11, 2013, 7:02:55 PM5/11/13
to tas...@googlegroups.com
Yes, there are two If statements, but they check opposite cases. Because of the actions ran in the first If statement, by the time tasker goes to check the second If condition, the condition will test true also because the variabl%LastCall was changed to %CNUM  by the first condition and it now will make the second condition be true.
The way your logic is now if the first IF statement is true, the second IF statement will also be true because the value of %LastCall was changed.

Mike L

unread,
May 11, 2013, 7:18:13 PM5/11/13
to tas...@googlegroups.com
Ahh, now I see what you mean. That does make perfect sense, BUT... there's always a but, that is not the way this task is failing. So I must have another issue as well somewhere. The second "if" statement never turns green/is never seen as true. I think maybe I need to swap the "if's" as you suggested, and throw a "wait" task between the write and read tasks.
Thank you for explaining that, I've been thinking too hard about this one and over looked something obvious. So much trouble for what seems like a simple thing to do haha.

UncleMike

unread,
May 11, 2013, 8:58:09 PM5/11/13
to tas...@googlegroups.com
I'm still not getting the reason for writing to and then reading from a file (or why the file is being written to a subfolder of where pictures are normally stored).  Bob is right though, in that the consecutive if statements are problematic, but you could fix this by replacing A5 & A6 with an Else statement.  But another problem I see is that the profile won't be triggered at all if Bob calls, then I call, then Bob calls, all in a 5 minute span, since when Bob calls the second time, the previous caller would be me.

I would use two arrays - one for recent caller numbers, and one for recent (incoming) call times.  With each incoming call, check the recent call times and remove any array elements older than 5 minutes.  Then check to see if the current caller number exists in the array.  If so, start your alerting sequence.  But if you're almost there, or have already gotten it to work, I would stick with what youhave.

Bob Hansen

unread,
May 11, 2013, 9:11:34 PM5/11/13
to tas...@googlegroups.com
DOH! Use an ELSE statement..... that's just too obvious 8>)...... Thanks Mike!

Mike L

unread,
May 11, 2013, 9:41:43 PM5/11/13
to tas...@googlegroups.com
I must have never noticed Else statements, that's an easy fix to that problem. I've also never messed around with arrays as I never had a need for one, so I'll do some reading and try that route. This is not working at all anyways, and with an array if I understand them correctly, this should work with 2 different people calling me twice within 5 minutes which is a feature I thought I'd have to live without doing it my original way.

I'll post up what I come up with working or not in here. Thanks to both of you!

Bob Hansen

unread,
May 11, 2013, 10:02:52 PM5/11/13
to tas...@googlegroups.com
Before worrying about arrays, let's getting working without concern for multiple calls within 5 minutes. Then add the array fix.

Mike L

unread,
May 11, 2013, 10:33:26 PM5/11/13
to tas...@googlegroups.com
Do you think the 5 minute wait at the end is messing things up? If a profile is activated white it is still active will it still go through it's tasks, or will it ignore input until it finishes?

Bob Hansen

unread,
May 11, 2013, 10:38:49 PM5/11/13
to tas...@googlegroups.com
I think it will be a problem as it keeps this profile from ending quickly so if additional calls come in there will be conflicts. I would move it to a separate profile.

I have entered your profile into my phone and am looking at it now. I'll let you know what I find.

I just started testing it.

Mike L

unread,
May 11, 2013, 10:43:16 PM5/11/13
to tas...@googlegroups.com


On Saturday, May 11, 2013 8:58:09 PM UTC-4, UncleMike wrote:
I'm still not getting the reason for writing to and then reading from a file (or why the file is being written to a subfolder of where pictures are normally stored).  Bob is right though, in that the consecutive if statements are problematic, but you could fix this by replacing A5 & A6 with an Else statement.  But another problem I see is that the profile won't be triggered at all if Bob calls, then I call, then Bob calls, all in a 5 minute span, since when Bob calls the second time, the previous caller would be me.

I would use two arrays - one for recent caller numbers, and one for recent (incoming) call times.  With each incoming call, check the recent call times and remove any array elements older than 5 minutes.  Then check to see if the current caller number exists in the array.  If so, start your alerting sequence.  But if you're almost there, or have already gotten it to work, I would stick with what youhave.

Now that I think about it you are right that 2 people calling one after another like that would break this. Which is exactly why I was making this, as a profile I saw on the wiki (I think) didn't seem to address that. Hmm, that wonderful moment when you realize you wasted a bunch of time, I was due for one I suppose. Confusing myself with arrays it is. 

Bob Hansen

unread,
May 11, 2013, 10:49:09 PM5/11/13
to tas...@googlegroups.com
It's not a waste as long as you learn from it.

I'm sure we can get this working.

Mike L

unread,
May 11, 2013, 10:49:11 PM5/11/13
to tas...@googlegroups.com
Thank you for helping me. I believe the arrays would be the most reliable solution for this. But, having someone call at the perfect moment between 2 emergency calls would be quite the coincidence, especially as this is really only designed for sleeping hours. So ironing this one out would be nice as well. I'll stick to this one and read up on arrays as well. Thanks again man

Bob Hansen

unread,
May 11, 2013, 10:54:47 PM5/11/13
to tas...@googlegroups.com
I'm curious. What result do you get now when you receive multiple calls from the same number?

Mike L

unread,
May 11, 2013, 10:55:33 PM5/11/13
to tas...@googlegroups.com
Haha I didn't think the first post went though, still getting used to the google forums

Bob Hansen

unread,
May 11, 2013, 10:58:29 PM5/11/13
to tas...@googlegroups.com
No. It posted. I just forgot ;>)

Rich D

unread,
May 11, 2013, 11:17:37 PM5/11/13
to tas...@googlegroups.com

Although uncle mikes suggestion is probably the preferred  and most elegant  here is another to ponder....

You could make a file with the file name being the missed call number and put the value of %TIMES in the file. 

So at the beginning of the task you would do a files list action of the containing folder and check to see if the current call number is in that list.  If it is not in the list then end task.  Else  test the contents of that file against the current %TIMES. If it is within the 5 min then do stuff if it is not then set the current %TIMES to that file.

Rich...

Bob Hansen

unread,
May 11, 2013, 11:43:11 PM5/11/13
to tas...@googlegroups.com
The current problem is much more basic than that. 

We can't use Missed Call State as a context for this profile. The Missed Call State becomes active on the fiirst missed call and stays active until cleared by clearing the notification.

So I am trying Call (incoming) state.
The problem is that %CNUM (incoming call number) does not match %LastCall. But it looks like both are the same. 
So I'm now trying to figure that out.

Mike L

unread,
May 12, 2013, 12:01:53 AM5/12/13
to tas...@googlegroups.com
Right now nothing happens when 2 calls are received from the same number. I'm sort of distracted right now so not playing with it as much. Good find on Missed Call not clearing itself when a new one comes in, I think we are almost there. Do you have the Read Line action set to read line 1 to %LastCall? I kept getting EOF to flash every other time before I figured to put just the first line in the variable.

And Rich, that sounds like it will be much easier to implement for me, someone coming from not understanding how to set up arrays. Once we can this to fire off correctly that sounds like it would solve having a second caller in the mix. Clever using the title of the text file and the body as different variables. Could just make a folder to write all these files in, and delete the whole thing after 5 minutes.

Bob Hansen

unread,
May 12, 2013, 12:11:52 AM5/12/13
to tas...@googlegroups.com
More progress.
Apparently, when the value %CNUM is written to a file and then read back to %LastCall, a hidden character is added causing the matching to fail. Changing the If statements to = and != works!

TO FIX THIS PART change the If not match (!~) to not equal {!=}
                                 change the If match (~) to equals (=)

Bob Hansen

unread,
May 12, 2013, 12:44:13 AM5/12/13
to tas...@googlegroups.com
Here are the problems, solutions and working profile.

We can't use Missed Call State as a context for this profile. The Missed Call State becomes active on the fiirst missed call and stays active until cleared by clearing the notification.
So we need to use Call (incoming) state.

The problem is that %CNUM (incoming call number) does not match %LastCall. But it looks like both are the same. Apparently, when the value %CNUM is written to a file and then read back to %LastCall, a hidden character is added causing the matching to fail. Changing the If statements to = and != works!
TO FIX THIS PART change the If not match (!~) to not equal {!=}
                                 change the If match (~) to equals (=)

The next problem is that we are using Play Ringtone type Alarm. Type alarm ringtone requires the alarm to be reset so it plays continuously with no way to stop it. 
Need to change the type to Notification

So here is what the profile description is now. (Note: I used my ringtone files - you need to change these.)

Profile: 2 Missed Calls (92)
State: Call [ Type:Incoming Number:* ]
Enter: Anon (93)
A1: If [ %CNUM != %LastCall ]
A2: Delete File [ File:Tasker/MissedCall Shred Level:0 Use Root:Off ]
A3: Write File [ File:Tasker/MissedCall Text:%CNUM Append:Off Add Newline:On ]
A4: Read File [ File:Tasker/MissedCall To Var:%LastCall ]
A5: Else If [ %CNUM = %LastCall ]
A6: Media Volume [ Level:15 Display:Off Sound:Off ]
A7: Play Ringtone [ Type:Notification Sound:a23 Stream:5 ]
A8: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
A9: Play Ringtone [ Type:Notification Sound:a23 Stream:5 ]
A10: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
A11: Play Ringtone [ Type:Notification Sound:a23 Stream:5 ]
A12: Notify [ Title:Better Be An Emergency Text:CALL %CNAME-%CNUM 
Icon:null Number:0 Permanent:Off Priority:3 ]
A13: End If

To reset the %LastCall variable after 5 minutes, create a profile LastCallReset. Use context State > Missed Call; A1: Wait 5 min; A2: Variable Set %LastCall to 0;

Rich D

unread,
May 12, 2013, 9:21:50 AM5/12/13
to tas...@googlegroups.com

>
> And Rich, that sounds like it will be much easier to implement for me

I have used this technique in another profile that tracks my location and it works great. Once you use the 'file list' action you will see how easy and fast it is to search file names.  My first thought was to not even worry about deleting the files as I do not think you would get enough different numbers that call to worry about memory space. If you do delete the directory I would think you might just delete it daily though. My original post had some flaws in the flow so here is a edited version of my thoughts.

So at the beginning of the task you would do a files list action of the containing folder. The 'file list' action has a search feature so you can match the number easily and check to see if the current call number is in that directory.

If it is not in the list then save a file with the current number as the filename and store %TIMES as the data and end task.

Else test the contents of that file against the current %TIMES. If it is within the 5 min then do stuff if it is not then set the current %TIMES to that file.

Something along those lines anyway....

Please note you will need to use %TIMES not %TIME for your time checks and do your maths in seconds.  

@ Bob...  nice work on the call numbers. That is good to know....:)

Rich D

unread,
May 12, 2013, 11:05:17 AM5/12/13
to tas...@googlegroups.com

One more tip if you go with the above technique. 

Watch for file name errors. They can be a little troublesome, you can turn on pop up errors in tasker preferences but be aware that if you are testing within tasker IE the run button.. you will not see the errors until you exit and reopen tasker. You might have to trim off white spaces at the end of the filename, illegal characters,  etc.......

I would assume with a simple string of numbers you will not have any issues...

Rich..

Mike L

unread,
May 12, 2013, 11:37:54 AM5/12/13
to tas...@googlegroups.com
Awesome work Bob, very much appreciated. I hope this profile proves useful to you as it does for me. I'm playing with Rich's idea of searching a directory for time stamps to compare to at the moment, but it's nice to have a working profile while we tinker. 

Rich, do you think you could upload a description or an xml of that tracking profile? I think it would help me understand how to use "file list" better to see it in action. And that sounds like a pretty useful profile anyways, would be nice to see where I've been all week for work.

Rich D

unread,
May 12, 2013, 8:42:29 PM5/12/13
to tas...@googlegroups.com

> Rich, do you think you could upload a description or an xml of that tracking profile? I think it would help me understand how to use "file list" better to see it in action. And that sounds like a pretty useful profile anyways, would be nice to see where I've been all week for work.

Sure.. There is a lot in there and you will probably have to change some of the %WIN values in the 'Map Overlay' profile context if you want to get it working on your device.

There are 2 projects.  One is the tracking profile with the display scenes And the other is a date picker that works in conjunction with the tracking profile.  It is still a work in progress but it is working.

There may be other differences in the devices that could cause trouble such as proper file paths.

They should be imported as projects ..

Here ya go....

Rich...

Track_Loc.prj.xml
Date_Input.prj.xml

Rich D

unread,
May 12, 2013, 9:16:17 PM5/12/13
to tas...@googlegroups.com

There is a task called ' Start Loc Scene ' in the location project. This starts the viewer. Just use a task cut from your home screen to start it.

I create and write to the files in the "Get Location" task and access them in the 'Next Day' task. 

Oooops, I just realized that I do not use the 'List Files' action in this project.
I just use the date as the file name..

It is My picture folder app that uses the 'list files' action.   I will post that task for a example.   Sorry for the confusion.....  :(

Rich D

unread,
May 12, 2013, 10:06:56 PM5/12/13
to tas...@googlegroups.com

OK..... I am not sure if you will be able to decipher this but here it is. This is a task that searches a list of picture folders.  It works with a 'Text input Box ' element.  And refines the search with each additional character entered into the text box.  So if a 'A" is entered then it will find all folders that start with 'A' then if a 'N' is added then it will find all folders that begin with 'AN' but if a 'T' is added now it will find all folders that have 'ANT' anywhere in the file name. So after 3 characters It searches for the search sting anywhere in the folder name.  It will also put the list in alphabetical order.


File Sort Scence2 (296)
Abort Existing Task
<lastloop>
A1: Anchor
A2: Array Clear [ Name:%fileslista ]
A3: Variable Clear [ Name:%fileslista Pattern Matching:Off ]
A4: Variable Clear [ Name:%skipretest Pattern Matching:Off ]
A5: Variable Clear [ Name:%search Pattern Matching:Off ]
A6: Perform Task [ Name:Pic File Tap2 Stop:Off Priority:9 Parameter 1 (%par1):%new_val Parameter 2 (%par2): Return Value Variable:%search ]
A7: Variable Convert [ Name:%search Function:To Lower Case Store Result In: ]
<taploop>
A8: Array Clear [ Name:%arr ]
A9: Variable Clear [ Name:%arr Pattern Matching:Off ]
A10: Variable Clear [ Name:%Fileslist Pattern Matching:Off ]
A11: Variable Set [ Name:%search To:%par1 Do Maths:Off Append:Off ] If [ %par2 ~ on ]
A12: Variable Set [ Name:%skipretest To:1 Do Maths:Off Append:Off ] If [ %search ~ . ]
A13: Variable Set [ Name:%search To:+ Do Maths:Off Append:Off ] If [ %search ~ . ]
A14: Goto [ Type:Action Label Number:1 Label:skip stop ] If [ %par2 ~ on ]
A15: Stop [ With Error:Off Task: ] If [ %new_val ~ *new_val* ]
<skip stop>
A16: Test [ Type:Variable Length Data:%search Store Result In:%varlength ]
<start loop>
A17: Variable Clear [ Name:%xxx Pattern Matching:Off ]
A18: List Files [ Dir:%Filepath Match:%search* Include Hidden Files:Off Variable:%fileslista Continue Task After Error:On ] If [ %varlength < 3 ]
A19: List Files [ Dir:%Allpicspath Match:*%search* Include Hidden Files:Off Variable:%fileslista ] If [ %varlength > 2 ]
A20: Variable Set [ Name:%fileslista To:%fileslista(:) Do Maths:Off Append:Off ]
A21: Variable Set [ Name:%Afilelist To:%fileslista Do Maths:Off Append:Off ]
<trim list>
A22: Variable Search Replace [ Variable:%fileslista Search:%Allpicspath/ Ignore Case:On Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A23: Variable Set [ Name:%Afile To:%fileslista Do Maths:Off Append:Off ]
A24: Stop [ With Error:Off Task: ] If [ %fileslista ~ *fileslista* ]
<alphabetize>
A25: JavaScriptlet [ Code:var arr = [];
arr = fileslista.split( "," );
arr.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); Libraries: Auto Exit:On Timeout (Seconds):45 ] If [ %skipretest = 1 ]
A26: Variable Set [ Name:%Fileslist To:%fileslista Do Maths:Off Append:Off ] If [ %skipretest ! Set ]
A27: Variable Set [ Name:%Fileslist To:%arr(:) Do Maths:Off Append:Off ] If [ %skipretest = 1 ]
A28: Array Clear [ Name:%arr ]
A29: Variable Clear [ Name:%arr Pattern Matching:Off ]
A30: Variable Clear [ Name:%fileslista Pattern Matching:Off ]
A31: Array Clear [ Name:%fileslista ]
A32: Stop [ With Error:Off Task:File Sort Scence2 ] If [ %skipretest = 1 ]
<end>
A33: Stop [ With Error:Off Task: ]

Bob Hansen

unread,
May 13, 2013, 12:18:12 AM5/13/13
to tas...@googlegroups.com
WOW! 
Rich, that is impressive.

I've only started going through this. I notice you call another task 'Pic File Tap2'. Could you share that too? 
This is so useful and it shows what can be accomplished when Tasker and javascript are combined.

I'm curious, I see you use the Task > Anchor. This is a relatively new addition to Tasker and I didn't see any description of it. I suspect it was added to aid in using Goto actions so that you don't have to worry as much about adding or removing actions. Is that right?

Any chance you would share the XML files? It would sure save a lot of typing er... tapping ;>)

Thanks for sharing this! 
Your posts are really helping me learn the finer points of how to use Tasker.

Thanks again.

Rich D

unread,
May 13, 2013, 4:54:02 AM5/13/13
to tas...@googlegroups.com

> I'm curious, I see you use the Task > Anchor. This is a relatively new addition to Tasker and I didn't see any description of it. I suspect it was added to aid in using Goto actions so that you don't have to worry as much about adding or removing actions. Is that right?

Actually I think the main request for anchor was for just a non functional label for organization but pent could not bring himself to make a non functional action so he made it a anchor for the goto statement. 

>
> Any chance you would share the XML files? It would sure save a lot of typing er... tapping ;>)
>

Sure but this is a big fairly big one as well. I tried to make a app out out of it to share but found way to many problems trying to make it run on multiple devices. Actually the reason it got so bloated was trying to make a user friendly app for multiple devices. The original one that ran on just my device was far less bloated.

> Thanks for sharing this! 
> Your posts are really helping me learn the finer points of how to use Tasker.

Your welcome.  They are not the best examples by any means as I started with zero programming or development Skills.  

Rich..

My_Camera_File.prj.xml

Rich D

unread,
May 13, 2013, 5:02:29 AM5/13/13
to tas...@googlegroups.com

The task that starts the camera app is " Camera Notify Click On2"

Rich...

Rich D

unread,
May 13, 2013, 5:37:47 AM5/13/13
to tas...@googlegroups.com

One more note.... I do not have much experience with sharing XML's so I'm not sure if variable values carry over with the XML.   But to get the setup portion of the application to run and setup on your device the variable %Initialized needs to be cleared. 

Mike L

unread,
May 13, 2013, 2:14:13 PM5/13/13
to tas...@googlegroups.com
Wow, I've got a lot to look over now, thanks man.
And here I was thinking I was getting a little advanced with a couple "if" statements and variable splits haha.
Lots of ideas floating around in my head now, Tasker is capable of more than I thought it was.

Tasker To Do List:
Finish "Do Not Disturb" project (Reason for this thread)
Figure out how to password protect Gmail
Log locations through out my work day, and be able to search through my list of clients. <<< This one I am now motivated to get on with as you have just uploaded pretty much everything I need to figure this one out

Mike L

unread,
May 13, 2013, 2:18:19 PM5/13/13
to tas...@googlegroups.com
Just figured out the Gmail one haha, quick google pointed me to the "Lock" action. I had scenes created for this and everything haha, just couldn't figure out how to prevent getting around the password input screen. Tasker is 2 steps ahead of me as always

Bob Hansen

unread,
May 13, 2013, 4:39:50 PM5/13/13
to tas...@googlegroups.com
Thanks Rich!

I never thought you could do so much in a Tasker app.
Definitely an eye opener for me.

Rich D

unread,
May 13, 2013, 6:04:30 PM5/13/13
to tas...@googlegroups.com


> Thanks Rich!

Glad to help..

>
> I never thought you could do so much in a Tasker app.
> Definitely an eye opener for me.
>

Let me now if you get them working and if you have any questions. 

The camera folders app should work and has a help file that will hopefully explain most of it. 

The location app is more personalized and as stated before will most likely need some tweeking to run on a different device. If you get the scene up and going the top middle text box with the date in it is a button that should bring up the date picker.  The date picker still has a few qwerks but  works for the most part.

Rich...

Mike L

unread,
May 14, 2013, 6:27:07 PM5/14/13
to tas...@googlegroups.com
So using things I learned in here and some Googling, I took another shot at the original task at hand. Seems to be working so far

Profile: 2 Missed Calls = Notify (230)
Event: Missed Call [ Caller:* ]
Enter: Anon (231)
A1: Load App [ App:Phone Data: Exclude From Recent Apps:Off ] 
A2: Wait [ MS:1 Seconds:0 Minutes:0 Hours:0 Days:0 ] 
A3: Kill App [ App:Phone Use Root:On ] 
A4: Notify [ Title:DND - Missed Call Text:Missed Call >>> %CNAME - %CNUM Icon:hd_aaa_ext_phone_missed Number:0 Permanent:Off Priority:1 ] 
A5: Test [ Type:File Name Data:/storage/sdcard0/Tasker/2callsNotify/%CNUM Store Result In:%Exists Continue Task After Error:On ] 
A6: If [ %Exists ! Set ]
A7: Write File [ File:Tasker/2callsNotify/%CNUM Text:%TIMES Append:Off Add Newline:Off ] 
A8: Variable Clear [ Name:%CalledWhen Pattern Matching:Off ] 
A9: Variable Clear [ Name:%TimeCompare Pattern Matching:Off ] 
A10: Else If [ %Exists Is Set ]
A11: Read Line [ File:Tasker/2callsNotify/%CNUM Line:1 To Var:%CalledWhen ] 
A12: Variable Set [ Name:%TimeCompare To:%TIMES - 300 Do Maths:On Append:Off ] 
A13: If [ %CalledWhen > %TimeCompare ]
A14: Notify Cancel [ Title:DND - Missed Call Warn Not Exist:Off ] 
A15: Media Volume [ Level:15 Display:Off Sound:Off ] 
A16: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A17: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A18: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A19: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
A20: Play Ringtone [ Type:Alarm Sound:CyanAlarm Stream:4 ] 
A21: Notify [ Title:Better Be An Emergency! Text:CALL NOW >>> %CNAME-%CNUM Icon:cust_warning Number:0 Permanent:Off Priority:3 ] 
A22: Else If [ %CalledWhen < %TimeCompare ]
A23: Delete File [ File:Tasker/2callsNotify/%CNUM Shred Level:0 Use Root:Off ] 
A24: Variable Clear [ Name:%CalledWhen Pattern Matching:Off ] 
A25: Variable Clear [ Name:%TimeCompare Pattern Matching:Off ] 
A26: End If 
A27: Variable Clear [ Name:%Exists Pattern Matching:Off ] 
A28: End If 


I'm sure there are still a few bugs to iron out but I'm happy with it. Thanks to Bob, Rich, and Uncle Mike
2_Missed_Calls___Notify.prf.xml

Rich D

unread,
May 14, 2013, 10:11:21 PM5/14/13
to tas...@googlegroups.com

Glad you got it working...

>
> Profile: 2 Missed Calls = Notify (230)
> Event: Missed Call [ Caller:* ]
> Enter: Anon (231)
> A1: Load App [ App:Phone Data: Exclude From Recent Apps:Off ] 
> A2: Wait [ MS:1 Seconds:0 Minutes:0 Hours:0 Days:0 ] 
> A3: Kill App [ App:Phone Use Root:On ] 

I am assuming you are able to clear the missed call notification with this correct?

> A4: Notify [ Title:DND - Missed Call Text:Missed Call >>> %CNAME - %CNUM Icon:hd_aaa_ext_phone_missed Number:0 Permanent:Off Priority:1 ] 

Then set your own notification

All looks good to me. The only problem that might never come up would be if....
1. Bob calls for first time
2. 10 minutes passes
3. Bob calls again. // bob's file is now deleted
4. 2 minutes passes
5. Bob calls again.  // you will not get your 'better be emergency ' notify

A few options would be..

1. Do not delete file just replace the data with the current %TIMES.  As stated before I do not think the accumulation of files would be a issue..

2. Delete entire containing folder when the profile is not in use. 

3. Enjoy your hard work and do not worry about bob calling 3 times.  Why the heck is he calling so much any way...

Nice work...  :)

Rich D

unread,
May 14, 2013, 10:28:37 PM5/14/13
to tas...@googlegroups.com

After thinking about it you might want to address this problem because you will have this issue..

> 1. Bob calls for first time

> 2. 10 minutes passes **or any amount of time more than 5 minutes **


> 3. Bob calls again. // bob's file is now deleted
> 4. 2 minutes passes
> 5. Bob calls again.  // you will not get your 'better be emergency ' notify

This seems more likely to happen then I first thought..

Bob Hansen

unread,
May 14, 2013, 10:40:56 PM5/14/13
to tas...@googlegroups.com
Mike,

This was an interesting problem to work on. I actually enjoyed it and joining in the effort with you, UncleMike and Mike L.

As for Mike's remaining problem below, I can easily fix that. I'm telling you right now I'm not going to call! :>)

Bob Hansen

unread,
May 14, 2013, 10:46:44 PM5/14/13
to tas...@googlegroups.com
Sorry guys, 

I meant working with you, UncleMike and Rich.

(Why is it I never find the mistakes until AFTER I post?)



Mike L

unread,
May 14, 2013, 11:18:50 PM5/14/13
to tas...@googlegroups.com
Rich,
Yes it clears the notification which is much better. Before with using "Phone Ringing" as a context for the second profile, if I actually got to the phone during the second call all of these bells and whistles would be going off haha.

Good catch on the third call I didn't think of that. That's probably how most of these calls will be occurring too. Call once, wait for a call back, try again a couple times, get kidnapped because I couldn't save the day...  

All an easy fix, thanks again man.

Bob,
An edit button would be quite handy on these forums. It's habit to proofread every post now haha. Definitely learned some good stuff putting this together with everyone. On to my next project! Hopefully my next thread can be me bragging about my awesome profile that everyone wants hahaha

Joshua Abramson

unread,
May 18, 2013, 9:13:33 AM5/18/13
to tas...@googlegroups.com
Mike L. 

Is there a no root way to accomplish similar results for a missed call alert?

Mike L

unread,
May 18, 2013, 9:58:58 AM5/18/13
to tas...@googlegroups.com
The only action that uses root on this is "Kill App". Some phones can kill the apps without using root but mine can't. It's not even really necessary though, just loading the dialer app should be enough to clear the missed call notification

Rich D

unread,
May 18, 2013, 10:03:44 AM5/18/13
to tas...@googlegroups.com


> The only action that uses root on this is "Kill App". Some phones can kill the apps without using root but mine can't. It's not even really necessary though, just loading the dialer app should be enough to clear the missed call notification

+1
I would load the dialer then use a go home action to stop the dialer..

Mike L

unread,
May 18, 2013, 10:24:15 AM5/18/13
to tas...@googlegroups.com
Rich D
Thanks again for posting your File Sort Science2 task in here. I am still going through learning the logic of it ("Search Tasker" has been my friend following your variables around to find out how they get set) but am starting to get the hang of it. I had a specific question about a parameter or something but it escapes me right now. Anyhow my wallet will thank you as well once I get it up and running

Rich D

unread,
May 18, 2013, 10:33:44 AM5/18/13
to tas...@googlegroups.com

> Rich D
> Thanks again for posting your File Sort Science2 task in here.

No problem...  as is evident by the task name itself I have been planning on going back through it an cleaning it up and making a bit more elegant but as usually it is working so I have not bothered. I am sure there are things that can be done more efficiently ... Feel free to ask, hopefully I can remember what I did and answer.... 

I was working on a entirely new menu set up up but have not been able to get back and finish it...

Rich..

Joshua A

unread,
May 18, 2013, 1:10:31 PM5/18/13
to tas...@googlegroups.com

Where would I put an SMS "in meeting, call again for emergency" reply so that it is only sent to %CNUM once?

Thanks Mike. It's working great. 

Mike L

unread,
May 18, 2013, 2:17:11 PM5/18/13
to tas...@googlegroups.com
Rich
There's a few things I need to get sorted to actually populate the array (list of file names) that I'm going to search though. It's all user error as I'm new to this so it will take some figuring out. As for your "Sort Science" I'm getting confused seeing how %par2 gets set to "on" to match some of your if statements. And also for when %search is set "."  Is the period some sort of wildcard or pattern matching thing? I'm starting to get my head around the logic of it, but again I am new to this. 

Also for your menu elements, do you have a hard time getting the spacing correct on the items it lists? I can't for the life of me get the items close together. Making the text very small, setting vertical spacing to 0, and changing the little menu scene edit thing to as slim as it can be without cutting off letters, after all of that if I made the menu the full height of the screen I would get maybe 6 items before having to scroll. And with this scene I need to use only half of the screen so looking at 2/3 at a time is not ideal.



Josh
Glad it works for you. I ended up doing the same thing (sending an SMS after the first call)
In the first "if" statement add a "Send SMS" action to the number %CNUM saying whatever you like. I had it send something that said to call again within 5 minutes to alert the user. This will go off again on a second cycle through the task though, ie: (We'll use Bob again haha) Bob calls, gets a text message, decides to call again or not (doesn't matter), five minutes goes by, Bob calls again, gets a text....
You could implement a way to see if you had already sent Bob a "call again for emergency" text. But if Bob wants to bug me all night, he can read my stupid messages over and over haha

Rich D

unread,
May 18, 2013, 4:13:08 PM5/18/13
to tas...@googlegroups.com

As for your "Sort Science" I'm getting confused seeing how %par2 gets set to "on" to match some of your if statements.

I will have to check the code but where you might be getting stuck is %par1 and %par2 are tasker variables that are used to pass data when using the 'perform task' action. So these would only be set when I was running the task from another task.

And also for when %search is set "."  Is the period some sort of wildcard or pattern matching thing?

Again I will check and get back to you but I am pretty sure I needed to set the "." To a variable to use it in a search for a reason I can not recall right now..

It may be easier for me to help if you pasted the task here and inserted edits where you have questions..

Also for your menu elements, do you have a hard time getting the spacing correct on the items it lists? I can't for the life of me get the items close together.

Ahhh, welcome to the wonderful word of scenes,  where your patience will be tested and re-tested and then tested again  ...

Do you mean the space in between the items or the height of the item box?

Making the text very small, setting vertical spacing to 0, and changing the little menu scene edit thing to as slim as it can be without cutting off letters, after all of that if I made the menu the full height of the screen I would get maybe 6 items before having to scroll. And with this scene I need to use only half of the screen so looking at 2/3 at a time is not ideal.
>

Maybe a screen shot with a description of what you are trying to change would help.

Rich...

Rich D

unread,
May 18, 2013, 5:07:01 PM5/18/13
to tas...@googlegroups.com

OK, I checked the code.. when I get a chance I will post a description of how the task works but for now..

> As for your "Sort Science" I'm getting confused seeing how %par2 gets set to "on" to match some of your if statements.

%par2 is getting set by the "search" button in the scene.  This button was to manually force a search but i found I did not need it after I made a work around for the text edit box which I. Will explain in the next post..

>
> And also for when %search is set "."  Is the period some sort of wildcard or pattern matching thing?
>

Disregard what I said in the last post.. the "." Is a wild card. You enter this on the text edit box to get a full list of the all files.....

Mike L

unread,
May 18, 2013, 5:41:37 PM5/18/13
to tas...@googlegroups.com
<lastloop>
A1: Anchor 
A2: Array Clear [ Name:%fileslista ] 
A3: Variable Clear [ Name:%fileslista Pattern Matching:Off ] 
A4: Variable Clear [ Name:%skipretest Pattern Matching:Off ] 
A5: Variable Clear [ Name:%search Pattern Matching:Off ] 
A6: Perform Task [ Name:Pic File Tap2 Stop:Off Priority:9 Parameter 1 (%par1):%new_val Parameter 2 (%par2): Return Value Variable:%search ] 

This task you call seems to just set %new_val to %search, correct? Is that just to get %new_val saved somewhere in case of a fast typer?

A7: Variable Convert [ Name:%search Function:To Lower Case Store Result In: ] 
<taploop>
A8: Array Clear [ Name:%arr ] 
A9: Variable Clear [ Name:%arr Pattern Matching:Off ] 
A10: Variable Clear [ Name:%Fileslist Pattern Matching:Off ] 
A11: Variable Set [ Name:%search To:%par1 Do Maths:Off Append:Off ] If [ %par2 ~ on ]

This if statement here and the one at the "goto" action had me confused as to how it would ever pass.

A12: Variable Set [ Name:%skipretest To:1 Do Maths:Off Append:Off ] If [ %search ~ . ]
A13: Variable Set [ Name:%search To:+ Do Maths:Off Append:Off ] If [ %search ~ . ]

The 2 above I assume must be some syntax that ins't in the user guide or a special feature you implemented?

A14: Goto [ Type:Action Label Number:1 Label:skip stop ] If [ %par2 ~ on ]
A15: Stop [ With Error:Off Task: ] If [ %new_val ~ *new_val* ]

So to my understanding (which must be wrong) nothing would ever get past here
I didn't read too much into the rest of the actions as I figured they woudn't really make sense to me if I didn't understand the beginning yet. 


As for the scene thing, I had to edit the test items I was displaying as they were all swears haha. After putting just a bunch of random text to display it seemed to be spacing them acceptable, somewhat. Still would like them to be tighter but even with smaller text that was as close as I could get them.


Mike L

unread,
May 18, 2013, 5:45:22 PM5/18/13
to tas...@googlegroups.com
Didn't see you're second post, answered 2 of my questions before I asked haha.

Eagerly awaiting next post

Rich D

unread,
May 18, 2013, 10:37:47 PM5/18/13
to tas...@googlegroups.com

Have you been able to get the entire project working and been able to view the help file?

OK. Here we go...  all info refers to the above actions..

File Sort Scence2 (296)
Abort Existing Task

The about existing is important,  every time there is a entry in the text edit box you want the task to start over.

<lastloop>
A1: Anchor
A2: Array Clear [ Name:%fileslista ]
A3: Variable Clear [ Name:%fileslista Pattern Matching:Off ]
A4: Variable Clear [ Name:%skipretest Pattern Matching:Off ]
A5: Variable Clear [ Name:%search Pattern Matching:Off ]
A6: Perform Task [ Name:Pic File Tap2 Stop:Off Priority:9 Parameter 1 (%par1):%new_val Parameter 2 (%par2): Return Value Variable:%search ]

This is a 'text edit box' element' work around I came up with.. I found that it would not catch all the input just using %new_val if you typed fast. So this solved the problem. I am not sure why I set %par1 to %new_val  It does not seem to do any thing but the task 'Pic file tap'  simply reads the value of the text edit box and returns it so now %search is set to the value of the text edit box.

A7: Variable Convert [ Name:%search Function:To Lower Case Store Result In: ]

This makes everything lower case so matching is easier..

<taploop>
A8: Array Clear [ Name:%arr ]
A9: Variable Clear [ Name:%arr Pattern Matching:Off ]
A10: Variable Clear [ Name:%Fileslist Pattern Matching:Off ]
A11: Variable Set [ Name:%search To:%par1 Do Maths:Off Append:Off ] If [ %par2 ~ on ]

%par2 is the variable from a perform task action from the 'Search' button task in the 'file browser2' scene. I put this button in so you could force a search because before I had the text edit box work around this would let you get the value of the text edit box and search for that.  This will only be true if this task is called from the search button task.

A12: Variable Set [ Name:%skipretest To:1 Do Maths:Off Append:Off ] If [ %search ~ . ]
A13: Variable Set [ Name:%search To:+ Do Maths:Off Append:Off ] If [ %search ~ . ]

These 2 actions test to see if a "." Has been entered in the text edit box. I use this as a wild card to get all of the folder names. That is what the "+" will do when used as a search parameter. 

A14: Goto [ Type:Action Label Number:1 Label:skip stop ] If [ %par2 ~ on ]

Skip the next action if the search button has been pressed

A15: Stop [ With Error:Off Task: ] If [ %new_val ~ *new_val* ]

Stop the task if %new_val has not been set.

<skip stop>
A16: Test [ Type:Variable Length Data:%search Store Result In:%varlength ]
<start loop>
A17: Variable Clear [ Name:%xxx Pattern Matching:Off ]

You might see this a few times throughout theses tasks. This was my way of making a anchor action before pent made that available.  It is only to make a place for the goto action.

A18: List Files [ Dir:%Filepath Match:%search* Include Hidden Files:Off Variable:%fileslista Continue Task After Error:On ] If [ %varlength < 3 ]

This will get the list of folder names who's first 2 letters match the search criteria.  IE if the first letter entered is "c" it will get all names beginning with "c" then if the next letter Is "a" it will find names beginning with "ca"
Now if a "t" is entered  the following action will find all names that contain
The letters "cat" any where in the name.  And puts the names in the array %filelista

A19: List Files [ Dir:%Allpicspath Match:*%search* Include Hidden Files:Off Variable:%fileslista ] If [ %varlength > 2 ]



A20: Variable Set [ Name:%fileslista To:%fileslista(:) Do Maths:Off Append:Off ]

Sets the variable %filelista to a comma separated list of all the array elements of the array %filelista created by A18 or A19

A21: Variable Set [ Name:%Afilelist To:%fileslista Do Maths:Off Append:Off ]

Just makes a global variable for the list. I think was just for test purposes

<trim list>
A22: Variable Search Replace [ Variable:%fileslista Search:%Allpicspath/ Ignore Case:On Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]

Trims the names to remove the file path information


A23: Variable Set [ Name:%Afile To:%fileslista Do Maths:Off Append:Off ]

Again, I think this was for testing.

A24: Stop [ With Error:Off Task: ] If [ %fileslista ~ *fileslista* ]

Stops if %filelista is not set

<alphabetize>

A25: JavaScriptlet [ Code:var arr = [];
arr = fileslista.split( "," );
arr.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); Libraries: Auto Exit:On Timeout (Seconds):45 ] If [ %skipretest = 1 ]

Alphabetizes the list if a "." Was entered. The JavaScript stores the alphabetized list in a local variable %arr

A26: Variable Set [ Name:%Fileslist To:%fileslista Do Maths:Off Append:Off ] If [ %skipretest ! Set ]

Sets a  global variable to the current list to be used in the menu element of the file browser2 scene. This is the list that is displayed in the menu.

A27: Variable Set [ Name:%Fileslist To:%arr(:) Do Maths:Off Append:Off ] If [ %skipretest = 1 ]

Sets the global variable to the alphabetized list of all the folder names.

A28: Array Clear [ Name:%arr ]
A29: Variable Clear [ Name:%arr Pattern Matching:Off ]
A30: Variable Clear [ Name:%fileslista Pattern Matching:Off ]
A31: Array Clear [ Name:%fileslista ]

A32: Stop [ With Error:Off Task:File Sort Scence2 ] If [ %skipretest = 1 ]
<end>
A33: Stop [ With Error:Off Task: ]

These 2 seem to do the same thing and probably are not even necessary ..

Let me know if you have any questions... Rich...

Rich D

unread,
May 18, 2013, 10:53:16 PM5/18/13
to tas...@googlegroups.com

Oooops...    Edit....

> <start loop>
> A17: Variable Clear [ Name:%xxx Pattern Matching:Off ]
>
> You might see this a few times throughout theses tasks. This was my way of making a anchor action before pent made that available.  It is only to make a place for the goto action.

There does not seem to be a goto for this but I still used this as a way to make a label for organization.  The variable %xxx does nothing.  Simply a way to put a label in the task...

Rich..

Mike L

unread,
May 19, 2013, 12:45:52 PM5/19/13
to tas...@googlegroups.com
Okay this is all coming full circle for me now.
I have found a "bug" that is holding me up though. It seems that "Variable Search Replace" does not work on my phone/ROM or something. I get an error "code 3 : java.lang.NullPointerException" All I'm trying to do is delete the path to the file that I'm attempting to list. I found a work around you made with a Java scriptlet on another thread but I'm having trouble getting that to work as well. No errors on that one, just never does anything. I thought it may be because I'm on the beta, so I uninstalled Tasker, and reinstalled from the Play Store and am still getting the same issues. I'm still messing with it before I report a bug to Pent, though it seems it is a problem only for me as others seem to not have a problem with this action.

Rich D

unread,
May 19, 2013, 1:17:19 PM5/19/13
to tas...@googlegroups.com

> OK. Here we go...  all info refers to the above actions..
>
> File Sort Scence2 (296)

I forgot to say what activates this task for others..

This is a task from a 'text edit box' element in a scene.  So every time a character is entered into the 'text edit box' this task will run..

Rich D

unread,
May 19, 2013, 1:22:27 PM5/19/13
to tas...@googlegroups.com

@ Mike, you never answered this question ..

Have you been able to get the entire project working and been able to view the help file?


> I have found a "bug" that is holding me up though. It seems that "Variable Search Replace" does not work on my phone/ROM

Can you post exactly what you are trying to search and replace and how you are trying it ..

Thanks,   Rich..

Mike L

unread,
May 19, 2013, 2:16:42 PM5/19/13
to tas...@googlegroups.com
No I have not used the project as intended yet, have just been looking through certain tasks and scenes. I did not notice the help file before, that clears up a lot of the what's and why's of everything. I will play with the your app as an app today to get a better feel of the flow of operations. I should have done that from the start.



I am using a "list file" to populate %arr with the files I want to search through. When flashing %arr() I get a comma separated list of all files with their directory path as expected, ie. /storage/sdcard0/Tasker/ClientLog/filenamehere,/storage/sdcard0/...........
I set up the Variable Search Replace like this:

Variable: %arr ---- I tried using %arr() but I get a toast message saying "Error: arr(): must be a variable or array name." I tried doing this with global and local variables, same thing
Search: / ----- I figure if this works I can put the whole file path up until the file name here ie. /storage/sdcard0/Tasker/ClientLog/    using the / just for testing right now
Replace Match: Checked, field left blank.

Then I'll get the NullPointerException error.  
This must be something I'm doing wrong because if I populate %arr manually with a variable set, not creating an array, Variable Search Replace works as expected

Rich D

unread,
May 19, 2013, 2:52:29 PM5/19/13
to tas...@googlegroups.com

>
> I am using a "list file" to populate %arr with the files I want to search through. When flashing %arr() I get a comma separated list of all files with their directory path as expected, ie. /storage/sdcard0/Tasker/ClientLog/filenamehere,/storage/sdcard0/...........
> I set up the Variable Search Replace like this:
>
> Variable: %arr

At first glance it looks like you need to set %arr to %arr(:)  this will set the variable %arr to the comma separated list of all the elements in the array %arr

---- I tried using %arr()

That should not work

Mike L

unread,
May 19, 2013, 3:14:23 PM5/19/13
to tas...@googlegroups.com
Just tried %arr(:) and got the same toast message "Error: %arr(:): must be a variable or array name."

Rich D

unread,
May 19, 2013, 3:30:20 PM5/19/13
to tas...@googlegroups.com

>
> Just tried %arr(:) and got the same toast message "Error: %arr(:): must be a variable or array name."

I think you misunderstood ..

You have an array %arr with all of you file names in it EI
%arr1 = "the first file name"
%arr2 = "the second file name"
Etc....

Now you need to put this into a comma separated list to be used in the variable search and replace. 

It is important to understand that the variable %arr does not contain anything at this point.. It has nothing to do with the array %arr  you need to set it.  So use a variable set.. IE..

Variable set %arr to %arr(:)

Now the variable %arr contains "the first file name,the second file name,etc....")

Now you can use the variable %arr in your find and replace...

A technique I use when dealing with this sort of thing is use all global variables and arrays.  Then after you run the task you can check in the variables tab to see what everything is set to. It is a lot easier and more accurate than trying to see everything in a flash action. Then once it is all working go back and change them to local variables and arrays.

Rich..

Rich D

unread,
May 19, 2013, 3:45:41 PM5/19/13
to tas...@googlegroups.com

BTW..

A technique I use when dealing with this sort of thing is use all global variables and arrays. Then after you run the task you can check in the variables tab to see what everything is set to. It is a lot easier and more accurate than trying to see everything in a flash action. Then once it is all working go back and change them to local variables and arrays.

I found the best way to do this is simply put a "A" at the beginning of every variable and array.  Now all of your test variables will be displayed first and in one area of the variable list.  Then when everything works just go back through and delete the "A" from all of the variables and arrays.. and you can easily delete the global variables from the list...

Rich..

Rich D

unread,
May 19, 2013, 4:37:38 PM5/19/13
to tas...@googlegroups.com

> Just tried %arr(:) and got the same toast message "Error: %arr(:): must be a variable or array name."

After rereading the post I think I see where the confusion might be. The normal way to make an array would be to do a variable split.  So if you were to split a variable %test that had a value of "a,b,c," and you did not check the " delete base " option in the variable spit you would end up with an array like this..
%test1=a
%test2=b
%test3=c

AND you would still have the variable %test that still equaled "a,b,c"

However your array %arr is getting set with the files list action so the variable %arr has never been set so you need to set it...

Rich...

Mike L

unread,
May 19, 2013, 8:36:14 PM5/19/13
to tas...@googlegroups.com
Please put some of your apps on the play store or something so I can buy them. I don't care if I want/need them (though I'm sure at least some would prove useful for me) I'll buy it.
I would not have been able to put this together without your help. The profile is working flawlessly (or so it seems, just had my first successful run threw 2 minutes ago)

I have learned so much about Tasker and computer logic creating this. Thanks a million man, really appreciate you taking the time to explain things.
I would post the set-up here but it is somewhat pointless until I put together the second half, which is now in the works since this part is pretty much all set.

Rich D

unread,
May 19, 2013, 9:03:46 PM5/19/13
to tas...@googlegroups.com

Thanks a million man, really appreciate you taking the time to explain things.

No problem... glad you got it going..

> I would post the set-up here but it is somewhat pointless until I put together the second half, which is now in the works since this part is pretty much all set.
>

I never asked... just curious,  what are you working on?

Rich...

Mike L

unread,
May 19, 2013, 9:35:37 PM5/19/13
to tas...@googlegroups.com
This part is just a way to log client info and search through it to update it.
The second part is to send a bunch of the locations of these places though a "traveling salesman" algorithm to optimize the driving route.
There are websites that do this, which is how I do it now for work. But right now I have a list of coordinates I manually put into this website:

This works okay but it would be nice to have this automated. I haven't figured out how to input text in a website through Tasker yet though.
I found this javascript on another website for a "TSP" which is actually designed for Google Maps which is what I use for navigation:

From what I understand a TSP is pretty intense for a computer to solve so it may be best to have the website do it. And I don't know java at all so that's a pretty serious hurdle haha. 

Rich D

unread,
May 19, 2013, 10:06:32 PM5/19/13
to tas...@googlegroups.com

> This works okay but it would be nice to have this automated. I haven't figured out how to input text in a website through Tasker yet though.

I have not had to input or receive data from the web yet but i know it can be done. Actually I think the beginners guide from Pocketables has a lot on http get.   Not sure about the http post though. 

Sounds like a interesting project.. So far the few apps I have built with tasker have turned out far better than the apps they replaced,  allowing me much more customization. So I am sure it will be worth your efforts..

Not sure if I can help much with the web stuff so you might want to post specific questions on new posts if get stuck with that..

Feel free to ask If you have more questions about the apps I posted..

Rich..

Mike L

unread,
May 20, 2013, 4:40:41 PM5/20/13
to tas...@googlegroups.com
Yea I've been through pretty much all the pocketables articles. That's HTTP Get is covered pretty well, not too much on Post. I have found a few things on it scattered around though. It seems it will be difficult since I need to interact with the website with text input, and 3 or 4 button presses to get the info I want from it. And the URL for the website never changes or anything while using it, so I can't skip any steps there...  But like you said it will be worth it. Not only do Tasker "apps" end up being better when dialed in, but it's only 1 app. Instead of having 30 for every stupid thing I want to do
I will make a new thread in a few days either with a cool new project or begging for help haha
Reply all
Reply to author
Forward
0 new messages