Advertisement
Guest User

JS

a guest
May 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //this part parses the JSON generated by the HTTP Get action in Tasker. Use the URL/instructions I mentioned above.
  2. var arr = [];
  3. arr = JSON.parse(global("HTTPD"));
  4.  
  5. //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 :^)
  6. var task1content = arr[0].content;
  7. var task1labelno = arr[0].labels[0];
  8.  
  9. //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.
  10. if (arr[5] !== undefined) {
  11. var task6content = arr[5].content;
  12. var task6labelno = arr[5].labels[0];
  13. }
  14.  
  15. //example of the setup for each task's label
  16. var task1label;
  17.  
  18. //example of how I defined each label to be either "home", "drawing", "general", or "school". Do this for each task
  19. switch (task1labelno) {
  20.     case 511773:
  21.         task1label = 'home';
  22.         break;
  23.     case 511768:
  24.         task1label = 'drawing';
  25.         break;
  26.     case 511772:
  27.         task1label = 'general';
  28.         break;
  29.     case 511771:
  30.         task1label = 'school';
  31.         break;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement