If (play music when match "YES" , or keep silent if no "YES")

50 views
Skip to first unread message

y w

unread,
Sep 22, 2014, 4:57:14 AM9/22/14
to tas...@googlegroups.com, wil...@aed-hk.com
Dear All, 

I'm a beginner of tasker, I already created a task as follow:

1. Load App - Internet

2. Music Play - File ringtone/song.mp3
                                      If %HTTPD~YES~%HTTPD~YES

Then I press left corner play, no matter the Internet page matches "YES" or not, the song.mp3 keep playing after I press. 

I will be very appreciate if someone can teach me to fix it, thanks a lot! 

Best regards 
William

Jeremy Harris

unread,
Sep 22, 2014, 11:51:23 AM9/22/14
to tas...@googlegroups.com
I'm not sure I follow weekday you're trying to do... %HTTPD is set with the html contents of a webpage that you've retrieved using the HTTP GET action.

y w

unread,
Sep 22, 2014, 12:23:50 PM9/22/14
to tas...@googlegroups.com
Dear Jeremy,
 
Thanks for your prompt reply! Actually I would like to create a task like this:
 
1. If browser page contains the keyword(eg."YES") , then play song A or alarm.
 
2. If the page NOT contains the keyword , then play song B or keep silent is also ok.  
 
Could you pls teach me how to set the tasker variable? Million thanks!
 
Best regards
William

nanobrain

unread,
Sep 22, 2014, 12:25:30 PM9/22/14
to tas...@googlegroups.com
Jeremy is correct. Use the HTTP GET action to fetch a website. Now it is not quiet clear what you are trying to achieve, but if you want to play a ringtone if the site is reachable use Play ringtone if %HTTPR ~ 200 (That's the return code, 200 means successful). If you want to play the ringtone if the content of the site contains a YES, then use if %HTTPD ~ *yes*. The asterisks and lower case are important meaning that the yes can be anywhere in the file, and it can be either Yes, YEs, yeS, yes, etc. See the user's guide in the pattern matching section.

If I didn't understand your intent correctly, please elaborate more.

Jeremy Harris

unread,
Sep 22, 2014, 6:14:13 PM9/22/14
to tas...@googlegroups.com

1. If browser page contains the keyword(eg."YES") , then play song A or alarm.
 
2. If the page NOT contains the keyword , then play song B or keep silent is also ok.  

Have you figured out how to play the selected files yet? If so, then you just need to read the page you want, using Net > HTTP Get. Then follow nanobrain's suggestion:

If [%HTTPD ~ *yes*]

y w

unread,
Sep 23, 2014, 2:30:48 AM9/23/14
to tas...@googlegroups.com
Dear Jeremy & Nanobrain, 

Thanks for your suggestion! I revised the task as follow, but FAILED(song keep playing although no *yes*), 

1. Load App - Internet  (homepage: www.abc.com)

2. HTTP Get - Port: www.abc.com
                     If %HTTPR~200~%HTTPR~200

3. Play ringtone - File ringtone/songA.mp3
                          If %HTTPD~*yes*~%HTTPD~*yes*

Could you pls tell me the mistake? thanks a lot!

Best regards
William

Jeremy Harris

unread,
Sep 23, 2014, 7:07:26 AM9/23/14
to tas...@googlegroups.com
I think you probably don't need the first action. I don't think you need the If condition on the second action. The If statement on the third action should just go once:

If %HTTPD ~ *yes*

y w

unread,
Sep 24, 2014, 6:18:29 AM9/24/14
to tas...@googlegroups.com
Dear Jeremy, 

Unfortunately still Failed, probably my mobile problem. Would you pls provide the tasker variable steps to me. I'll try in another mobile, many thanks my dearest Jeremy!

Kindly regards
William

Jeremy Harris

unread,
Sep 24, 2014, 12:33:51 PM9/24/14
to tas...@googlegroups.com
I can't really build the task for you because I still don't clearly understand why/what you're trying to accomplish. Taking what you've described so far literally, the actions you have + the advice nanobrain and I gave you should work.

If you export your task's description here maybe someone can see what's wrong.

Also, for debugging you should either flash %HTTPD or set it to a new global variable, ie: %Httpd, in order to check its contents.

Reply all
Reply to author
Forward
0 new messages