AHK not Working on Q-Dir

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kl756y0Bze
Posts: 3
Joined: 16 Jan 2018, 09:39

AHK not Working on Q-Dir

16 Jan 2018, 10:14

My mouse's MButton is set to send !{Up} whenever a file manager app is active.

Code: Select all

#NoEnv
#Persistent
#SingleInstance Force
Process, priority, , High
SendMode, Input
SetTitleMatchMode, 2
DetectHiddenWindows, On

GroupAdd, WinExplorer, ahk_class #32770
GroupAdd, WinExplorer, ahk_class CabinetWClass
GroupAdd, WInExplorer, ahk_class ExploreWClass
GroupAdd, WinExplorer, ahk_class Progman
GroupAdd, WinExplorer, ahk_class ThunderRT6FormDC
GroupAdd, WinExplorer, ahk_class WorkerW
GroupAdd, WinExplorer, ahk_exe explorer.exe
GroupAdd, WinExplorer, ahk_exe Q-Dir.exe
GroupAdd, WinExplorer, ahk_exe WinRAR.exe ; ahk_exe Q-Dir.exe

UpOneFolderKey := "~MButton"

Hotkey, IfWinActive, ahk_group WinExplorer
Hotkey, %UpOneFolderKey%, UpOneFolder
Hotkey, IfWinActive

UpOneFolder:
	Send !{Up}
Return
The script works perfectly well except when Q-Dir is the one active.

AHK version: 1.1.27.02 (Unicode 64-bit, AutoHotkeyU64_UIA.exe)
OS: Windows 10 x64
GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: AHK not Working on Q-Dir

16 Jan 2018, 16:11

Try

Code: Select all

UpOneFolder:
	SetKeyDelay 10,1000
	SendEvent {Alt down}{Up down}{Alt Up}{Up Up}
Return
Kl756y0Bze
Posts: 3
Joined: 16 Jan 2018, 09:39

Re: AHK not Working on Q-Dir

16 Jan 2018, 20:35

GEV wrote:Try

Code: Select all

UpOneFolder:
	SetKeyDelay 10,1000
	SendEvent {Alt down}{Up down}{Alt Up}{Up Up}
Return
Thanks.
Works as intended but still not on Q-Dir.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: AHK not Working on Q-Dir

17 Jan 2018, 02:03

Q-Dir is very strange when it comes to acting on fake inputs. I used to use it some time ago, and quite frankly, some things just fail to work consistently while others work fine. This isn't only with ahk either, in fact ahk's sends were the only ones that I could get to work with many of Q-Dirs functions at all.

From memory, the best approach is to use input sendmode (or SendInput) but with forced sleeps to separate the key inputs & hold the keys down (since input mode ignores setkey, but was more reliable than event or play modes). i.e something like:

Code: Select all

SendInput {Alt down}
sleep 200
SendInput {Up down}
sleep 400
SendInput {Up Up}
Sleep 200
SendInput {Alt Up}
I think ControlSend also worked for some things, but bottom line is (and what I remember without a doubt is) some things work then fail then work again while other things don't work at all (and by things, I mean functions/actions within Q-Dir). Also the script will more than likely need to be run as admin as well.

Edit: Also while those sleeps may seem big, they need to be! in fact they may not be big enough for this particular program.
Kl756y0Bze
Posts: 3
Joined: 16 Jan 2018, 09:39

Re: AHK not Working on Q-Dir

17 Jan 2018, 10:06

Noesis wrote:Q-Dir is very strange when it comes to acting on fake inputs. I used to use it some time ago, and quite frankly, some things just fail to work consistently while others work fine. This isn't only with ahk either, in fact ahk's sends were the only ones that I could get to work with many of Q-Dirs functions at all.

From memory, the best approach is to use input sendmode (or SendInput) but with forced sleeps to separate the key inputs & hold the keys down (since input mode ignores setkey, but was more reliable than event or play modes). i.e something like:

Code: Select all

SendInput {Alt down}
sleep 200
SendInput {Up down}
sleep 400
SendInput {Up Up}
Sleep 200
SendInput {Alt Up}
I think ControlSend also worked for some things, but bottom line is (and what I remember without a doubt is) some things work then fail then work again while other things don't work at all (and by things, I mean functions/actions within Q-Dir). Also the script will more than likely need to be run as admin as well.

Edit: Also while those sleeps may seem big, they need to be! in fact they may not be big enough for this particular program.
Been fiddling with Q-Dir for a few days and I gotta say I might have to rely on AHK for the lack of functionalities.
I tried your solution but unfortunately it still won't work with Q-Dir.
Guest

Re: AHK not Working on Q-Dir

17 Jan 2018, 11:16

I see in the Qdir screenshots (I don't use the program) there is a button in the button bars for UP
Can you use ControlClick to click these buttons? If that works consistently you may try to see if you can find the active panel and then calculate or imagesearch the coordinates.

Might work.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: AHK not Working on Q-Dir

18 Jan 2018, 00:48

Also another thing to consider is the use of "Alt" in my above script.

Didn't realise it at the time but it probably should have been "LAlt" or "RAlt" but not "Alt". Reason being Alt (and other modifiers like ctrl, shift, win) on it's own doesn't always work with all programs, some programs require you tell them exactly which modifier is down & I'd be willing to bet Q-Dir is one of those programs.

Another possibility is it may well be that you're trying to do one of the particular somethings Q-Dir just won't work with. But as suggested above also try controlclick & controlsend. Q-Dir is just the type of program which you will have to try out different ways of doing things and test it to see if it will work. (i.e trial and error is something you'll need to embrace).

I stopped using it quite a while ago (I found it to be unstable at the time) so I can't really test it or anything, only make some suggestions on what may work, which of course also may not work.
User avatar
Cr8zy_Ivan
Posts: 131
Joined: 30 Mar 2019, 18:20

Re: AHK not Working on Q-Dir

05 Feb 2020, 00:02

Small Tweaks to Previous Scripts Suggested. This is what works for me, in every circumstance I've tried it so far.

Code: Select all

^+y::
{
	MouseGetPos,,, WinID
	WinActivate, ahk_id %WinID%
	WinGet, PName, ProcessName, A

	If (PName == "Q-Dir.exe")
	{
		SendInput {LShift Up}
		sleep 200
		SendInput {LCtrl Up}
		sleep 200
	
		SendInput {Ctrl Down}
		sleep 15
		SendInput {n Down}
		sleep 15
		SendInput {n Up}
		Sleep 15
		SendInput {Ctrl Up}
		Return
	}
User avatar
Kellyzkorner_NJ
Posts: 84
Joined: 20 Oct 2017, 18:33

Re: AHK not Working on Q-Dir

29 Aug 2020, 13:36

I figured out a way to make the middle button go "back" which is up a level. In the Extras in bar at top click List View and then Free Space L-Mouse Double-Click and Go To : Up One Level.

Thanks to the original posters that I cobbled this from.

Code: Select all

#If WinExist("Q-Dir 8.71") and MouseIsOver("Q-Dir 8.71") ;  YAY works!! (I imagine just Q-Dir alone would work also).
MButton::

{
	MouseGetPos,,, WinID
	WinActivate, ahk_id %WinID%
	WinGet, PName, ProcessName, A

If (PName == "Q-Dir_x64.exe")
	{
		;Msgbox, Q-Dir there
		WinActivate Q-Dir 8.71
		Click
		Click
		Send {BACKSPACE}
		Reload
		Return
	}
}
Return ;  redundant I know but doesn't hurt

MouseIsOver(WinTitle) {
    MouseGetPos,,, Win
    return WinExist(WinTitle . " ahk_id " . Win)
}
yuko8i61vph0
Posts: 1
Joined: 04 Jul 2021, 00:06

Re: AHK not Working on Q-Dir

04 Jul 2021, 00:13

I also meet the problem, and I can't find the way to solve. But there is a interesting thing that the .ahk works when Keyboard Test Utility is opened.
mars-kr
Posts: 1
Joined: 06 Dec 2021, 19:29

Re: AHK not Working on Q-Dir

06 Dec 2021, 21:24

Thank you so much. Your code blows away lots of my troubles. :bravo:

In the specific app, Q-Dir works faster with the backspace key.

Code: Select all

SendInput {Backspace down}
sleep 400
SendInput {Backspace down}
Noesis wrote:
17 Jan 2018, 02:03
Q-Dir is very strange when it comes to acting on fake inputs. I used to use it some time ago, and quite frankly, some things just fail to work consistently while others work fine. This isn't only with ahk either, in fact ahk's sends were the only ones that I could get to work with many of Q-Dirs functions at all.

From memory, the best approach is to use input sendmode (or SendInput) but with forced sleeps to separate the key inputs & hold the keys down (since input mode ignores setkey, but was more reliable than event or play modes). i.e something like:

Code: Select all

SendInput {Alt down}
sleep 200
SendInput {Up down}
sleep 400
SendInput {Up Up}
Sleep 200
SendInput {Alt Up}
I think ControlSend also worked for some things, but bottom line is (and what I remember without a doubt is) some things work then fail then work again while other things don't work at all (and by things, I mean functions/actions within Q-Dir). Also the script will more than likely need to be run as admin as well.

Edit: Also while those sleeps may seem big, they need to be! in fact they may not be big enough for this particular program.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: imstupidpleshelp, JoeWinograd, mikeyww, Rohwedder, usser and 194 guests