[SOLVED] - JS for multiplying time

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
zab
Posts: 13
Joined: Fri Jul 31, 2009 12:18 pm

[SOLVED] - JS for multiplying time

Post by zab » Mon May 21, 2012 7:38 pm

I'm using iMacros for automating my clocking in and out of the company timeclock. I'm not always at my computer to do it with the 1 hour lunch alotted (I'm usually working when I should be clocking in). Sadly I've not taken the time to learn JS yet.

I'm trying to setup the code to allow me to set the time with a prompt and then it will wait so many seconds before running the clock in portion of the macro. It works just fine with a set time but I cannot get the calculated time to work.

Here is the offending code.

Code: Select all

'get the time that needs to be used for lunch
'1 = 1 hour 1.5 = 1 and a half and so on
PROMPT "Time to take" !VAR1 1

'set the time to wait based on Var1 and 3600 seconds in an hour
SET !VAR2 EVAL("var P=PareseFloat('{{!VAR1}}'); var T=(P * 3600)-10)")

PROMPT {{!VAR2}}

'set the lunch timer using the number of seconds in an hour times the time I input
WAIT SECONDS={{!VAR2}}
Any ideas?
Last edited by zab on Fri Jan 04, 2013 4:58 pm, edited 1 time in total.
siniy
Posts: 118
Joined: Sat Nov 07, 2009 7:44 pm

Re: HELP - JS for multiplying time

Post by siniy » Sat Jun 02, 2012 9:12 pm

Code: Select all

'get the time that needs to be used for lunch
'1 = 1 hour 1.5 = 1 and a half and so on
PROMPT "Time to take" !VAR1 1

'set the time to wait based on Var1 and 3600 seconds in an hour
SET !VAR2 EVAL("var p=parseFloat(\"{{!VAR1}}\");var t=p*3600 - 10;t")


PROMPT {{!VAR2}}

'set the lunch timer using the number of seconds in an hour times the time I input
WAIT SECONDS={{!VAR2}}
zab
Posts: 13
Joined: Fri Jul 31, 2009 12:18 pm

Re: HELP - JS for multiplying time

Post by zab » Thu Aug 23, 2012 7:15 pm

Been a while since I posted this. Thanks for the answer and it's working beautifully.
Post Reply