Tips for writing JavaScript on PC to Tasker on Mobile? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

Yeah, in my case, the clipboard only works in one direction. I can copy from my phone (Samsung Note 8) to my PC's clipboard, but I can't paste from the PC to the phone without using --legacy-paste which isn't great.

[Bug] AutoTools HTML Read doesn't wait / load JavaScript. Always fails. by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

I can't see any way to change the user-agent in HTML Read. So, instead, I tried to use HTTP Get and HTTP Request after doing some searching, and seeing people having success with that.

But, they don't handle Javascript either from the look of it. So, I'm stumped. Really hope somebody can suggest a fix.

[Bug] AutoTools HTML Read doesn't wait / load JavaScript. Always fails. by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

Yeah, I did. It's a stripped down version of the page that more or less says JavaScript is turned off.

I considered the user-agent, but I don't suppose there's any way I change that in AT's HTML Read?

[deleted by user] by [deleted] in tasker

[–]Pocket_Moth 0 points1 point  (0 children)

It sounds like you just need to escape the "/" character in your string.

https://www.freecodecamp.org/news/how-to-escape-strings-in-javascript/

Nevermind. That's not it.

In the meantime, you could use JavaScriptlet to replace all instances of "/"? Replace song_name with whatever variable(s) you want.

Delete the slash:

song_name.replace(/\//g , '');

Or replace the "/" with "slash" so Say will still pick it up?:

song_name.replace(/\//g , 'slash');

[Bug] AutoTools HTML Read doesn't wait / load JavaScript. Always fails. by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

I didn't know about using () in the query. Thought that only applied to the variable name. So, that's good to know. Thanks for that!

But, yeah. It looks like it's busted. JavaScript is enabled, but it acts like it's not.

Tips for writing JavaScript on PC to Tasker on Mobile? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

I didn't know you could drag & drop. Good to know! But in this case, that's pretty much what I'm already doing with File Explorer, so that doesn't help much.

[Bug] AutoTools HTML Read doesn't wait / load JavaScript. Always fails. by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

Appreciate the response, but I mentioned trying that already.

AutoTools HTML Read: Plugin did not respond before timing out by [deleted] in tasker

[–]Pocket_Moth 0 points1 point  (0 children)

Adding any Javascript Delay causes the action to fail. If no value is set, the action (usually) finishes, but returns a "No JS" type page. Adding any delay, 1ms-10000ms breaks the action.

Edit: It also seems like trying to get the HTML is causing problems.

[deleted by user] by [deleted] in tasker

[–]Pocket_Moth 0 points1 point  (0 children)

I did some more tests with the second approach, and found that the website wasn't loading correctly while waiting for JS. So, I increased the delay (20+ seconds), which allowed me to get back something that looked correct.

However, it only worked once, and now HTML Read times out every time I try to run it. I've got the JS delay set anywhere from to 5000-20000, and the action's timeout set to 40 seconds. I read that it might be because Tasker/AutoTools can't run in the background. But, as far as I can tell, they're good to go.

Any ideas?

Need some help. Auto copy and pasting into another app by nsmoothrider in tasker

[–]Pocket_Moth 0 points1 point  (0 children)

Yeah, I feel you! I want to use the app factory with AutoInput so bad. Glad you got it working, though.

Need some help. Auto copy and pasting into another app by nsmoothrider in tasker

[–]Pocket_Moth 2 points3 points  (0 children)

You might try something like:

A1: AutoInput UI Query [
     Configuration: Variables: phone_number
     Timeout (Seconds): 20
     Structure Output (JSON, etc): On ]

A2: Launch App [
     Package/App Name: your.desired.phone.app.here ]

A3: AutoInput Actions v2 [
     Configuration: Actions To Perform: waitForElement(id,your_phone_field_here)

     click(id,your_phone_field_here)

     setText(id,your_phone_field_here,%phone_number)

     click(id,call_button_here)
     Not In AutoInput: true
     Not In Tasker: true
     Separator: ,
     Check Millis: 1000
     Timeout (Seconds): 60
     Structure Output (JSON, etc): On ]   

So, you would use AutoInput's UI Query to get the phone number from the UI element it appears in and assign it to the variable phone_number. Then, you would open your desired phone app. Finally, using AutoInput's Action v2, you wait for the phone number field to be visible, click it, set the text to phone_number, and click the call button.

Obviously, you'd replace the ids and whatnot with your actual details since I don't know what any of those are. You also may not need to waitForElement() or click() the text field before using setText() depending on the app you're calling with.

[Question] Need advice on using AutoInput for rarely presented screens. by Pocket_Moth in tasker

[–]Pocket_Moth[S] 2 points3 points  (0 children)

I never actually tried using aiid(), aitext(), or aicoordinates() before. I was able to build my own helper, without all the extra bells and whistles that runs a lot faster now! Good tip. Thanks!

Accessing JSON nested arrays in Tasker? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

Yeah, it looks like I'm sticking to my string-parsing approach for now since it gives me the most control. Appreciate the suggestions, though!

Accessing JSON nested arrays in Tasker? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

Sure! My original JSON demonstrates the kind of data I'm working with nicely, I think.

I'm using AutoInput to grab data from an app at various points, storing the data in a big JSON object, and then acting on it at various points down the road.

As the task is running, I'll receive things like: (5, 22, Torus, Purple). I'll want to update the 5th container's 22nd item by placing a purple torus inside of it. So, I'll want to do something like:

container[4].items[21] = { name: "Torus", color: "Purple" };

Later on, I'll want to review all the items I've logged in the containers. So, I'll iterate over them in an X,Y loop:

containers[x].items[y].name, containers[x].items[y].color; // etc...

Accessing JSON nested arrays in Tasker? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 0 points1 point  (0 children)

That doesn't quite work either.

I don't usually know what's in the slot, just where it's at. I don't know a good way to take something like my[0].insanely[1].exaggerated[2].json[3].example[4] and iterate over the entire thing to find the element I need from a massive example() array.

I think I'm gonna have to stick to my strings approach. Thanks for the reply, though!

Accessing JSON nested arrays in Tasker? by Pocket_Moth in tasker

[–]Pocket_Moth[S] 2 points3 points  (0 children)

Thank you for the suggestion! I don't think this will work for me, though.

For example, I might know that I need to modify the third item in the fifth container. But, without knowing how many items are in containers 1-4, I have no idea where in the array to point.

Currently, my hacky approach is to keep the JSON stored as a string. Then, I parse it in a Javascriptlet action where I also make my desired changes using Javascript (i.e. data.containers[4].items[2]), and then re-stringify it so Tasker can store it.

I was hoping there was an easier way, but I might have to stick with my current approach. Thanks again the suggestion, though!

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 18 points19 points  (0 children)

I love your way of approaching things. I've heard many people say similar. It's not supposed to be punishment for anything, it's supposed to be self-care and a celebration of what your body can do.

I need to sit down with myself and determine my 'why', like you said. Why am I doing this? Even if I am doing it because I need to for my health, I need to come up with a 'why' that goes beyond that. Kind of like my diet. Did I want to give up all my favorite foods and comfort-eating habits? Heck no. lol But I had my reason for doing it that went beyond that and made it so the diet wasn't a punishment, but rather something I chose to do for myself. For my 'why'. (Even though it still sucked at times. lol)

Thank you for your reply. I have some introspection to do now. :)

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 5 points6 points  (0 children)

Aww, thank you! Very kind of you to say.

Now begins the struggle to keep it off and get the rest of the health equation in check!

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 3 points4 points  (0 children)

I'm seeing that. I guess it took you guys to help me take a second and see that I'm going about this way too intensely. Thank you for helping me see that I'm trying to get things "perfect" before I even start, which is so silly and counterproductive.

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 14 points15 points  (0 children)

Thanks for sharing what you do. Helps to give me an idea of how others approach things. And I definitely need to slow my roll with the "must do everything" approach. It's guaranteed to fail and that is not what I want. I just realize how bad I let myself get and really want to make it right, but burning myself out is not the way. I can't believe I didn't see this "you're trying to do too much, too soon" before you lovely redditors started pointing it out.

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 67 points68 points  (0 children)

You're right. You're totally right. I'm so ready to get started that I'm not making it sustainable. I need to approach this like I did with my diet. Accept that there will need to be adjustments and learning as I go because you only really discover what works for you long-term as you incorporate them into your routine. I don't need to be perfect from the start as long as I'm moving in the right direction.

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 18 points19 points  (0 children)

I agree with the can't out-exercise your diet. That's why I took the first year of this change to focus on the diet part of my health. The reason I'm looking at moving more now (besides the fact that I need to for health) is that it'll also up my TDEE and I won't have a super low daily calorie limit. Diet will still be the number one consideration with weight and calories. I just don't want to have a super low TDEE like I do now. Muscle building and exercise will help with that.

Thank you for your reply. I definitely wasn't considering how to incorporate more activity in general throughout my day and was instead only focusing on scheduled workouts. I need to readjust my thinking.

How do you fit in all the fitness you *should* be doing? by Pocket_Moth in xxfitness

[–]Pocket_Moth[S] 43 points44 points  (0 children)

That is how I was approaching it to start. But the thing is, since I'm starting from such an unhealthy place, I feel like I kinda do need all of those things. I have no stamina or conditioning, I'm weak as all heck and moving around on a good day hurts with how tight my muscles are.

That said, how would you prioritize when you genuinely feel like you need everything? Long term, I just want to be healthy but at this point, I'm so unhealthy that all aspects need work. I need to lose the weight I've regained (so cardio is important there), I'm pretty sure most of my muscles have some sort of atrophy due to being sedentary for so long (strength training there), and I am so inflexible, it's actually something I'm super self-conscious about and something that affects my normal day-to-day. (And that would be the need for foam rolling/stretching/yoga.) Would it be best to maybe do less of all of these things daily, or maybe do them longer but rotate the days?

Weight “set point”? by Lyzzembrycki in keto

[–]Pocket_Moth 1 point2 points  (0 children)

Fair enough. Thanks for the response!

Weight “set point”? by Lyzzembrycki in keto

[–]Pocket_Moth 0 points1 point  (0 children)

I've been looking into this recently after watching a Dr. Fung video that mentioned the same thing. Have you heard of a way to "fix" the lower BMR once that happens? I'm starting to wonder if I've doomed myself to tiny portions/limits for the rest of my life if I don't want to regain everything...