Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this part parses the JSON generated by the HTTP Get action in Tasker. Use the URL/instructions I mentioned above.
- var arr = [];
- arr = JSON.parse(global("HTTPD"));
- //example of my setup for each task. This is task 1. You'd just do this sequentially for each task. You could probably use a loop to do this more efficiently but I've never been too good at them so :^)
- var task1content = arr[0].content;
- var task1labelno = arr[0].labels[0];
- //since I rarely have over 5 tasks, I did this for tasks 6-10, so that task[n]content and task[n]labelno only are created if they exist.
- if (arr[5] !== undefined) {
- var task6content = arr[5].content;
- var task6labelno = arr[5].labels[0];
- }
- //example of the setup for each task's label
- var task1label;
- //example of how I defined each label to be either "home", "drawing", "general", or "school". Do this for each task
- switch (task1labelno) {
- case 511773:
- task1label = 'home';
- break;
- case 511768:
- task1label = 'drawing';
- break;
- case 511772:
- task1label = 'general';
- break;
- case 511771:
- task1label = 'school';
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement