Bring Calculator window to top Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
cnwinger
Posts: 5
Joined: 05 May 2020, 13:33

Bring Calculator window to top

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
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Bring Calculator window to top

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
cnwinger
Posts: 5
Joined: 05 May 2020, 13:33

Re: Bring Calculator window to top

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.
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Bring Calculator window to top  Topic is solved

05 May 2020, 16:21

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
cnwinger
Posts: 5
Joined: 05 May 2020, 13:33

Re: Bring Calculator window to top

06 May 2020, 14:19

Working great. Thanks!
cnwinger
Posts: 5
Joined: 05 May 2020, 13:33

Re: Bring Calculator window to top

14 May 2020, 17:46

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?
GEV
Posts: 844
Joined: 25 Feb 2014, 00:50

Re: Bring Calculator window to top

14 May 2020, 18:22

WinActivate --> Remarks
Window titles and text are case sensitive

Code: Select all

IfWinNotExist Calculator
	Run calculator://
; WinWait Calculator, , 3
; If not ErrorLevel
WinActivate Calculator
cnwinger
Posts: 5
Joined: 05 May 2020, 13:33

Re: Bring Calculator window to top

14 May 2020, 18:42

GEV wrote:
14 May 2020, 18:22
WinActivate --> Remarks
Window titles and text are case sensitive

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?
GEV
Posts: 844
Joined: 25 Feb 2014, 00:50

Re: Bring Calculator window to top

14 May 2020, 18:53

It doesn't happen to me with Firefox.
gregster
Posts: 4622
Joined: 30 Sep 2013, 06:48

Re: Bring Calculator window to top

14 May 2020, 18:57

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.

Return to “Ask For Help”

Who is online

Users browsing this forum: Alexander2, Arkandia777, DizzyDuck, Epialis, Google [Bot], JKnight_xbt33 and 46 guests