Sign in to follow this  
Followers 0
ZerofeniX

Need assistance with HotKeySet

8 posts in this topic

I'm am trying to create a script that allows me to remap certain key presses. For instance an application I am using does not support shift modifiers as it is souly reserved for another purpose but some hot keys are not effected by the built in shift modifier so I would like to make hotkeys that use shift and perform useful actions for instance

Shift+Z is unusable but I would like to make it so that when Shift+Z is pressed it will send "j" instead. The other problem is that I want this to happen dynamically so I can't simply make a function that will send a j. Any suggestions?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

HotKeySet("+z", "j")

While 1
Sleep(10)
WEnd


Func j()
Send("j")
EndFunc
This should help :)

Edit: Ask a moderator to move your Topic to the GENERAL HELP AND SUPPORT

you will receive more help there

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Yeah, I was hoping someone would have an easier way than simply making functions for each individual key send. Because for what I'm doing I'll have to make one for each key on the key board XD

Share this post


Link to post
Share on other sites

ZerofeniX,

Because for what I'm doing I'll have to make one for each key on the key board

Then do not post the result here - we would consider that script as a basic keylogger and so prohibited by the Forum rules (there is also a link at bottom right of each page). ;)

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)

Thanks, but the purpose of my script is clearly stated in my first post.

Second question,

Say I have this scenario, which shouldn't come up with my script but if it were to happen is there any way around it would knowing what the original hotkey is?

Desired output: press shift+z -> J

Actual Output: press shift+z -> i

HotKeySet("+z", "_j")
HotKeySet("j", "_i")

Func _j()
Send("j")
EndFunc

Func _i()
Send("i")
EndFunc

While(1)
Sleep(10)
WEnd
[
Edited by ZerofeniX

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks, but the purpose of my script is clearly stated in my first post.

.. and your point is what? The statement made still counts and we do not really care about good or bad intentions as there is no way for us to verify either.

The reason for your finding is pretty simple ..... you have an hotkey active at the time you do a Send("j") command.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

ZerofeniX,

Thanks, but the purpose of my script is clearly stated in my first post

I do not care what function your script is supposed to perform - but using HotKeys on the entire keyboard is essentially a keylogger and will be dealt with as such. What I gave you was a friendly warning not to post such a thing here - on your head be it if you do not follow that advice. ;)

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

The reason for your finding is pretty simple ..... you have an hotkey active at the time you do a Send("j") command.

Yes, I understand that, but is there any way to prevent the Send() function from triggering the hotkey without first unregistering the hotkey?

I do not care what function your script is supposed to perform - but using HotKeys on the entire keyboard is essentially a keylogger and will be dealt with as such. What I gave you was a friendly warning not to post such a thing here - on your head be it if you do not follow that advice. ;)

I am aware that a script that HotKeys all the keys on a keyboard would be a keylogger. But, I did not say that I was making HotKeys for the entire keyboard, but functions to send each key on the keyboard, because my script is going to allow you to bind specific key combinations to other keys on the keyboard. It will do this because the shift and ctrl modifiers are reserved by the program I am designing the script for.

Func _a()
Send("a")
EndFunc

Func _b()
Send("b")
EndFunc

...

Func _z()
Send("z")
EndFunc

etc

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