Sign in to follow this  
Followers 0
jeanjan

Loop Problem

4 posts in this topic

Hi,

This is my first post then before anything else I would like to thank the author of autoit. It's really a great piece of work.

I already made a lot of scripts with previous versions of autoit, now I'm trying to be familiar with autoit3.

I have a problem with loops.

I want to check if a window exists every 10 miliseconds if yes --> kill it and send a {numlock off} and {numlock on} every 14 minutes (the numlock off/on is for the screensaver doesn't activate)

This is the last version of the code I wrote :

$j=0

Do
; KILL WEBSCANX
$i = 0
For $i = 0 to 84500 Step +1
    If WinExists("WebScanX") Then
    WinKill("WebScanX", "")
    sleep(10)
next

; NUMLOCK
    Send("{NUMLOCK off}")
    Send("{NUMLOCK on}")

Until $j = 10

also tried while/wend but always same kind of error message "x statement with no matching y statement" :

Line 12  (File "C:\Documents and Settings\xxx\Desktop\scanxscreen.au3"):

next

Error: "Next" statement with no matching "For" statement.

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

While 1
   If WinExists("WebScanX") Then
    WinKill("WebScanX", "")
   If WinExists("Screensaver") Then
    WinKill("Screensaver", "")
    sleep(10)
Wend

Edited by sd333221

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Local $Numlock = 1
AdlibEnable( "_NumlockFunc" , 14 * 60 *1000 )
Func _NumlockFunc()
Select
Case $Numlock = 1 
Send( "{numlock off}" )
$Numlock = 0
Case $Numlock = 0
Send("{numlock off}" )
$Numlock = 1
Endselect
EndFunc

While 1
   If WinExists("WebScanX") Then WinKill("WebScanX", "")
   If WinExists("Screensaver") Then
    WinKill("Screensaver", "")
    sleep(10)
   EndIf
Wend

Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

I had to raise the "sleep" because it's too heavy on the cpu.

Thanks a lot guys.

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