Sign in to follow this  
Followers 0
jerrooh

Need help with very simple autoit program

17 posts in this topic

I need/need help with a program that will kill a process every 60 minutes.

Would appreciate all help, thanks

Share this post


Link to post
Share on other sites



I need/need help with a program that will kill a process every 60 minutes.

Would appreciate all help, thanks

welcome to the forum...

Open the helpfile and check:

ProcessClose()

sleep()

while...wend

:D


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

while 1

ProcessClose("process")

sleep()

wend

this closed process down, but dont understand how u enter minutes in sleep()

also this scripts keep going intill I exit it right?

thanks for support and friendly welcome :D

Share this post


Link to post
Share on other sites

while 1

ProcessClose("process")

sleep()

wend

this closed process down, but dont understand how u enter minutes in sleep()

also this scripts keep going intill I exit it right?

thanks for support and friendly welcome :D

Did you look in the Helpfile for the Sleep() command ?

What does it say to specify?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

try this function i cooked up. it uses process close. Simple, but works (i think)

Do like CloseEverySoOften("iexplorer.exe", 5000)

This would close iexplorer.exe every 5 seconds (i think)

Func CloseEverySoOften($program, $time)
While 1
ProcessClose($program)
sleep($time)
WEnd
Endfunc

Share this post


Link to post
Share on other sites

"Sleep(5000) ;five seconds"

So two hours would be 7200000?

so this is correct?

Func CloseEverySoOften(iexplorer.exe, 7200000)

While 1

ProcessClose($program)

sleep($time)

WEnd

Endfunc

Share this post


Link to post
Share on other sites

try this function i cooked up. it uses process close. Simple, but works (i think)

Do like CloseEverySoOften("iexplorer.exe", 5000)

This would close iexplorer.exe every 5 seconds (i think)

Func CloseEverySoOften($program, $time)
While 1
ProcessClose($program)
sleep($time)
WEnd
Endfunc
just a remark: Your function will never return! So where is the point making those few commands a function??

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

while 1

ProcessClose("iexplorer.exe")

;Sleep command takes time in milliseconds.  1 second = 1000 miliseconds
;therefore 1000 * 60 = 1 min and 1min * 60 = 1 hour
sleep(1000 * 60 * 60);you can put a number in here or a math expression, the script will run fine either way

wend

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Try this and you're able to do other things with your script.

$program = 'program.exe' ; set your programname

AdlibEnable('_CloseProgram', 3600000) ; set timer as you want

While 1
    Sleep(100)
    ; do what you want
    ; ExitLoop when ever you want
WEnd

Func _CloseProgram()
    If ProcessExists($program) <> 0 Then ProcessClose($program) 
EndFunc

Don't forget to contact helpfile. :D

Edited by Briegel

Share this post


Link to post
Share on other sites

"Sleep(5000) ;five seconds"

So two hours would be 7200000?

so this is correct?

Func CloseEverySoOften(iexplorer.exe, 7200000)

While 1

ProcessClose($program)

sleep($time)

WEnd

Endfunc

CloseProgramAndWait("iexplore.exe",6000000) ;one hour is 6000000 ms
Func CloseProgramAndWait($name,$microseconds)
While 1
ProcessClose($name)
Sleep($microseconds)
Wend
EndFunc

NOT TESTED

i542


I can do signature me.

Share this post


Link to post
Share on other sites

:D 60*60*1000 = 6000000 ms

Some error in my calculate?

I can do signature me.

Share this post


Link to post
Share on other sites

3660000 ms? :D

Sorry for my stupid error.

i542


I can do signature me.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

3600000? My Calculator can't run.

Func _MsToSeconds($microseconds_EX)
    If StringIsDigit($microseconds_EX) = 0 Then
        Return 0
    Else
    Return $microseconds_EX/1000
EndIf
EndFunc

i542

EDIT: Yeah... I can put it on scripts and scraps....

Edited by i542

I can do signature me.

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