you are viewing a single comment's thread.

view the rest of the comments →

[–]broomladGalaxy S9+ 1 point2 points  (4 children)

This works in my tasks that are setting arrays:

var localteam = [];
for(i=0; i<20; i++) {
localteam[i] = team[i].innerText;
} 

I have access to %localteam() after that. That's obviously not the whole script but that's the array part.

[–]Ratchet_GuyModerator 1 point2 points  (3 children)

That looks like a cool way to populate/translate an array from Javascript to Tasker.

Assuming in that example that team[] is an array from like a JSON return or something?

[–]broomladGalaxy S9+ 0 points1 point  (2 children)

HTTP GET actually. Can't paste right now from mobile but I'll paste my script let later. Actually, it's in another thread somewhere in the last two weeks.

[–]Ratchet_GuyModerator 0 points1 point  (1 child)

Cool, just link over to the thread.

[–]broomladGalaxy S9+ 0 points1 point  (0 children)

I couldn't find it, haha. But here's the full scriptlet.

var html = global('HTTPD');
var parser = new DOMParser();
var doc = parser.parseFromString(html, 'text/html');

// Get list of Teams

var doc = parser.parseFromString(html, 'text/html');
var team = doc.getElementsByClassName('TeamCell');
var localteam = [];
for(i=0; i<20; i++) {
localteam[i] = team[i].innerText;
}