jd_abramson
Lurker
How to I get tasker to decide which one is the variable to use in order to email the vaule of 15005K?
I am trying to pull the text from whichever variable has the matching string of *KT . In the example below the value is 15005K. My problem is the *KT string can be in the 3 (%raw213) or 4 (%raw214) position at any given time. Therefore I can't assign a specific variable when trying to pull the text.
Here are two examples of the %raw21 variable. I need the *KT value to be emailed.
KCLL 231253Z 15005K 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117
%raw21(#?*KT) = 3
%raw213 = 15005K
KCLL 231253Z AUTO 15005K 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117
%raw21(#?*KT) = 4
%raw214 = 15005K
ASOS Local (228)
A1: HTTP Get [ Server
ort:https://www.aviationweather.gov/metar/data?ids=KCLL&format=raw&hours=0&taf=off&layout=on&date=0 Path: Attributes: Cookies: User Agent: Timeout:10 Mime Type: Output File:Tasker/ASOS/asosget.txt Trust Any Certificate:Off ]
A2: Read File [ File:Tasker/ASOS/asosget.txt To Var:%raw ]
A3: Variable Split [ Name:%raw Splitter:<!-- Data starts here --> Delete Base:Off ]
A4: Variable Split [ Name:%raw2 Splitter:<br /> Delete Base:Off ]
A5: Variable Split [ Name:%raw21 Splitter:<!-- Data ends here --> Delete Base:Off ]
A6: Variable Search Replace [ Variable:%raw21 Search:\A\s+|\s+\z Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A7: [X] Flash [ Text:%raw21 Long:On ] (in this case KCLL 231253Z 15005KT 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117)
A8: Write File [ File:Tasker/ASOS/ASOSlog.csv Text:%raw21 Append:On Add Newline:On ]
A9: Variable Split [ Name:%raw21 Splitter: Delete Base:Off ]
A10: If [ %raw21(#?*KT) > 2 ] (the value in this case is 3 as *KT in the the 3rd position)
A11: If [ %raw21(#?*KT) > 5 ] (the value in this case is 3 as *KT in the the 3rd position (same as above)
A12: Email Me Pro [ Configuration:To: me@here.com, Subject: ASOS Alert, Body: ASOS reporting winds as of %raw212. This is a daily morning notification that arrives around 6:00AM. The most recent reading is: %raw21 Timeout (Seconds):0 ] (how can I get tasker to pull the variable in the third position of %raw21 based on the %raw21(#?*KT) value instead of %raw212)(%raw212 is only correct as long as *KT is not in the 4 position)
A13: End If
A14: End If
A15: If [ %ASOSDAILY ~ 1 ]
A16: Email Me Pro [ Configuration:To: me@here.com, Subject: ASOS Daly, Body:ASOS is NOT reporting winds as of %raw2. Please confirm by calling ASOS 979-846-1708 and checking online at https://www.aviationweather.gov/metar/data?ids=KCLL&format=raw&hours=0&taf=off&layout=on&date=0 The most recent reading is: %raw21 (Seconds):0 ]
(how can I get tasker to pull the variable in the third position of %raw21 based on the %raw21(#?*KT) value instead of %raw212)(%raw212 is only correct as long as *KT is not in the 4 position (same as above))
A17: Variable Clear [ Name:%ASOSDAILY Pattern Matching:Off ]
A18: End If
A19: Delete File [ File:Tasker/ASOS/asosget.txt Shred Level:0 Use Root:Off Continue Task After Error:On ]
A20: Variable Set [ Name:%raw To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A21: Variable Set [ Name:%raw1 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A22: Variable Set [ Name:%raw2 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A23: Variable Set [ Name:%raw21 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A24: Variable Set [ Name:%ASOSTASKERROR To:No Recurse Variables:Off Do Maths:Off Append:Off ]
A25: Stop [ With Error:Off Task: ]
I am trying to pull the text from whichever variable has the matching string of *KT . In the example below the value is 15005K. My problem is the *KT string can be in the 3 (%raw213) or 4 (%raw214) position at any given time. Therefore I can't assign a specific variable when trying to pull the text.
Here are two examples of the %raw21 variable. I need the *KT value to be emailed.
KCLL 231253Z 15005K 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117
%raw21(#?*KT) = 3
%raw213 = 15005K
KCLL 231253Z AUTO 15005K 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117
%raw21(#?*KT) = 4
%raw214 = 15005K
ASOS Local (228)
A1: HTTP Get [ Server

A2: Read File [ File:Tasker/ASOS/asosget.txt To Var:%raw ]
A3: Variable Split [ Name:%raw Splitter:<!-- Data starts here --> Delete Base:Off ]
A4: Variable Split [ Name:%raw2 Splitter:<br /> Delete Base:Off ]
A5: Variable Split [ Name:%raw21 Splitter:<!-- Data ends here --> Delete Base:Off ]
A6: Variable Search Replace [ Variable:%raw21 Search:\A\s+|\s+\z Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A7: [X] Flash [ Text:%raw21 Long:On ] (in this case KCLL 231253Z 15005KT 10SM CLR 13/12 A2974 RMK AO2 SLP067 T01280117)
A8: Write File [ File:Tasker/ASOS/ASOSlog.csv Text:%raw21 Append:On Add Newline:On ]
A9: Variable Split [ Name:%raw21 Splitter: Delete Base:Off ]
A10: If [ %raw21(#?*KT) > 2 ] (the value in this case is 3 as *KT in the the 3rd position)
A11: If [ %raw21(#?*KT) > 5 ] (the value in this case is 3 as *KT in the the 3rd position (same as above)
A12: Email Me Pro [ Configuration:To: me@here.com, Subject: ASOS Alert, Body: ASOS reporting winds as of %raw212. This is a daily morning notification that arrives around 6:00AM. The most recent reading is: %raw21 Timeout (Seconds):0 ] (how can I get tasker to pull the variable in the third position of %raw21 based on the %raw21(#?*KT) value instead of %raw212)(%raw212 is only correct as long as *KT is not in the 4 position)
A13: End If
A14: End If
A15: If [ %ASOSDAILY ~ 1 ]
A16: Email Me Pro [ Configuration:To: me@here.com, Subject: ASOS Daly, Body:ASOS is NOT reporting winds as of %raw2. Please confirm by calling ASOS 979-846-1708 and checking online at https://www.aviationweather.gov/metar/data?ids=KCLL&format=raw&hours=0&taf=off&layout=on&date=0 The most recent reading is: %raw21 (Seconds):0 ]
(how can I get tasker to pull the variable in the third position of %raw21 based on the %raw21(#?*KT) value instead of %raw212)(%raw212 is only correct as long as *KT is not in the 4 position (same as above))
A17: Variable Clear [ Name:%ASOSDAILY Pattern Matching:Off ]
A18: End If
A19: Delete File [ File:Tasker/ASOS/asosget.txt Shred Level:0 Use Root:Off Continue Task After Error:On ]
A20: Variable Set [ Name:%raw To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A21: Variable Set [ Name:%raw1 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A22: Variable Set [ Name:%raw2 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A23: Variable Set [ Name:%raw21 To:Error Recurse Variables:Off Do Maths:Off Append:Off ]
A24: Variable Set [ Name:%ASOSTASKERROR To:No Recurse Variables:Off Do Maths:Off Append:Off ]
A25: Stop [ With Error:Off Task: ]