Jump to content

time trouble


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...