parse html file in tasker

426 views
Skip to first unread message

Rudra Banerjee

unread,
Oct 27, 2014, 5:14:12 AM10/27/14
to tas...@googlegroups.com
Hi,
I have a bunch of small html file that I want to parse via tasker:
Sample html:

<!DOCTYPE html>
<html>
<head>
<style>
dt {
 color: rgb(255,0,0)
}
dd {
  color: rgb(0,0,255)
}
</style>
</head>
<body>
<dl>
<dt>Space Group</dt>
<dd></dd>
<dt>Plane Group</dt>
<dd>Write the results ASAP</dd>
</dl>
</body>
</html>

and I want to parse what is inside the <dt>and </dt>. So I tried:
Parse (45)
A1: Read File [ File:Android/data/com.dropbox.android/files/u46826766/scratch/ToDo/Work.html To Var:%elements ]
A2: Variable Split [ Name:%title Splitter:<dt> Delete Base:On ]
A3: Flash [ Text:%title Long:Off ]

but its not working, i.e. A3 is not flashing any data while I expect it to flash "Space Group" and "Plane Group".

Kindly help.

Pent

unread,
Oct 27, 2014, 5:24:12 AM10/27/14
to tas...@googlegroups.com
Try Menu / More / Run Log.

Also enable Menu / Prefs / Misc / Popup Errors/Warnings

Pent

Rich D

unread,
Oct 27, 2014, 5:40:36 AM10/27/14
to Tasker Google Groups Post


> Parse (45)
> A1: Read File [ File:Android/data/com.dropbox.android/files/u46826766/scratch/ToDo/Work.html To Var:%elements ]
> A2: Variable Split [ Name:%title

// this should be %elements //

Splitter:<dt> Delete Base:On ]
> A3: Flash [ Text:%title

// you need to flash the 'array' %elements(:)//

Long:Off ]

Rudra Banerjee

unread,
Oct 27, 2014, 6:03:50 AM10/27/14
to tas...@googlegroups.com
Hi Rich D,
Thanks for your reply.
Your suggestion is working fine, except the fact that it is reading everything between  2 <dd> as elements(:).
So, from that html, I am getting 
"Space Group</dt>
<dd></dd>" 
as elements(2) 
I have tried:
Parse (45)
A1: Read File [ File:Android/data/com.dropbox.android/files/u46826766/scratch/ToDo/Work.html To Var:%elements ]
A2: Variable Split [ Name:%elements Splitter:<dt> Delete Base:On ]
A3: Variable Split [ Name:%elements Splitter:</dt> Delete Base:On ]
A4: Flash [ Text:%elements(2:3 ) Long:Off ]

with the hope of extracting the value between them...but thats not working either.
I am getting error (Thanks Pents for suggesting popup warning on):
"can't split unset variables %elements."

I understand A3 will try to parse what is after </dt> not before that. But dont know how to parse between them.

Rich D

unread,
Oct 27, 2014, 6:28:40 AM10/27/14
to Tasker Google Groups Post

Try..

> Parse (45)
> A1: Read File [ File:Android/data/com.dropbox.android/files/u46826766/scratch/ToDo/Work.html To Var:%elements ]
> A2: Variable Split [ Name:%elements Splitter:<dt> Delete Base:On ]

//
> A3: Variable Split [ Name:%elements(2) Splitter:</dt> Delete Base:On ]
//

//
> A4: Flash [ Text:%elements(21 ) Long:Off ]
>//

Rudra Banerjee

unread,
Oct 27, 2014, 7:29:00 AM10/27/14
to tas...@googlegroups.com
Rich D,
Thanks a lot!
Done!
Reply all
Reply to author
Forward
0 new messages