Jump to content

end script with press the right-mouse-button or a letter


Recommended Posts

Hello,

I am try to make my own script and now I need your help.

I want to close my script with a click on the right mouse button or on a letter on my keyboard (for exampe the "q").

Can you give me the right command for this action.

regards,

denjo

Link to comment
Share on other sites

_IsPress()

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Ok, for shortest example and easiest to understand , do like this :

HotKeySet("q","exit")
Func exit()
Exit
EndFunc

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

While 1
HotKeySet("q","exit")
Wend

Func exit()
Exit
EndFunc

I myself don't have any error message with those little simple codes

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

do you use Scite ?

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

can you skip the error message and run the code ?

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

did you run only the code above or you mix it in your currently script ?

can you post here all the codes ?

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

did you run only the code above or you mix it in your currently script ?

can you post here all the codes ?

It's a very easy script and I think it has nothing to do with the other code but here the whole:

MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")

While 1
HotKeySet("q","exit")
Wend

Func exit ()
Exit
EndFunc
Link to comment
Share on other sites

got it, here is the correct

MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")

While 1
HotKeySet("q","_exit")
Wend

Func _exit ()
Exit
EndFunc

it's my fault, i shouldn't declare a function with the same name as a command in autoit

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

got it, here is the correct

MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")

While 1
HotKeySet("q","_exit")
Wend

Func _exit ()
Exit
EndFunc

it's my fault, i shouldn't declare a function with the same name as a command in autoit

yes ok there is no error any more,

but if I press "q" the script doesn't stop working.

Link to comment
Share on other sites

You have to set the hotkey before you start doing the mouse clicks.

EDIT: didn't need the While 1 Wend it was not doing anything

HotKeySet("q","_exit")

MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")

Func _exit ()
Exit
EndFunc
Edited by cartman380
Link to comment
Share on other sites

You have to set the hotkey before you start doing the mouse clicks.

EDIT: didn't need the While 1 Wend it was not doing anything

HotKeySet("q","_exit")

MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")
Sleep(500)
MouseClick("left")

Func _exit ()
Exit
EndFunc
but it doesn't work again, also with your hint of the hotkey
Link to comment
Share on other sites

@catman380

That's NOT True, i run the code i posted and it's ok

you need to put the hotkeyset in a loop , otherwise, it's exit immediately ...

please give advise when you know what you are doing

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

HotKeySet("q","_Terminate")

While 1
    Sleep(10)
WEnd

Func _Terminate()
    Exit
EndFunc

I would rather do this as HotKeySet only need to be set once and not all the time with a loop. Also you can't name your exit function "exit" as that is a predefined command. "_exit" or "_terminate" would be two other suggestions.

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