Sign in to follow this  
Followers 0
Mew

Please help with end

7 posts in this topic

Dear all, I am very new to autoit3 and all the knowledge that I got from autoit 1 is completely useless nowadays.....cry

I want to see if anyone will be able to help me with this very simple script.

I created this loop mouse movement and clicking script that will go on indifinitly but I have no idea how to terminate it by pressing any button.

If anyone can help me with this?

What I want to do is to end this script by pressing a button, pause, esc....any button works for me.

here is the script:

For $i = 0 to Step -0

MouseMove(476, 32)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(300, 200)

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

Sleep(1000)

Next

Func Pause()

Global $PAUSED

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

EndFunc ;==>Pause

Func TogglePause()

$PAUSED = Not $PAUSED

While $PAUSED

Sleep(100)

ToolTip('Script est en "Pause"', 0, 0)

Wend

ToolTip("")

EndFunc ;==>TogglePause

Func Terminate()

While 1

Local $x = Pause()

$X = Pause()

If $X = 1 Then ExitLoop

Sleep(10)

SplashOff()

GUISetControlEx($PROGRESS_1, 0)

Wend

EndFunc ;==>Terminate

Func EnableHotKeys()

HotKeySet("^a", "SelectAll")

EndFunc ;==>EnableHotKeys

Share this post


Link to post
Share on other sites



Why doesn't your Terminate() function call:

Exit
?

I would recommend setting hotkeys at the top, and do something like the following to get an exit...

HotKeySet("^!x", "_TerminateApp") ;CTRL+ALT+x

Func _TerminateApp()
    Exit
EndFunc

I hope this helps some,

Jarvis


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Please see what is wrong with my script because it just won't stop with pressing Ctrl Alt and X....

THanks

Share this post


Link to post
Share on other sites

Please see what is wrong with my script because it just won't stop with pressing Ctrl Alt and X....

THanks

Worked fine for me. Closed out perfectly.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This is exactly what I have in my code, and it works fine. I will include the Pause function as well if you want that functionality.

HotKeySet("{PAUSE}", "_PauseApp")
HotKeySet("^!x", "_TerminateApp")

While 1
    Sleep(500)
WEnd

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;---*** Define Functions ***---
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Func _TerminateApp()
    Exit
EndFunc

Func _PauseApp()
    $Paused = NOT $Paused
    While $Paused
        Sleep(100)
        TrayTip("Application Paused", "Application has been paused...press the 'pause' button to resume", 20)
    WEnd
    TrayTip("", "", 0)
EndFunc

I just tried it on my system to be 100% positive, and it worked. You should be able to copy the above code simply for testing, and if it doesn't work then there must be something else going on.

Edit01: Are you sure you pressed all three buttons at the same time? CTRL+ALT+x?

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Oops, my bad. You guys are super! I typed Ctrl "SHIFT" and X, LOL at myself.

Thank you so much for your's help!

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