Jump to content

AutoIt3 script doesn't work..


Recommended Posts

Global $Paused, $counter = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "_Terminate")
HotKeySet("{ENTER}", "Begin")

Func Begin()
While 1
    $counter +=1
    MouseClick("right",1835,701)
    ToolTip('Script is "Running"',0,0, $counter, 1)
WEnd
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0, $counter, 1)
    WEnd
    ToolTip("")
EndFunc

Func _Terminate()
    Exit 0
EndFunc

Here is my code. I tried open with F5 or double-click .au3 file or Tools>Go but doesn't works. Here is the output console:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Will\Desktop\TIK.au3"    
>Exit code: 0    Time: 0.04682

 

AutoIt Version v3.3.12.0
SciTE-Lite Version 3.4.1
OS: Windows Ultimate 7 64-Bit SP1

Link to comment
Share on other sites

This will you forgot to call your Begin() function so the script never enters the while loop.

 

Global $Paused, $counter = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "_Terminate")
HotKeySet("{ENTER}", "Begin")

Begin()

Func Begin()
While 1
    $counter +=1
    MouseClick("right",1835,701)
    ToolTip('Script is "Running"',0,0, $counter, 1)
WEnd

EndFunc



Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0, $counter, 1)
    WEnd

    ToolTip("")
EndFunc



Func _Terminate()
    Exit 0
EndFunc

 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

I'm still not that experienced but what does While 1 do?  What I see in the example for "While" is 

Local $i = 0
While $i <= 10
    MsgBox(0, "Value of $i is:", $i)
    $i = $i + 1
WEnd
 

So it seems like While is a conditional statement like if you were to put While $counter <=10 it would do it until your counter equals 10 but I guess I don't understand the statement While 1.

 

 

Link to comment
Share on other sites

Is this version clearer?

While 1 = 1
    ; do
    ; this
    ; and
    ; that
Wend

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

try this

^_^

Global $Paused, $counter = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "_Terminate")
HotKeySet("{ENTER}", "Begin")


While 1
    Sleep(10)
WEnd

Func Begin()
    While 1
        $counter += 1
        MouseClick("right", 1835, 701)
        ToolTip('Script is "Running"', 0, 0, $counter, 1)
    WEnd
EndFunc   ;==>Begin

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0, $counter, 1)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

 

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

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