How to run only single instance of Calculator

C

Cindy Winegarden

I found a Registry hack once that would only allow a single instance of
Calculator. Pressing the Calculator button on my keyboard would activate the
Calculator window but not start a new instance. But, I've forgotten how to
do it, and a web/Google search didn't help me find it.

Can anyone help? Thanks!
 
D

David Candy

You must have started it from a shortcut perhaps. If a hotkey is assigned to a shortcut then it is applied to the window of an app started from it. Hotkey here is Ctrl + Alt + something or an F key rather than calc key.

A C program may be able to assign the calc button to a shortcut. VB and varients can't as the components check to see it's a key listed in help. This is in XP anyway. Before I think it didn't check (for programs - it always checked in the UI).

Internet shortcuts can also have hotkeys. For me till I gave one a shortcut by hand the field didn't appear in the dialog at all for any internet shortcut. Others have reported when upgrading that only existing IS with hotkeys have the field. Go figure that one. IS are text files unlike other shortcuts. This used to be to google and is now to calc (the hotkey is a F key).

[DEFAULT]
BASEURL=file:\\c:\windows\system32\calc.exe
[InternetShortcut]
URL=file:\\c:\windows\system32\calc.exe
Modified=408154AB045EC601E9
IconFile=http://www.google.com.au/favicon.ico
IconIndex=1
Hotkey=122

Feel free to ask more as it will require more research to give more details but this may be enough.
 
C

Cindy Winegarden

I found the following script which can be the target of the Calculator
shortcut but it's got an error in it and I'm not very good with VBS:

If WindowsFound(Window(Executable:"Calc.exe" Class:"SciCalc"
Title:"Calculator")) Then
SwitchToWindow(Window(Executable:"Calc.exe" Class:"SciCalc"
Title:"Calculator"))
Else
Run(File:"C:\WINDOWS\system32\Calc.exe" StartIn:"C:\WINDOWS\system32\")
End If

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(e-mail address removed) www.cindywinegarden.com


"David Candy" <.> wrote in message
You must have started it from a shortcut perhaps. ....
 
C

Cindy Winegarden

Yes, that's where I found it and missed the part about the Hotkey Master
program. It wasn't what I had before because I never use stuff that isn't
freeware.

I still can't remember whether the modification was a Registry hack or a
script.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(e-mail address removed) www.cindywinegarden.com


"David Candy" <.> wrote in message
It calling unknown commands in VBS. There must be more to it. WindowsFound
and SwitchToWindow I don't recognise. You probably need this program, which
is where your script
(http://s10.invisionfree.com/Hotkey_Master/index.php?showtopic=21&view=getlastpost)
came from.
 
D

David Candy

set WshShell = WScript.CreateObject("WScript.Shell")
If WSHShell.AppActivate("Calculator")=False then
WshShell.Run "C:\windows\System32\calc.exe", 1, false
End If
 
C

Cindy Winegarden

Thanks.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(e-mail address removed) www.cindywinegarden.com


"David Candy" <.> wrote in message
set WshShell = WScript.CreateObject("WScript.Shell")
If WSHShell.AppActivate("Calculator")=False then
WshShell.Run "C:\windows\System32\calc.exe", 1, false
End If
 
D

David Candy

I was running late when I posted that and didn't have time to write anything. AppActivate cannot restore windows. If minimised it stays minimised. It can only bring a window to the top of the windows, it can't otherwise change the window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top