%TRUN and Variable Set context

762 views
Skip to first unread message

strictlyrude27

unread,
Sep 21, 2011, 4:35:32 PM9/21/11
to Tasker
I wanted to build a couple Minimalistic Text widgets that contain
active task and profile information. In particular, I have two
profiles for tasks:

PROFILE 1:
Context: Variable Set, %TRUN, *
1) Variable Set: %newline, \n # that's a literal newline, just wrote
it out for purposes of this post
2) Variable Set: %trun, %TRUN
3) Variable Split: %trun, ,
4) Variable Join: %trun, %newline
5) MT settings: set TRUN = %trun

PROFILE 2:
Context: Variable Cleared, %TRUN
1) MT settings: set TRUN = (null)

This executes fine when a task is entered - my widget gets set to the
name(s) of the task(s) running. But once the task exits, the widget
takes the literal value "%TRUN" rather than (null). So %TRUN is not
set, yet it's running the %TRUN-is-set profile rather than the %TRUN-
is-cleared profile.

Any ideas as to what is going on here?

strictlyrude27

unread,
Sep 21, 2011, 4:45:24 PM9/21/11
to Tasker
in other news, you can't set a variable to a literal newline. :/

Pent

unread,
Sep 22, 2011, 4:14:22 AM9/22/11
to Tasker
> Any ideas as to what is going on here?

%TRUN isn't being cleared, it's being set to zero-length.

It shouldn't really come up as %TRUN when it's replaced, but as a
blank. I have an open issue about that. You should test for %TRUN
starting with % (compatible with current Tasker code) or being empty
(Not Matches +) (likely future Tasker code).

Sorry about that...

Pent

Pent

unread,
Sep 22, 2011, 4:16:12 AM9/22/11
to Tasker
> in other news, you can't set a variable to a literal newline. :/

What do you mean by 'literal newline' ?

Pent

strictlyrude27

unread,
Sep 22, 2011, 4:54:02 PM9/22/11
to Tasker
I tried to set %newline = \n (where \n is a newline) - just hit
"ENTER" in the "value" box. It's being displayed as %newline rather
than an actual carriage return.

I get the same issues with %PACTIVE as well. Will try your
recommendations, but I'm pretty busy until Monday.

Pent

unread,
Sep 22, 2011, 4:59:02 PM9/22/11
to Tasker

> I tried to set %newline = \n (where \n is a newline) - just hit
> "ENTER" in the "value" box. It's being displayed as %newline rather
> than an actual carriage return.

Not for me. Are you on a recent version ?

Did you try a Flash, or it's just not working with join ?

Pent

strictlyrude27

unread,
Sep 22, 2011, 5:13:54 PM9/22/11
to Tasker
Not working with Variable Join. I'm running the latest beta. I added
"Flash %newline" to the task, and now the toast notification isn't
going away, either.

Pent

unread,
Sep 23, 2011, 4:16:04 AM9/23/11
to Tasker
> Not working with Variable Join. I'm running the latest beta. I added
> "Flash %newline" to the task, and now the toast notification isn't
> going away, either.

That's interesting, well done :-)

I'll see if I can reproduce that and try the join. I only tested with
other stuff in the Flash so I could see the effect of the newline.

Pent

Rick Nyman

unread,
Sep 25, 2011, 9:04:15 AM9/25/11
to Tasker
I'm also struggling with split and join using a variable as a
separator.

I have some tasks that put a status line at the beginning of an
eventlog using Variable Set %EVENTLOG "%STATUS\n%EVENTLOG", where the
\n is the enter key. In order to keep the eventlog from getting too
long, I'm adding lines at the top and truncating them from the
bottom. I created a %NEWLINE variable with just a return in it. I
then Variable Split the %EVENTLOG variable with %NEWLINE as a
separator, which works. I then Variable Clear %EVENTLOG2+, which
removes the 20th through 29th lines and Variable Join %EVENTLOG with
%NEWLINE as the separator. Tasker interprets %NEWLINE as a string,
not a variable.

Here's an example script:

Task: Test (9)
A1: Variable Set [ Name:%TEST To:This
Is
A
Test
Of
Splitting
And
Joining
Variables
With
Tasker Do Maths:Off Append:Off]
A2: Variable Set [ Name:%NEWLINE To:
Do Maths:Off Append:Off]
A3: Variable Split [ Name:%TEST Splitter:%NEWLINE Delete Base:Off]
A4: Variable Clear [ Name:%TEST1+ Pattern Matching:On]
A5: Variable Join [ Name:%TEST Joiner:%NEWLINE Delete Parts:On]
A6: Flash [ Text:%TEST Long:On]

I expect to see:
This
Is
A
Test
Of
Splitting
And
Joining
Variables

Instead, I get:
This%NEWLINEIs%NEWLINEA%NEWLINETest%NEWLINEOf%NEWLINESplitting
%NEWLINEAnd%NEWLINEJoining%NEWLINEVariables

Is there a workaround?

Thanks,
Rick


On Sep 23, 4:16 am, Pent <supp...@apps.dinglisch.net> wrote:
> > Not working withVariableJoin. I'm running the latest beta. I added
> > "Flash %newline" to the task, and now the toast notification isn't
> > going away, either.
>
> That's interesting, well done :-)
>
> I'll see if I can reproduce that and try thejoin. I only tested with

Pent

unread,
Sep 27, 2011, 8:07:56 AM9/27/11
to Tasker
> I'm also struggling with split and join using a variable as a
> separator.

I discovered that variable values in the Joiner field weren't being
replaced. Fixed for next time. I also tested it with a variable with a
newline and it worked OK.

strictly: I still can't reproduce any problems with Flash related to
%newline. Also, if your toast is not going away you're probably in a
loop ?

Pent

strictlyrude27

unread,
Sep 27, 2011, 4:41:03 PM9/27/11
to Tasker
This might have been a one-time thing; I haven't tried since then..

Pent

unread,
Sep 28, 2011, 5:01:16 AM9/28/11
to Tasker
Well the joiner should be working in b8 anyway.

Pent
Reply all
Reply to author
Forward
0 new messages