Jump to content

Retain Original Hotkey Function


 Share

Recommended Posts

If I assign a TestFunc() hotkey to the letter "X", whenever I press X it will block X from sending and run TestFunc(). I require AutoIt to run TestFunc() and allow X to retain its original functionality.

Simply adding Send("X") inside TestFunc() would not work as I need it to send X as it is usually sent, for example if I were to hold down X it would hold down X.

 

The reason for this is that I want another key to be tapped once every time I press down on X, but don't want to hinder X's functionality. I have been incapable of finding a solution to this issue, and would like any useful help that anyone could provide.

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

HotKeySet("{ESC}", "_Exit")
Func _exit()
    Exit
EndFunc

HotKeySet("x", "_Testfunc")
Func _Testfunc()
    HotKeySet("x")    ; disable hotkey
    Send("x")
    Send("  tapping my other keys and xxx again  ")
    HotKeySet("x", "_Testfunc")  ; reenable hotkey

EndFunc   ;==>_Testfunc

While 1
    Sleep(1000)
WEnd
#cs

Place cursor after this line and press F5

x  tapping my other keys and xxx again  

#ce

 

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

If you are using a GUI, you could use GUISetAccellerators instead of hotkey, that way the hotkey will only work when your GUI is the active window. The other thing you could do is to add an accelerator key, like CTRL or ALT or a combination of keys to the hotkey, one that's not used elsewhere.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

HotKeySet("x", "_Dummy")

Func _Dummy()
    GUICtrlSendToDummy($idUser, 1)
EndFunc   ;==>_Dummy

 

With that you can attach any added combo keys to your main "X" hotkey by using  "switch  _IsPressed () cases" under the $idUser case in your main loop

Try looking at this example for even more play combinations .. it looks tricky at first, but easy to work with once you will be able test it through.

Deye

Link to comment
Share on other sites

@Puls3 Solution provided by @Exit will work, but there will be kind of a long delay (like 100ms) before the key is actually sent the application it is aimed for. It may not work as good as you would expect.  So I was wondering what kind of application you intend to automate this way ?  There is probably a better approach you could use to achieve the same goal...

Link to comment
Share on other sites

@Deye HotKeySet "captures the key-press and does not pass it on to the active application", wouldn't using HotKeySet cause the same problem I'm trying to circumvent?

@Nine I fail to understand what you are asking when you ask what kind of application, I intend it to send to the active application as any standard key press would.

@BrewManNH While I thank you for your answer, I unfortunately require this to work on multiple different applications in which I don't believe would work with this function.

 

Is there not a way to make the HotKeySet function not attempt to block the key from getting passed? I was stumped as to why this issue wasn't addressed in the documentation as I could see many implementations when this would be rather useful.

The primary issue I face, and the reason as to why I'm not just putting Send("X") in my function is I need key hold functionality to remain the same, which Send("X") would completely remove.

Edited by Puls3
Further Clarification

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

7 minutes ago, Puls3 said:

I fail to understand what you are asking when you ask what kind of application

Let me rephrase my question, why do you need to intercept the key presses and still send it to applications.  Because it looks like some sort of Keylogger, no ?

Link to comment
Share on other sites

@Nine Indeed, it may seem as though I'm attempting to develop a script with malicious intent, but I'm hoping you will give me the benefit of the doubt, as we both know there is nothing I can say that will change that. However, despite this, I will truthfully state that I intend to use this entirely for personal use on my computer, while I alone am using it.

 

To answer your question, I require the ability to tap another key the moment I press the X key while retaining all of X's original functionality, as I stated above in my original post. If you are able to discover a solution to my issue, I would be extremely grateful.

Edited by Puls3
Fixing The Post

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

  • Moderators

Puls3,

Quote

but I'm hoping you will give me the benefit of the doubt

Nine might well do so, but I am not so inclined. Any code posted here is freely available to anyone else, whose intentions might well be less "honourable" than yours. So please explain exactly why you need this functionality.

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

 

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

@Melba23 Inside Bethesda's Creation Kit, GECK, and Construction Set, in order to enable / disable specific things (eg. lighting or movement frames) you are required to push two keys at once to get extended functionality. It is the same with other programs I use such as Davinci Resolve, which is why I need it to not send to any specific application, and just send as a normal key.

Needless to say I often find need of functionality such of this, and like any sane person with the need to save time (and mental health), I decided to make a script to fit my needs but was incapable of finding anything about this specific functionality in the documentation, which was shocking as it is what has been demanded from a large portion of key bind programs for quite a while.

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

  • Moderators

Puls3,

Using game software as an example does little to help your case - before you post again I suggest you read the Forum rules carefully to understand why.

That aside, why can you not use:

Send("{key1 down}")
Send("{key2 down}")
Send("{key1 up}")
Send("{key1 up}")

which would seem to fit your particular requirement to have multiple keys pressed at one time. And this is clearly explained in the Help file page for Send - rather shocking you could not find it for yourself.

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

It's not game software, it's Modification Software / Render Editing Software and video editing software, by that logic a text editor is inherently game software as it is used to develop a game. To further clarify, the Creation Kit is a modification software for single-player offline games created by the developers of those games. However this modification software itself is on its own an advanced version of the Koda GUI editor for AutoIt mixed with a paint program and Blender, as these could also be used to develop aspects of games just as much as the Creation Kit.

There is a render field inside the Creation Kit which requires you to hold down a key in order to move your creation and modify the size of it to ensure alignment is correct. Which is the primary reason I wanted this script.

Edited by Puls3

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

While I was unable to find this functionality in AutoIt, I did find it rather easily in AutoHotkey. The answer was simple, the ~ key.

~x::N

In the example above (using AutoHotkey) the x button will also press the uppercase N button while not hindering x whatsoever. To press x in a text editor will display "xN".

I'm aware this is an AutoIt forum but I simply wished to share my solution, if a little unorthodox.

 

I hope you all have a swell evening!

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

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