3

I just upgraded from Windows 8.1 to Windows 10 Pro, and I'm really enjoying the new calculator application, except for the fact that it opens a new instance every time I use my keyboard's calculator key.

Is there a way to force it to be a single-instance application like the calculator in Windows 8.1 was without forcing me to use a different application?

holiveira
  • 1,391

3 Answers3

3

Use AHK. Map your calculator key to the following script (this one is mapped to Win + Z):

#z::
IfWinExist Calculator
WinActivate
else
Run calculator://
return
1

A method that doesn't involve AHK:

I went with another method that involved putting a script somewhere visible to %PATH% and editing the registry to call the script.

That registry edit is as follows:

Set key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18\ShellExecute
to value "scriptname.wsf" which is whatever you choose to name the script file.

The script I used was:

<package>
   <job id="vbs">
      <script language="VBScript">
         Set WshShell = WScript.CreateObject ("WScript.Shell")
         Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")
     For Each objProcess in colProcessList
     If objProcess.name = &quot;Calculator.exe&quot; then
     vFound = True
     End if
     Next

     If vFound then
     WshShell.AppActivate &quot;Calculator&quot;
     Else
     WshShell.run &quot;calc.exe&quot;, 5, false
     End If
  &lt;/script&gt;

</job> </package>

This was based on an answer to the Stack Overflow question How to run single instance of calculator (calc.exe) in Windows.

But the script they wrote didn't work in Windows 10, so I combined some bits from other sources to make mine, which does. A miracle, since I know nothing about VBScript, but it's a functioning option, if you don't want to run AHK.

0

Just start the app and pin it to the Taskbar. Then you start it by clicking or by using shortcuts Win+1, Win+2 etc. Both clicking and using shortcut executes only one instance of the app. If the instance is already running and you repeat the shortcut you only call up the focus of the app.

If you ever decide to start another instance, just Right-click on the icon in Taskbar and click on the app name. In my opinion, using these shortcuts raises the work efficiency and lowers mental exhaustion distinctively.

screenshot of the calculator app

Markus Meyer
  • 1,910