TexEdit %new_val Empty

24 views
Skip to first unread message

Thom Little

unread,
Sep 6, 2015, 4:04:15 PM9/6/15
to Tasker
I have some Scenes with a number of TextEdit elements.

These elements have a Text Changed option to permit me to assign the submitted data to a variable.  Something like ...

Variable Set %TestData to %new_val

This works like a champ except for one thing ...

If the scene is terminated and there is no data in the Element it is reported as %new_val

I want to test for this condition and if the is no entered data in the field I want to ...

Variable Set %TestData to *

I can find no way to do this in Tasker ... %new_val  seems to be a special case.

Any suggestions?

... Thom

Thom Little

unread,
Sep 6, 2015, 5:29:55 PM9/6/15
to Tasker
Well ... I kept hacking away and hacking away and stumbled on the solution.

My guess is a glitch in handling the % in Tasker.  This works ...

If %TestData ~ *new_val
Variable Set %TestData to *​
End If

If a string contains new_val it will give a false answer.

(Testing for *%new_val does not work.)

... Thom

Sean Williams

unread,
Sep 6, 2015, 7:03:13 PM9/6/15
to Tasker
Hi Thom

Have you read pattern matching and the variable section within Taskers user guide?

As you have found there are different ways to approch this however take a look into escaping variable names.

Also maybe look into your approach with %new_val something like below.

If [ %new_val Set & %new_val !~ \%new_val ]

Variable Set [ Name:%value To:new_val Do Maths:Off Append:Off ]

If [ %value ~R [someregex] ]

Variable Set [ Name:%MyValue To:%value Do Maths:Off Append:Off ]

else...

Thom Little

unread,
Sep 6, 2015, 9:13:29 PM9/6/15
to Tasker
Thank you for pointing me in the right direction.  Mine is now corrected to ...

If %TestData ~ \%new_val
Variable Set %TestData to *​
End If

... Thom
Reply all
Reply to author
Forward
0 new messages