Sign in to follow this  
Followers 0
stig90

HotKeySet

28 posts in this topic

im pretty new to autoit used some other programs like it in the past but it's been along time im having problems getting the HotKeySet command to work and i can't figure out what im doing wrong i tried setting up the script on just a continuous loop to make sure it would work and it did but when i introduce HotKeySet into the script nothing here is the script dont laugh at it's feebleness i just started ^.^

----------------------------------------------------------------------------------------------------------------------------------------------------------------

HotKeySet( "{q}" , "_runag" )
    
Func _runag()
        Send( "{T}" )
        Sleep( 100 )
        MouseMove( 306,150 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 385, 454 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        Sleep( 100 )
        MouseMove( 534, 456 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 1000 )
        Send( "{T}" )
        Sleep( 100 )
        Send( "{E}" )
        Sleep( 100 )
        MouseMove( 744, 176 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 740, 450 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        MouseMove( 963, 452 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 5000 )   
EndFunc

While 1
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Copy and paste this under the HotKeySet():

While 1

Sleep(100)

WEnd

What it does is keep your script alive so you can use the function

Edited by pieeater

[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

yea i tried that as well the script is staying alive it just wont run the function i will try again though and post results here

Share this post


Link to post
Share on other sites

stig90,

You have un-needed { } around the "key" parameter. :)

This works for me: :mellow:

HotKeySet("q", "_runag")

While 1
    Sleep(10)
WEnd

Func _runAg()
    ConsoleWrite("Hit" & @CRLF)
EndFunc

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

new script still nothing

HotKeySet( "{q}" , "_runag" )
While 1
Sleep( 100 )
WEnd   
Func _runag()
        Send( "{T}" )
        Sleep( 100 )
        MouseMove( 306,150 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 385, 454 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        Sleep( 100 )
        MouseMove( 534, 456 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 1000 )
        Send( "{T}" )
        Sleep( 100 )
        Send( "{E}" )
        Sleep( 100 )
        MouseMove( 744, 176 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 740, 450 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        MouseMove( 963, 452 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 5000 )   
EndFunc

edited to be less huge and annoying since i forgot the [autoit] part on the coding

Edited by stig90

Share this post


Link to post
Share on other sites

lol made that previous post b4 i saw melba23's ill try that out and see what the results are

Share this post


Link to post
Share on other sites

stig90,

Read my post above! :mellow:

M23

P.S. When you post code please use Code tags. Put [autoit] before and [/autoit] after your posted code.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

HotKeySet( "q" , "_runag" )

While 1
Sleep( 100 )    
WEnd

Func _runag()
        Send( "{T}" )
        Sleep( 100 )
        MouseMove( 306,150 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 385, 454 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        Sleep( 100 )
        MouseMove( 534, 456 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 1000 )
        Send( "{T}" )
        Sleep( 100 )
        Send( "{E}" )
        Sleep( 100 )
        MouseMove( 744, 176 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        MouseMove( 740, 450 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 100 )
        Send( "{Backspace}" )
        Sleep( 100 )
        Send( "{5}" )
        Send( "{0}" )
        Send( "{0}" )
        MouseMove( 963, 452 )
        Sleep( 100 )
        MouseClick( "Left" )
        Sleep( 5000 )   
EndFunc

still nothing

Share this post


Link to post
Share on other sites

stig90,

If you run the exact script I posted - do you get the "Hit" in the SciTE console? That will show if the code works (and it does for me). :mellow:

What are you trying to automate with this script? Perhaps it is that app which is resisting the automation - not your script failing. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

ur script doesn't work for me as well notta it's a knockoff of mysql for college just trying to do mindless tasks without me having to do them ^.^

Edited by stig90

Share this post


Link to post
Share on other sites

stig90,

If pressing the "q" key with that script running does not fire the function then there is something wrong. Do you by chance have a previous instance of the script already running and so blocking the "q" key? :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

nope tbh i used autoit in the past along with some different programs like it and i vaguely remember hotkeyset working but since ive redownloaded autoit havn't been able to get it to work i can run the script once or set it on an infinite loop and it will work fine

Edited by stig90

Share this post


Link to post
Share on other sites

stig90,

Please run this:

$iRet = HotKeySet("q", "fred")

If $iRet Then
    MsgBox(0, "HotKey", "has been SET")
Else
    MsgBox(0, "HotKey", "has NOT been SET")
EndIf

Func fred()
EndFunc

Perhaps you already have something blocking the "q" key from being set by AutoIt. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

MsgBox = has been set

Share this post


Link to post
Share on other sites

stig90,

So try this: :mellow:

HotKeySet("q", "fred")

While 1
    Sleep(10)
WEnd

Func fred()
    MsgBox(0, "HotKey", "Pressed")
    Exit
EndFunc

Having fun? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

worked pretty cool way of using autoit to problem solve something within autoit i have alot to learn lol

Share this post


Link to post
Share on other sites

stig90,

i have alot to learn

So did we all at the beginning! :)

And do not get discouraged - you can get lots of help here if you show some effort. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

well i hope on my first post i showed at least a glimpse of effort

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

mm... hi! :)

I also encountered this problem.

for this code, the result is "has been set".

$iRet = HotKeySet("q", "fred")
 
If $iRet Then
    MsgBox(0, "HotKey", "has been SET")
Else
    MsgBox(0, "HotKey", "has NOT been SET")
EndIf
 
Func fred()
EndFunc

and for this

HotKeySet("q", "fred")
 
While 1
    Sleep(10)
WEnd
 
Func fred()
    MsgBox(0, "q", "Pressed")
    Exit
EndFunc

nothing

but keys like space or escape are read correctly

please help me :mellow:

Edited by fosder

Share this post


Link to post
Share on other sites

fosder,

Your second snippet works perfectly for me. Are you saying that you do not get a MsgBox? :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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