With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Hiroki-H
Posts: 3
Joined: 10 May 2022, 01:51

With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 02:32

Here is a part of my .ahk file below:

Code: Select all

;#E::	Run 'C:\Windows\System32\calc1.exe'
^!E::	Run 'C:\Windows\System32\calc1.exe'
[Mod edit: Added [code][/code] tags.]

When this condition, by pressing Ctrl + Alt + F launches
windows calculator normally and focused to calculator window.

But, when 2nd line comment and 1st line activate,
Win + E launches calc BUT NO FOCUSED TO CALC WINDOW.

Is this on spec of Windows?
My sped is:
Windows 11 Pro 64bit 26217.5000
AutoHotkey Ver. 2.0.14
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 04:00

Welcome to this AutoHotkey forum!

The script that you posted worked here when I used calc.exe instead of calc1.exe. A different script may yield different results, and a different Calculator program may yield different results. Your description refers to a hotkey that is not in your script.

My AHK version is 2.0.15.
Hiroki-H
Posts: 3
Joined: 10 May 2022, 01:51

Re: With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 04:45

Please...
calc1.exe is classical calculator app of Windows I dare to install.
And the problem is not there. calc.exe instead of calc1.exe results SAME.
When Win + E activated, calc is launched but WITHOUT focus.
On the other hand, Ctrl + Alt + E activated, calc is launched WITH focus.
The problem is FOCUS. and kind of app does not matter. Same results.
My AHK version is 2.0.15. Yes, updated. But same.
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 05:43

I reproduced your issue a couple of times and saw it noted in some Windows forums. You could try the following as a workaround. Adjust the WinTitle and program as needed.

Code: Select all

#Requires AutoHotkey v2.0

#e Up::
^!e Up:: {
 Run 'calc'
 If WinWait('Calculator ahk_class ApplicationFrameWindow',, 3)
  WinActivate
 Else MsgBox 'An error occurred while waiting for the window.', 'Error', 'Icon!'
}
Hiroki-H
Posts: 3
Joined: 10 May 2022, 01:51

Re: With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 06:40

Dear mikeyww,
Yes, that's hit it. :bravo:
I modified your script as follows:

Code: Select all

#e Up:: {
 Run 'calc.exe'
 If WinWait('ahk_exe calc.exe',, 3)
 WinActivate "ahk_exe calc.exe"
 Else MsgBox 'An error occurred while waiting for the window.', 'Error', 'Icon!'
}
And error MsgBox is not appeared at all.
Very thanks!!! :dance: :dance: :dance:


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
User avatar
boiler
Posts: 17385
Joined: 21 Dec 2014, 02:44

Re: With keyboard launcher (Run command), Win + key is not focused. Is this on spec of Windows?

22 May 2024, 07:24

@Hiroki-H -- Please put [code][/code] tags around your code when posting code on the forum. Thank you. The moderators have been adding them for you on your prior posts.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: TAC109, vmech and 56 guests