Jump to content

Adlibenable Run Files At Time Intervals..


Recommended Posts

I can I get this to run notepad every 200 ms, mspaint every 600 ms, and wordpad every 2000ms, I dont know but wordpad.exe is the only one that is run..

AdlibEnable("note",200)
AdlibEnable("mspaint",600)
AdlibEnable("wordpad",2000)

Func note()
run("notepad.exe")
EndFunc

Func mspaint()
run("mspaint.exe")
EndFunc

Func wordpad()
run("C:\Program Files\Windows NT\Accessories\wordpad.exe")
EndFunc

while 1
sleep(100)
WEnd
Link to comment
Share on other sites

AdlibEnable is a one at a time event. Trying to run 3 AdlibEnables is not going to happen, so AutoIt sees the last one and runs that.

so this is the only possible way?

AdlibEnable("note",200)

Func note()
run("notepad.exe")
sleep(200)
run("mspaint.exe")
sleep(600)
run("C:\Program Files\Windows NT\Accessories\wordpad.exe")
sleep(2000)
EndFunc

while 1
sleep(100)
WEnd

I tried using the do/for functions I dont even know how to use them :)

for $s_note = 200 To 1 step -1

Next

for $s_paint = 200 To 1 step -1

Next

for $s_word = 200 To 1 step -1

Next

Link to comment
Share on other sites

  • Moderators

I have no idea if this will work (requires beta), but you can give it a shot

Local $Timer[4] = ['', TimerInit(), TimerInit(), TimerInit()]

While 1
    If TimerDiff($Timer[1]) / 1000 >= .2 Then 
        note()
        $Timer[1] = TimerInit()
    EndIf
    If TimerDiff($Timer[2]) / 1000 >= .6 Then
        mspaint()
        $Timer[2] = TimerInit()
    EndIf
    If TimerDiff($Timer[3]) / 1000 >= 2 Then
        wordpad()
        $Timer[3] = TimerInit()
    EndIf
    Sleep(10)
WEnd


Func note()
    Run('notepad.exe')
EndFunc

Func mspaint()
    Run('mspaint.exe')
EndFunc

Func wordpad()
    Run("C:\Program Files\Windows NT\Accessories\wordpad.exe")
EndFunc
Edit... added your functions

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