Jump to content

help for a loop


 Share

Recommended Posts

hello i would like this script loop every xx second

;on ferme
WinActivate("SMS-Monitor")
Send("{ALT S}")
Send("{DOWN 2}")
Send("{ENTER}")

;on confirme
WinWaitActive("SMS-Monitor")
Send("{ENTER}")

;on attend 10sec avant de relancer smsmonitor
Sleep(10000)
Run("C:\SMS-Monitor\SMSMntr.exe")

; on attend 30 sec avant de lancer
Sleep(30000)

;clic souris pour lancer le service, pas d'autre solution
MouseClick("left", 452, 68, 1)

I put this at the end but it does not work

While 1
Sleep (50000)
Wend

the time desired for 'sleep' would be in a ini file, is it possible ?

thanks

Link to comment
Share on other sites

Try

While 1
;on ferme
WinActivate("SMS-Monitor")
Send("{ALT S}")
Send("{DOWN 2}")
Send("{ENTER}")

;on confirme
WinWaitActive("SMS-Monitor")
Send("{ENTER}")

;on attend 10sec avant de relancer smsmonitor
Sleep(10000)
Run("C:\SMS-Monitor\SMSMntr.exe")

; on attend 30 sec avant de lancer
Sleep(30000)

;clic souris pour lancer le service, pas d'autre solution
MouseClick("left", 452, 68, 1)

Sleep ( 50000 )
Wend

Edit

I would add a hotkey to exit the script or it will loop forever.

Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Moderators

Dim $Sleep = IniRead('Path to ini', 'Section', 'Key', 'Not Found')

While 1 ; using BigDod's loop example.

Sleep($Sleep)

Edit:

I like Larry's Idea if it is a timed issue, and you can use the ini for that also:

Dim $Reactivate = IniRead('Path to ini', 'Section', 'Key', 'Not Found')

While 1
$time = TimerInit()
;on ferme
    WinActivate("SMS-Monitor")
    Send("{ALT S}")
    Send("{DOWN 2}")
    Send("{ENTER}")
    
;on confirme
    WinWaitActive("SMS-Monitor")
    Send("{ENTER}")
    
;on attend 10sec avant de relancer smsmonitor
    Sleep(10000)
    Run("C:\SMS-Monitor\SMSMntr.exe")
    
; on attend 30 sec avant de lancer
    Sleep(30000)
    
;clic souris pour lancer le service, pas d'autre solution
    MouseClick("left", 452, 68, 1)
    While TimerDiff($time) < $Reactivate; / 1000 allows you to choose seconds / 1000 / 60 is minutes
        Sleep(250)
    WEnd
WEnd
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...