Jump to content
Sign in to follow this  
t1g3r

time trouble

Recommended Posts

t1g3r

hi guys need a push in the right direction i have a script that i wish to run anywere from 2 to 4 hours any time i run it, i want to be able to select the length of time to run it from a drop down menu with 1hour, 1.5hours, 2hours, 2.5hours, 3hours, 3.5hours, and 4hours in then click a start buttom to begin the script, i hope im not asking to much but this time thing seems quit dificult to me. Any help would be amazing.

Share this post


Link to post
Share on other sites
FitzChivalry

what exactly to you mean? do you want the script to repeat itself every x hours, or you want it to run once, and that one run should take x hours?

Share this post


Link to post
Share on other sites
t1g3r

what exactly to you mean? do you want the script to repeat itself every x hours, or you want it to run once, and that one run should take x hours?

yes just to run once for x hours.

Share this post


Link to post
Share on other sites
FitzChivalry

ok. I dont know exactly why you would want to do that, but what i would do is just put a bunch of sleep(1000 * 60 * $time) (1sec * 60 = 1 min, * how many min they want the script to take) throughout my code, probably 10 of them, and then read from the gui whichever time they want, divide that by 10, and set $time equal to that. ie, if they select 2 hrs:

$time = 120/10

code...

sleep(1000 * 60 * $time) (12 min)

code...

sleep(1000 * 60 * $time)

code...

sleep(1000 * 60 * $time)

etc, etc.

OR, you could just have it wait 119 minutes then execute...

this will leave a lot of time where your script is just waiting around doing nothing, but it sounds like that is what you want. hope it helps!

Edited by FitzChivalry

Share this post


Link to post
Share on other sites
PsaltyDS

hi guys need a push in the right direction i have a script that i wish to run anywere from 2 to 4 hours any time i run it, i want to be able to select the length of time to run it from a drop down menu with 1hour, 1.5hours, 2hours, 2.5hours, 3hours, 3.5hours, and 4hours in then click a start buttom to begin the script, i hope im not asking to much but this time thing seems quit dificult to me. Any help would be amazing.

If you want the script to be running and getting things done, but then exit after the timeout:

1. Initialize a timer variable with TimerInit()

2. Set up an AdLibEnable() to periodically check the elapsed time in the background, and Exit when the timeout is reached.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
gsglive

I already have something like that. See www.gsglive.com Games section and then download the Game Folder. The Timer is inside that.

- gsglive


- gsglive

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×