Jump to content

HotKeySet not working in background


Dado
 Share

Recommended Posts

Good day.

I am new to autoit and I love it so far but I got some issue.

Lets say part of my script compiled into *.exe is like:

HotKeySet("+{F2}", "_F2a_Func")

Func _F2a_Func()
    MsgBox(0, "", "hotkey pressed")
EndFunc ;==>_F2a_Func

While 1
    Sleep(100);idle around
WEnd

Everything is working fine when I just doubleclick it and try the hotkey, but I need to have that hotkey working on background while the other application is active and I am working with it. The thing is, when I try that with other application like video player or photoshop in front - it works, but when I alt-tab to my desired application to work, the hotkey do nothing. Any clues? I have tried to change the hotkey to other combination but no luck.

Link to comment
Share on other sites

well, I thought that was a case too but:

^n (control + n) in mspaint.exe opens dialog prompt to create new file without running my script

I set the hotkey to ^n, ran the script, alt-tab to mspaint, pressed ^n and my msgbox appeared and no dialog prompt popped out - so application (in this case mspaint) did not eat the hotkey even it have that hotkey binded

in my application ( in which I looked up in settings to be sure that ^n hotkey is unset) no msgbox

Link to comment
Share on other sites

I can see why you would think that discounts the possibility, but truth is that applications respond or act differently.

I'd first check to see what other hotkeys your 'desired application' does or does not respond to when active.

I'm no hotkey expert by the way, just thinking literally.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I did. For example 'desired application' do its own thing with just simple keypress of p, c, b, q, and also alt,control and shift combinations such as !q, !w, +r and many more. On the other hand, there is some keypresses and modifier combinations which is not bind. It all can be seen in settings of that application (and also changed).

It do not matter if I set my hotkey in script to allready binded keypress/combination or unbinded. It still do nothing (no msgbox).It seems to me strange because in casual mspaint it works like expected.

Maybe there is a way how to make hotkey 'global' and to work no matter which kind of application is active.

Link to comment
Share on other sites

The thing is, when I try that with other application like video player or photoshop in front - it works, but when I alt-tab to my desired application to work, the hotkey do nothing

 

You see now? ;) Probably you cant recreate cause you dont have that app to try with. Anyway, if it is application fault, I am looking for a workaround.

Link to comment
Share on other sites

  • Moderators

Dado,

And so the problem is almost certainly your "desired application" not respnding to the HotKey. If, as seems very likely given the coy manner in which you refuse to identify the app in question, it is a game of some sort there are probably anti-bot measures in place to prevent you from automating it. And as explained in the Forum rules you will get no help here to find a workaround. :naughty:

If, despite all the signs, it is not a game then please tell us what it is so that we can try and help you. :)

M23

Edited by Melba23
Typo

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

I know forum rules.

:o Despite all signs? It is not a game but in my opinion if it even was a game, it is still not against rules cause I am not trying automate THAT application, I just want to run MY functions in my scripts which do not interact with that 'game' at all. I am not asking for picture position recognition or OCR, mouse moves and automating clicks. I will be doing keypresses on my own, but only need to have that application activated and working in front, while my hotkey activated functions in my script do other for me usefull things (timing and playing short wav files in most cases).

Traktor DJ Studio 3

Link to comment
Share on other sites

  • Moderators

Dado,

That was not so difficult was it? So why the initial reluctance to tell us? It would have saved (both of) my typing fingers from even more wear and tear. ;)

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

You asked, I answered. No one asked stright before you. I just highly doubt somebody owns that software to give it a closer look.

Anyway, do you think it is possible to solve that 'anti-bit measures in place' issues or what do you call it, or am I better off trying something other than autoit?

Link to comment
Share on other sites

  • Moderators

Dado,

Sorry - that should have read "anti-bot measures". And I strongly doubt that a DJ Studio will have them in place - a public heath warning for the damage its output might do to your hearing perhaps, but not anti-bot protection. :D

So I am at a loss as to why this particular app does not like your HotKeys. Perhaps it eats all keys and just actions the ones it recognises while discarding all others. Have you tried using some different key combinations for your app to see if that is indeed the case? :huh:

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

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