Sign in to follow this  
Followers 0
edy

Run a program for a determined time

12 posts in this topic

How can i , with autoit, run a program or a batc file for a determined time ?

Thanks

Regards

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

is there some reason you can't use task manager?

( edit: I think he means Task Scheduler )

Edited by Larry

Jay

Share this post


Link to post
Share on other sites

$st=StringSplit(inputbox("Run at the start time","Please Input start time!"),":")

;test input you want time like "2004:08:25:08:27:05"

;note,"2004:8:25:8:27:5" can't start

;start time year=2004,month=08,day=25,hour=08,min=27,sec=05

do

Until @YEAR=$st[1] and @MON=$st[2] and @MDAY=$st[3] and @hour=$st[4] and @min=$st[5] and @SEC=$st[6]

MsgBox(0,"Time is right","now current time= " & @YEAR & ":" & @MON & ":" & @MDAY & ":" & @hour & ":" & @min & ":" & @SEC)

Share this post


Link to post
Share on other sites

is there some reason you can't use task manager?

( edit: I think he means Task Scheduler )

<{POST_SNAPBACK}>

This post has been edited by Larry: Today, 07:36 PM
Ahhh The ghost of Larry has returned :ph34r:

Does that count as a post for Larry??


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites

My english is very poor,

my question is : when a program or batch file run it must run for example

2 hours then finish.

Thanks

Share this post


Link to post
Share on other sites

where r u from?

You can count the time from the program run, after 2 hour close the program.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

$begin = TimerInit()
run("")
do
$dif = TimerDiff($begin)
until $dif>7200000
winclose()

Edited by konan

Share this post


Link to post
Share on other sites

Take a look at the sleep function. This takes a lot less CPU time than the tight-loop methods.

Sleep(7200000)

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

My problem is:

I must start at the same time various ping continues (dos schell) then I must close them after a sure time. How to distinguish the various id to close them?

Thanks

Share this post


Link to post
Share on other sites

What about something like:

$proc1=Run("Ping www.hiddensoft.com")
$proc2=Run("Ping www.exn.com")
While ProcessExists($proc1) and ProcessExists($Proc2)
   sleep(10000); wait 10 seconds
Wend
' Do whatever needed to clean up

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

What about something like:

$proc1=Run("Ping www.hiddensoft.com")
$proc2=Run("Ping www.exn.com")
While ProcessExists($proc1) and ProcessExists($Proc2)
   sleep(10000); wait 10 seconds
Wend
' Do whatever needed to clean up

<{POST_SNAPBACK}>

Thanks now Work with the following change:

$proc1=Run("Ping 10.199.181.1  -t ")
$proc2=Run("Ping 10.199.181.2 -t ")
   sleep(10000); wait 10 seconds
if ProcessExists($proc1) Then   ProcessClose ($proc1)

If ProcessExists($proc2) Then   ProcessClose ($proc2)

Share this post


Link to post
Share on other sites

Dave if your going to do a while processexists can't you just

ProcessWaitClose ( "process" [, timeout] )

Rick

What about something like:

$proc1=Run("Ping www.hiddensoft.com")
$proc2=Run("Ping www.exn.com")
While ProcessExists($proc1) and ProcessExists($Proc2)
   sleep(10000); wait 10 seconds
Wend
' Do whatever needed to clean up

<{POST_SNAPBACK}>


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

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  
Followers 0