I Would Like To Import “The Highest Voted 10 Jokes, Posted Today.” Feed from Sickipedia (http://www.sickipedia.org/feeds/?1262777987.xml) into Tasker, And Then Write the Items into a Text File with A / In front Of the Joke, For Example:
/Went To The Corner Shop - Bought 4 Corners.
/I'll Tell You What I Love Doing More Than Anything, Trying to Pack Myself in a Small Suitcase. I Can Hardly Contain Myself.
/I Tried Water Polo But My Horse Drowned.
I Am A Newbie In Tasker And Was Wondering If Anybody Could Lend Me A Hand Seeing As I Don’t Even Know Where To Start.
http://www.pocketables.com/2012/09/beginners-guide-to-tasker-part-4-variable-data-processing.html
Should be exactly what your looking for. You just give me a cool idea for my next project aswell.
Jay M
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/mh4AjzoRe2Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Sounds cool, What I'm going to do is make a widget in Zooper and then have the jokes display in that, Maybe even add a speech button because jokes sound better heard than read.
Jay M
Post what you have so far, description to clipboard (not XML) From the sounds of it another variable split should be right to get rid of the garbage text (as Andreas calls it)
Jay M
--
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/mh4AjzoRe2Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
I have tried adding another variable split however it just deletes the joke and leaves the garbage, unless I'm putting it in wrong.
The tag your splitting it at might be to common
Jay M
Sickipedia Widget (81)
A1: HTTP Get [ Server:Port:http://www.sickipedia.org Path:feeds/?1262777988.xml Attributes: Cookies: Timeout:10 Mime Type:text/xml Output File:Sickipedia.txt ]
A2: Read File [ File:Sickipedia.txt To Var:%SICK ]
A3: Variable Split [ Name:%SICK Splitter:<![CDATA[ Delete Base:On ]
A4: Variable Split [ Name:%SICK2 Splitter:.]]> Delete Base:On ]
A5: Flash [ Text:%SICK21 Long:On ]
This give me the joke only
Jay M
Profile: Joke Download (363)
Time: From 08:00 Till 08:02
Enter: Daily Joke (362)
A1: [X] Write File [ File:Recorded/jokes.txt Text: Append:Off Add Newline:Off ]
A2: HTTP Get [ Server:Port:www.sickipedia.org Path:feeds/?1262777988.xml Attributes: Cookies: Timeout:15 Mime Type:application/octet-stream Output File:Recorded/Sickipedia.txt ]
A3: Read File [ File:Recorded/Sickipedia.txt To Var:%sick ]
A4: Variable Split [ Name:%sick Splitter:[CDATA[ Delete Base:Off ]
A5: For [ Variable:%split Items:2:10 ]
A6: Variable Split [ Name:%sick(%split) Splitter:]]> Delete Base:Off ]
A7: Variable Set [ Name:%one To:1 Do Maths:Off Append:Off ]
A8: Variable Set [ Name:%flash To:%split%one Do Maths:Off Append:Off ]
A9: For [ Variable:%remove Items:\<br>,\<br/> ]
A10: Variable Search Replace [ Variable:%sick(%flash) Search:%remove Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A11: End For
A12: Write File [ File:Recorded/jokes.txt Text:@%sick(%flash) Append:On Add Newline:On ]
A13: End For
A14: Read File [ File:Recorded/jokes.txt To Var:%Jokes ]
A15: Variable Split [ Name:%Jokes Splitter:@ Delete Base:Off ]
A16: Variable Set [ Name:%Max_Jokes To:%Jokes(#) Do Maths:Off Append:Off ]
And a shortcut action to read through the jokes:
Jokes (361)
A1: Variable Set [ Name:%Next_Joke To:2 Do Maths:Off Append:Off ] If [ %Next_Joke < 2 ]
A2: Test [ Type:Variable Length Data:%Jokes(%Next_Joke) Store Result In:%joke_length ]
A3: If [ %joke_length > 20 ]
A4: For [ Variable:%wait Items:1:4 ]
A5: Flash [ Text:%Jokes(%Next_Joke) Long:On ]
A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A7: End For
A8: End If
A9: Variable Add [ Name:%Next_Joke Value:1 Wrap Around:%Max_Jokes ]
A10: Goto [ Type:Action Number Number:1 Label: ] If [ %joke_length < 21 ]
Thank you kindly for the idea also. I wanted to share this in case it helps.
It works for me now too, thank you. However I am getting <br/><br/> in between parts of the text, how can I get rid of this?
Variable search replace should work, I think you should do what Brandon wrote though, He knows better than I do.
Jay M
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
An issue to contend with in the future using this setup is extreme data array size. I plan to write a profile based on %Jokes(#) > 100, which would perform an action to pop array positions until < 100. I wanted to play around with this first before I started that though. But, I will post what works to keep the array manageable, and the jokes fresh!
I wanted to keep the jokes to simple, witty, one-liners, maybe a little more but not much... just the basic funny stuff.
I also determined the posting updates roughly every 4-6 hours, more than daily :-) so I wanted to account for this.
Right now, the profile works flawlessly. Even deleting variables manually in the array will not result in the device saying something like, "%Jokes68". And any changes made in the master list of jokes will reflect in the array within 6 hours. The array could be expanded to include nearly 10,000 jokes before it begins to error. I do not recommend using arrays for that much extensive data management anyhow.
Here it is:
Profile: Joke Download (363)
Time: From 00:00 every 6h Till 23:59
Enter: Daily Joke (362)
A1: Variable Set [ Name:%one To:1 Do Maths:Off Append:Off ]
A2: HTTP Get [ Server:Port:www.sickipedia.org Path:feeds/?1262777988.xml Attributes: Cookies: Timeout:15 Mime Type:application/octet-stream Output File:Recorded/Sickipedia.txt ]
A3: Read File [ File:Recorded/Sickipedia.txt To Var:%sick ]
A4: Variable Split [ Name:%sick Splitter:[CDATA[ Delete Base:Off ]
A5: For [ Variable:%split Items:2:11 ]
A6: Variable Split [ Name:%sick(%split) Splitter:]]> Delete Base:Off ]
A7: Variable Set [ Name:%flash To:%split%one Do Maths:Off Append:Off ]
A8: For [ Variable:%remove Items:\<br>,\<br/> ]
A9: Variable Search Replace [ Variable:%sick(%flash) Search:%remove Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A10: End For
A11: Test [ Type:Variable Length Data:%sick(%flash) Store Result In:%sick_length ]
A12: Write File [ File:Recorded/jokes.txt Text:@%sick(%flash) Append:On Add Newline:On ] If [ %sick_length < 141 ]
A13: End For
A14: Read File [ File:Recorded/jokes.txt To Var:%Jokes ]
A15: Variable Split [ Name:%Jokes Splitter:@ Delete Base:Off ]
<Pop Elements>
A16: Anchor
A17: If [ %Jokes(#) > 100 ]
A18: Array Pop [ Variable:%Jokes Position:1 To Var: ]
A19: Goto [ Type:Action Label Number:% Label:Pop Elements ]
A20: End If
A21: Variable Set [ Name:%Max_Jokes To:%Jokes(#) + 1 Do Maths:On Append:Off ]
Shortcut to play jokes:
Jokes (361)
A1: Variable Set [ Name:%Next_Joke To:2 Do Maths:Off Append:Off ] If [ %Next_Joke < 2 ]
A2: Test [ Type:Variable Length Data:%Jokes(%Next_Joke) Store Result In:%joke_length ]
A3: If [ %joke_length > 10 ]
A4: Say [ Text:%Jokes(%Next_Joke) Engine:Voice:default:default Stream:1 Pitch:5 Speed:5 Continue Task Immediately:On ] If [ %SILENT ~ off ]
A5: For [ Variable:%wait Items:1:3 ]
A6: Flash [ Text:%Jokes(%Next_Joke) Long:On ]
A7: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A8: End For
A9: End If
A10: Variable Add [ Name:%Next_Joke Value:1 Wrap Around:%Max_Jokes ]
A11: Goto [ Type:Action Number Number:1 Label: ] If [ %joke_length < 11 ]
Thanks again for the idea! :-D
A downside of popping the joke array elements to keep them fresh was unfortunately my queue to play the next element was not adjusting based on the new position for an element after a download and adjustment.
For example, I just played %Joke(13), and new jokes are downloaded. Now next joke queued is %Joke(14), but what would have been %Joke(14) is now something like %Joke(11) in the array, and my queue remained at %Joke(14) so I would miss playing that joke, and a few others downloaded.
This change fixes that error :-)
Downside to change is if no jokes are played for days, the queued element position could fall below 0, meaning your queued joke has been pushed out of the array.
However, the original shortcut used to play a joke still functions flawlessly to play valid elements if this occurred.
Here is the download task with changes:
Profile: Joke Download (363)
Time: From 00:00 every 6h Till 23:59
Enter: Daily Joke (362)
A1: Variable Set [ Name:%one To:1 Do Maths:Off Append:Off ]
A2: HTTP Get [ Server:Port:www.sickipedia.org Path:feeds/?1262777988.xml Attributes: Cookies: Timeout:15 Mime Type:application/octet-stream Output File:Recorded/Sickipedia.txt ]
A3: Read File [ File:Recorded/Sickipedia.txt To Var:%sick ]
A4: Variable Split [ Name:%sick Splitter:[CDATA[ Delete Base:Off ]
A5: For [ Variable:%split Items:2:11 ]
A6: Variable Split [ Name:%sick(%split) Splitter:]]> Delete Base:Off ]
A7: Variable Set [ Name:%flash To:%split%one Do Maths:Off Append:Off ]
A8: For [ Variable:%remove Items:\<br>,\<br/> ]
A9: Variable Search Replace [ Variable:%sick(%flash) Search:%remove Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A10: End For
A11: Test [ Type:Variable Length Data:%sick(%flash) Store Result In:%sick_length ]
A12: Write File [ File:Recorded/jokes.txt Text:@%sick(%flash) Append:On Add Newline:On ] If [ %sick_length < 141 ]
A13: End For
A14: Read File [ File:Recorded/jokes.txt To Var:%Jokes ]
A15: Variable Split [ Name:%Jokes Splitter:@ Delete Base:Off ]
A16: If [ %Jokes(#) > 100 ]
A17: Variable Set [ Name:%difference To:%Pre_popped_jokes -%Jokes(#) Do Maths:On Append:Off ] If [ %Pre_popped_jokes Is Set ]
A18: Variable Set [ Name:%Pre_popped_jokes To:%Jokes(#) Do Maths:Off Append:Off ]
A19: Variable Add [ Name:%Next_Joke Value:%difference Wrap Around:0 ] If [ %difference < 0 ]
A20: End If
<Pop Elements>
A21: Anchor
A22: If [ %Jokes(#) > 100 ]
A23: Array Pop [ Variable:%Jokes Position:1 To Var: ]
A24: Goto [ Type:Action Label Number:% Label:Pop Elements ]
A25: End If
A26: Variable Set [ Name:%Max_Jokes To:%Jokes(#) + 1 Do Maths:On Append:Off ]
I'm looking to do a daily horoscope profile now :-)
Works as shortcut, or with AutoVoice!
Profile: Horoscope (248)
State: AutoVoice Recognized [ Configuration:Event Behaviour: true
Command: "horoscope for (?<sign>.+) (regex)" ]
Enter: Horoscope (192)
A1: Variable Set [ Name:%one To:1 Do Maths:Off Append:Off ]
A2: Variable Set [ Name:%two To:2 Do Maths:Off Append:Off ]
A3: HTTP Get [ Server:Port:http://www.astrology.com Path:/horoscopes/daily-couples.rss Attributes: Cookies: Timeout:15 Mime Type:application/octet-stream Output File:Recorded/horoscopes.txt ]
A4: Read File [ File:Recorded/horoscopes.txt To Var:%horoscope ]
A5: Variable Split [ Name:%horoscope Splitter:<title> Delete Base:Off ]
A6: For [ Variable:%flash Items:2,4:%horoscope(#) ]
A7: Variable Split [ Name:%horoscope(%flash) Splitter:Daily Delete Base:Off ] If [ %horoscope(%flash) ~R Daily ]
A8: Flash [ Text:%horoscope(%flash%one) Long:Off ] If [ %flash = 2 ]
A9: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] If [ %flash = 2 ]
A10: If [ %sign Is Set ]
A11: Variable Set [ Name:%split To:%horoscope(%flash%two) Do Maths:Off Append:Off ]
A12: Variable Split [ Name:%split Splitter:;p> Delete Base:Off ]
A13: Test [ Type:Variable Length Data:%split(%two) Store Result In:%length ]
A14: Variable Search Replace [ Variable:%split(%two) Search:</p>< Ignore Case:Off Multi-Line:Off One Match Only:On Store Matches In: Replace Matches:On Replace With: ] If [ %length > 7 ]
A15: If [ %split ~R %sign ]
A16: Flash [ Text:%horoscope(%flash%one)
%split(%two) Long:Off ] If [ %length > 7 ]
A17: Say [ Text:%horoscope(%flash%one)
%split(%two) Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]
A18: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] If [ %length > 7 ]
A19: End If
A20: Else
A21: Variable Set [ Name:%split To:%horoscope(%flash%two) Do Maths:Off Append:Off ]
A22: Variable Split [ Name:%split Splitter:;p> Delete Base:Off ]
A23: Test [ Type:Variable Length Data:%split(%two) Store Result In:%length ]
A24: Variable Search Replace [ Variable:%split(%two) Search:</p>< Ignore Case:Off Multi-Line:Off One Match Only:On Store Matches In: Replace Matches:On Replace With: ] If [ %length > 7 ]
A25: Flash [ Text:%horoscope(%flash%one)
%split(%two) Long:Off ] If [ %length > 7 ]
A26: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] If [ %length > 7 ]
A27: End If
A28: End For
RSS feeds are fun!
This will help a user look for a specific joke in the array.
You can say, "tell me a fat joke", "tell me a wife joke", "tell me a blonde joke', etc. and this will tell you a random joke that pertains to your request.
Profile: Tell Me A <specific> Joke (389)
State: AutoVoice Recognized [ Configuration:Event Behaviour: true
Command: "tell me (?<talk>a|an) (?<specific>.+) joke (regex)" ]
Enter: Specific Joke (377)
A1: Flash [ Text:%specific Long:Off ]
A2: Variable Set [ Name:%volm To:%VOLM Do Maths:Off Append:Off ]
A3: Variable Set [ Name:%all To:* Do Maths:Off Append:Off ]
A4: Media Volume [ Level:15 Display:Off Sound:Off ]
A5: [X] Flash [ Text:%Jokes(#?%all%specific%all) Long:Off ]
A6: Variable Set [ Name:%joke To:%Jokes(#?%all%specific%all) Do Maths:Off Append:Off ]
A7: If [ %joke ~R , ]
A8: Variable Split [ Name:%joke Splitter:, Delete Base:Off ]
A9: Variable Set [ Name:%max To:%joke(#) Do Maths:Off Append:Off ]
A10: Variable Randomize [ Name:%random Min:1 Max:%max ]
A11: Variable Set [ Name:%fun To:%joke(%random) Do Maths:Off Append:Off ]
A12: Flash [ Text:%Jokes(%fun) Long:On ] If [ %fun != 0 ]
A13: Say [ Text:%Jokes(%fun) Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ] If [ %fun != 0 ]
A14: Else If [ %joke !~ 0 ]
A15: Flash [ Text:%Jokes(%joke) Long:On ]
A16: Say [ Text:%Jokes(%joke) Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]
A17: End If
A18: Flash [ Text:Error Long:Off ] If [ %joke ~ 0 ]
A19: Say [ Text:None found Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ] If [ %joke ~ 0 ]
A20: Media Volume [ Level:%volm Display:Off Sound:Off ]
Puppy Chow (502)
A1: Variable Set [ Name:%one To:1 Do Maths:Off Append:Off ]
A2: HTTP Get [ Server:Port:http://www.reddit.com Path:/r/puppies/top/.rss Attributes: Cookies: Timeout:10 Mime Type:text/xml Output File:Recorded/puppy_chow.txt ]
A3: Read File [ File:Recorded/puppy_chow.txt To Var:%puppy ]
A4: Variable Split [ Name:%puppy Splitter:<guid isPermaLink="true"> Delete Base:Off ]
A5: For [ Variable:%split Items:2:%puppy(#) ]
A6: Variable Split [ Name:%puppy(%split) Splitter:/</guid> Delete Base:Off ]
A7: Variable Set [ Name:%flash To:%split%one Do Maths:Off Append:Off ]
A8: Flash [ Text:%puppy(%flash) Long:Off ]
A9: End For
If a9 was appended as action, app: Chrome, data: %puppy(%flash) that would open a new tab with each one.
Something like that?
I have one question though: do you know of any other source of small, family-friendly and, most importantly, universally applicable joke database that I might use instead of Sickipedia? A lot of its jokes reference things that fly over my head.
I know it'll require changes to the joke extraction actions we're performing on the text file, so I may bug you about that as well.
Mmmm, unfortunately no. I've also been looking for a more politically correct and family friendly source. I haven't found anything worth using. I should mention, usually I have a text file loaded with the jokes and review and edit them when I'm bored. I keep the real gems and delete the rest. Every few days I'll open the text file and remove the ones that I don't like. Sometimes there's one or two that are kid friendly so I out those in another file handled by another task. You'll notice the task simply keeps writing the download to the file, it's the array that has new jokes populated regularly. You can refine the elements in the array by editing the contents of the text file.
That way, I at least have a collected assortment of screened jokes for an audience.
Not exactly the tasker method of screening, but with a joke it's about context not just the words.
If you find a source I'd like to know :-)
I have to show you something. How do I copy the task description in Tasker?
Regards,
Aayush
(Handcrafted on my phone.)
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/mh4AjzoRe2Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
1) Disable beginner mode.
Go to menu > preferences > UI tab > Beginner mode and uncheck it.
2) A profile/task must be named to export
Long press on the profile that you want to name and a menu bar should appear at the top of the screen.
Select the "A" icon to open a dialog to name the profile.
Note: You can change tasker's profile creation sequence to request a profile name when creating a profile with:
menu > preferences > UI > scroll down to Main Screen section and find 'Ask For New Profile Name' and check it.
For tasks in a scene, you can apply a named task in an element task by selecting the desired element and label, then the round arrow on lower left corner of the action edit screen.
3) Post the Tasker description of the profile or task that you are having trouble with.
To do that you long press on the profile name (or task name) and then go to menu > export > description to clipboard (don't select export XML). Then paste the clipboard contexts into a post.
The joke stuff is exactly what I've been looking for however it seems that the Test action has been removed from the new version of tasker, as such I can't get it to work. Can some one please help me. I just get the "not found error no matter what I say".
Many thanks.
There's a search field when adding an action... type 'test' and they should popup.
https://www.dropbox.com/s/jl9t71qob2ak4an/Joke_Download.prf.xml
Let me know if it doesn't work :/
Gives a scrolling list of all jokes and when pressed it just says %arr(%tap_index)
It was easy. Not even worth uploading.
You can open the task, and in the write file and read file actions, select the magnifying glass to write the file to one that exists for your device.
Might want to use a file manager to create a blank text document first, then select it in tasker in those actions so the data is written to and read from that file.