Read Line: Variables in a text file

599 views
Skip to first unread message

James

unread,
Apr 24, 2011, 2:20:31 PM4/24/11
to Tasker
Hi.. I just purchased Tasker (excellent btw!) and am working on a
little project to become familiar with Tasker's functions. What I
have set up is a Script that will say a different phrase whenever I
connect to WIFI.

My script identifies the SSID of the the network and assigns it to the
variable %SSIDN, then using a random variable and "Read Line", it will
pick a line from a text file and send it to the "Say" command.

My text file is this ... don't mind the spelling .. lol .. that's to
make SVOX sound better.
----
why figh, activated. connection to %SSIDN successful.
connection to %SSIDN established.
why figh, enabled.
%SSIDN is now available.
datalink established.
----

So for example, if my SSID is called "My Wifi", and it is reading line
2 from the file, it should say:
"Connection to My Wifi established."

The problem is, that when the "Say" command executes, it doesn't speak
the value of %SSIDN, but instead will say:
"Connection to percent sidden established."

The variable %SSIDN is absolutely declared before the say command
executes, so that isn't the problem.

I have seen variables in a text file before in the example Random
Vacation SMS (http://tasker.wikidot.com/fileproc) .. although very
different, the principal should be the same.

Any thoughts?

Thanks so much! Cheers ...

Pent

unread,
Apr 24, 2011, 2:44:29 PM4/24/11
to Tasker
> The problem is, that when the "Say" command executes, it doesn't speak
> the value of %SSIDN, but instead will say:
> "Connection to percent sidden established."

Variables aren't replaced if no value has been assigned to them (to
reduce false positives).
Try: immediately after you do the variable assignment %SSID -> %SSIDN
do an Alert / Flash
or Alert / Notify with them both included in the test so you can see
what's happening.

Pent

brandall76

unread,
Apr 24, 2011, 6:46:23 PM4/24/11
to Tasker
I couldn't quite work out how you were extracting the SSID, but I have
a task WIFIPREFCON detailed in this thread that does it
http://forum.xda-developers.com/showthread.php?t=1031743 and it works
fine (with speech), so feel free to pinch it.

Reply all
Reply to author
Forward
0 new messages