How to have 1 single Calculator instance only ?

D

dingdongdingding

I've assigned a keyboard shortcut to start the Calculator utility, I
do not want many calculator instances to start. I just want it to
bring up the existing started calculator if I press the keys (if calc
is started and running in the background)

Possible ?
 
D

Don Phillipson

I've assigned a keyboard shortcut to start the Calculator utility, I
do not want many calculator instances to start. I just want it to
bring up the existing started calculator if I press the keys (if calc
is started and running in the background)
Possible ?

When apps are loaded simultaneously, Windows lets you to
go to each in turn via Alt-Esc (or toggle between the last two
via Alt-Tab.)
 
P

Pegasus \(MVP\)

I've assigned a keyboard shortcut to start the Calculator utility, I
do not want many calculator instances to start. I just want it to
bring up the existing started calculator if I press the keys (if calc
is started and running in the background)

Possible ?

Some applications, e.g. Outlook Express, are written so that only a single
instance of them will run. Others, e.g. notepad, can run in multiple
instances. The native Windows calculater belongs to the second group. To get
around the issue you could program your shortcut so that invokes the file
below. Note that the method is a little sluggish becaus it takes time to
check if the Calculator is already active.

Set WShell = WScript.CreateObject("WScript.Shell")
Set cTasks = CreateObject("Word.Application").Tasks
For Each oTask In cTasks
If InStr(1, oTask, "Calculator", 1) > 0 Then
WShell.AppActivate "Calc"
WScript.Quit
End If
Next
WShell.Exec("calc")

Instructions:
1. Save the above code to c:\MyCalc.vbs.
2. Link your calculator shortcut to c:\MyCalc.vbs.
 
D

dingdongdingding

Some applications, e.g. Outlook Express, are written so that only a single
instance of them will run. Others, e.g. notepad, can run in multiple
instances. The native Windows calculater belongs to the second group. To get
around the issue you could program your shortcut so that invokes the file
below. Note that the method is a little sluggish becaus it takes time to
check if the Calculator is already active.

Set WShell = WScript.CreateObject("WScript.Shell")
Set cTasks = CreateObject("Word.Application").Tasks
For Each oTask In cTasks
 If InStr(1, oTask, "Calculator", 1) > 0 Then
  WShell.AppActivate "Calc"
  WScript.Quit
 End If
Next
WShell.Exec("calc")

Instructions:
1. Save the above code to c:\MyCalc.vbs.
2. Link your calculator shortcut to c:\MyCalc.vbs.

Thanks for the script. I'll try.
Actually, I've already found that the keyboard invoked shortcut takes
much longer to start than if I navigate thru the startmenu and start
the calculator. Any idea why ?
 
D

dingdongdingding

When apps are loaded simultaneously, Windows lets you to
go to each in turn via Alt-Esc (or toggle between the last two
via Alt-Tab.)

I know about the Alt-Tab. But not know about the Alt-Esc. I just
want it not to start multiple copy. So I guess I can use this command
elsewhere. Thanks.
 
P

Pegasus \(MVP\)

Some applications, e.g. Outlook Express, are written so that only a single
instance of them will run. Others, e.g. notepad, can run in multiple
instances. The native Windows calculater belongs to the second group. To
get
around the issue you could program your shortcut so that invokes the file
below. Note that the method is a little sluggish becaus it takes time to
check if the Calculator is already active.

Set WShell = WScript.CreateObject("WScript.Shell")
Set cTasks = CreateObject("Word.Application").Tasks
For Each oTask In cTasks
If InStr(1, oTask, "Calculator", 1) > 0 Then
WShell.AppActivate "Calc"
WScript.Quit
End If
Next
WShell.Exec("calc")

Instructions:
1. Save the above code to c:\MyCalc.vbs.
2. Link your calculator shortcut to c:\MyCalc.vbs.

Thanks for the script. I'll try.
Actually, I've already found that the keyboard invoked shortcut takes
much longer to start than if I navigate thru the startmenu and start
the calculator. Any idea why ?
============
This behaviour is expected, as I explained in my initial reply.
 
D

dingdongdingding

Oh... Miscommunication. I'm not referring to the script. I'm saying
I define a keyboard shortcut to point to the exe. This shortcut takes
much longer than invoking the exe directly. Any idea why ?
 

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