Jump to content

Sending a specific set of keys


kana
 Share

Recommended Posts

Is there anything wrong with this?

HotkeySet("{N}","_func1")

Func _func1()

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

Send ("G")

Sleep(10)

Send("{TAB}")

Sleep(10)

EndFunc

Link to comment
Share on other sites

  • Moderators

kana,

Is there anything wrong with this?

Yes. ;)

- 1. Look again at the syntax for HotKeySet. You only need the { } around the special keys - normal keys do not require them.

- 2. You need something to keep the script active - at the moment you exit immediately. Try adding a While..WEnd loop and exit HotKey like this:

HotKeySet("n", "_func1") ; See the difference?
HotKeySet("{ESC}", "On_Exit")

While 1
    Sleep(10) ; You need this to prevent CPU overload
WEnd

Func On_Exit()
    Exit
EndFunc

Func _func1()
    ; code
EndFunc

All clear? :blink:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Is it case sensitive?

I had

//

While 1

WEnd

at the bottom from the earlier post

//Edited one below but it doesn't work outside of Windows except for chats

HotKeySet("G", "_func1")

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

While 1

Sleep(10)

WEnd

Func On_Exit()

Exit

EndFunc

Func _func1()

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send ("G")

Sleep(100)

Send("{TAB}")

Sleep(100)

EndFunc

Link to comment
Share on other sites

  • Moderators

kana,

Dog eaten your Help file? :blink:

"MouseClick - Perform a mouse click operation.

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )

Parameters

button The button to click

x, y [optional] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

clicks [optional]

speed [optional] "

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Does the keyboard speed matter? It doesn't always do everything in the list.

//

HotKeySet("{INS}", "_func1")
HotKeySet("{ESC}", "On_Exit")
HotKeySet("{DEL}", "_func2")
HotKeySet("{HOME}", "_func3")

While 1
    Sleep(10) 
WEnd

Func On_Exit()
    Exit
EndFunc

Func _func1()
   Send("3")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
   Sleep(10)
   Send("{TAB}")
   Sleep(10)
   Send("G")
EndFunc

Func _func2()
    Send(2)
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
    Sleep(10)
    Send("{TAB}")
    Sleep(10)
    Send("W")
    Sleep(10)
    Mouseclick("left")
EndFunc

Func _func3()
    Send("{DEL}")
    Sleep(360)
    Send("{INS}")
EndFunc
Edited by Jos
added Code tags
Link to comment
Share on other sites

  • Moderators

kana,

Try increasing the Sleep time a bit.

M23

P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. :blink:

And if you could edit your previous posts to use code tags to make the thread shorter that would be really kind of you! ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

kana,

I have no idea as I imagine it depends on the particular system. Have you tried? :blink:

M23

P.S. And are you going to edit your previous posts with code tags to shorten them? ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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