Page 1 of 1
Bring Calculator window to top
Posted: 05 May 2020, 13:43
by cnwinger
I am using AHK to solve the Win10 issue where every time I hit the calcualtor button on my keyboard, a new calcualtor instance opens up.
The AHK code I have works to limit Win10 to a single instance of calculator.exe, but fails to bring it to the top in front of other windows unless I hit the button 2 times. The "WinActivate" command works if calc is already open, but not when opening it for the first time. Is there an easy way to fix this?
IfWinExist Calculator
WinActivate
else
Run calculator://
WinActivate calculator
return
Re: Bring Calculator window to top
Posted: 05 May 2020, 15:10
by hasantr
cnwinger wrote: ↑05 May 2020, 13:43
I am using AHK to solve the Win10 issue where every time I hit the calcualtor button on my keyboard, a new calcualtor instance opens up.
The AHK code I have works to limit Win10 to a single instance of calculator.exe, but fails to bring it to the top in front of other windows unless I hit the button 2 times. The "WinActivate" command works if calc is already open, but not when opening it for the first time. Is there an easy way to fix this?
IfWinExist Calculator
WinActivate
else
Run calculator://
WinActivate calculator
return
Code: Select all
IfWinNotExist
Run calculator://
WinActivate calculator
return
Re: Bring Calculator window to top
Posted: 05 May 2020, 15:58
by cnwinger
hasantr wrote: ↑05 May 2020, 15:10
cnwinger wrote: ↑05 May 2020, 13:43
I am using AHK to solve the Win10 issue where every time I hit the calcualtor button on my keyboard, a new calcualtor instance opens up.
The AHK code I have works to limit Win10 to a single instance of calculator.exe, but fails to bring it to the top in front of other windows unless I hit the button 2 times. The "WinActivate" command works if calc is already open, but not when opening it for the first time. Is there an easy way to fix this?
IfWinExist Calculator
WinActivate
else
Run calculator://
WinActivate calculator
return
Code: Select all
IfWinNotExist
Run calculator://
WinActivate calculator
return
Thank you, but this code doesn't fix the original problem in Windows10 as far as I can tell - I end up with multiple instances of the calculator button if I press the calculator button (that is linked to the .ahk) multiple times.
Re: Bring Calculator window to top Topic is solved
Posted: 05 May 2020, 16:21
by hasantr
cnwinger wrote: ↑05 May 2020, 15:58
hasantr wrote: ↑05 May 2020, 15:10
cnwinger wrote: ↑05 May 2020, 13:43
I am using AHK to solve the Win10 issue where every time I hit the calcualtor button on my keyboard, a new calcualtor instance opens up.
The AHK code I have works to limit Win10 to a single instance of calculator.exe, but fails to bring it to the top in front of other windows unless I hit the button 2 times. The "WinActivate" command works if calc is already open, but not when opening it for the first time. Is there an easy way to fix this?
IfWinExist Calculator
WinActivate
else
Run calculator://
WinActivate calculator
return
Code: Select all
IfWinNotExist
Run calculator://
WinActivate calculator
return
Thank you, but this code doesn't fix the original problem in Windows10 as far as I can tell - I end up with multiple instances of the calculator button if I press the calculator button (that is linked to the .ahk) multiple times.
Ahh sorry.
Code: Select all
IfWinNotExist Calculator
Run calculator://
WinActivate calculator
return
Re: Bring Calculator window to top
Posted: 06 May 2020, 14:19
by cnwinger
Working great. Thanks!
Re: Bring Calculator window to top
Posted: 14 May 2020, 17:46
by cnwinger
Having the same issue with this new code in Win10. For some reason the calc window isn't brought to the top - it just flashes orange in the taskbar. no matter how many times I press the button tied to the autohotkey script. It always seems to be under my current window - so if I minimize my active window, it's there on top of all my other windows.
Is there some reason this is happening?
Re: Bring Calculator window to top
Posted: 14 May 2020, 18:22
by GEV
Code: Select all
IfWinNotExist Calculator
Run calculator://
; WinWait Calculator, , 3
; If not ErrorLevel
WinActivate Calculator
Re: Bring Calculator window to top
Posted: 14 May 2020, 18:42
by cnwinger
GEV wrote: ↑14 May 2020, 18:22
Code: Select all
IfWinNotExist Calculator
Run calculator://
; WinWait Calculator, , 3
; If not ErrorLevel
WinActivate Calculator
Thanks...Same issue though. I think I have narrowed this down - it seems to only happen with Firefox. Calc on top -> close Calc -> switch to another Firefox tab -> open Calc. Calc is not brought to the front. It always stays under Firefox if I have switched to a different tab before opening Calc. No idea what is causing this. Possibly a Firefox about:config setting?
Re: Bring Calculator window to top
Posted: 14 May 2020, 18:53
by GEV
It doesn't happen to me with Firefox.
Re: Bring Calculator window to top
Posted: 14 May 2020, 18:57
by gregster
it seems to only happen with Firefox
Do you have a tab open in Firefox with
Calculator in its
wintitle (like
this topic, along with
SetTitleMatchMode 2 probably) when this happens?
That would explain it.