#1 2017-11-05 03:52

101
Member
Registered: 2017-11-03
Posts: 22

Only a maximum of instances running

I want to have only a maximum of 4 instances running and have tried the following.

The original and 3 additional renamed copies of the executable with the enabled option "allow only single instance of the application" on each of them.

Shutter.exe
Shutter_2.exe
Shutter_3.exe
Shutter_4.exe

But if one of these processes is running no others are possible.

The only way to do this is to disable the option "allow only single instance of the application" for all of them and kill an existing process with an autoit script when an application starts the same shutter process.

It would be easier and better, when Shutter would't block the start of instances with a different executable name, if the option "allow only single instance of the application" is enabled on each of them.

Last edited by 101 (2017-11-05 03:53)

Offline

#2 2017-11-05 13:44

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Only a maximum of instances running

It is not currently possible to limit the number of open instances to some specific number.

Why not just start the required number of instances, and not start any more?

101 wrote:

It would be easier and better, when Shutter would't block the start of instances with a different executable name, if the option "allow only single instance of the application" is enabled on each of them.

The current option works as indented. It is not a question of easier or better at all. You are essentially asking for a different feature.

The real question is why do you need such an option? Perhaps there are better means of achieving the same effect?

Offline

#3 2017-11-05 18:55

101
Member
Registered: 2017-11-03
Posts: 22

Re: Only a maximum of instances running

Shutter is only used to prevent Windows from going into sleep/hibernate mode automatically. It is started automatically with the same preset (via command line) by up to 4 applications. The applications are started also automatically by the Windows task scheduler. To save RAM and Windows tray space I don't want to have 4 instances of Shutter for the same events and action.

Otherwise it should be possible to start a second instance from another application with a different event and action. I hope you can understand what I mean.

I use an autoit script (as standalone executable) to close specific Shutter instances when one of the 4 applications starts. This executable is started automatically with the applications.

Autoit script executable:

Sleep(1500)
If ProcessExists("Shutter_3.exe") Then
   ProcessClose("Shutter_3.exe")
   ProcessWaitClose("Shutter_3.exe")
EndIf
   Run("C:\Program Files (x86)\Shutter\Shutter_3.exe /preset Terminals") ;prevents Windows from automatic sleep/hibernate
   ProcessWait("Shutter_3.exe")
   ProcessSetPriority("Shutter_3.exe",4) ;sets process priority to high
   Run("C:\Program Files (x86)\Shutter\Shutter_Affinity.cmd", "", @SW_HIDE) ;sets specific CPU Cores as allowed
Run("C:\Program Files (x86)\Shutter\RefreshTrayicons.exe")
Exit

Last edited by 101 (2017-11-06 03:20)

Offline

#4 2017-11-07 19:06

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Only a maximum of instances running

Let's see if I understood it correctly...

You have 4 different applications which may be started at some unknown times, with a possibility of more than 1 instance of each application running at the same time. Every time a new instance is started, you also start Shutter with some unknown configuration (is it top secret?), with a goal of preventing Windows from going into sleep/hibernate mode automatically. You are trying to avoid starting more than 1 instance of Shutter per application, no matter how many active instances that application may have.

It is still quite hazy, which makes it difficult to see if your problem can be solved by alternative/existing means.

Offline

#5 2017-11-07 21:22

101
Member
Registered: 2017-11-03
Posts: 22

Re: Only a maximum of instances running

instance1-shutter3exe_preset1.jpg
Windows task scheduler starts the autoit script (see post #3) for terminal.exe at windows logon or time based at the same time as the other terminals.
Windows task scheduler starts the autoit script (see post #3) for terminal_1.exe at windows logon or time based at the same time as the other terminals.
Windows task scheduler starts the autoit script (see post #3) for terminal_2.exe at windows logon or time based at the same time as the other terminals.
Windows task scheduler starts the autoit script (see post #3) for terminal_3.exe at windows logon or time based at the same time as the other terminals.

Note: each of the 4 scripts uses a different sleep parameter (+2000 ms) and not all 4 scheduled tasks are always activated. There are also links to these 4 scripts on the desktop and in the start menu, if I want to start any of these terminals manually.

Shutter_3.exe should always running only one instance at the same time, because preset #1 is used for all 4 terminals.

----------------------------------------------------------------------------------------------------------------------------------
instance2-shutter2exe_preset2.jpg
Shutter_4.exe, only running preset #3 and only started via command line with the antivirus scan

----------------------------------------------------------------------------------------------------------------------------------
instance3-shutter4exe_preset3.jpg
Shutter_2.exe, only running preset #2 and only started via command line with the defrag application
----------------------------------------------------------------------------------------------------------------------------------

Shutter.exe is only for manual use without any preset

Shutter.exe, Shutter_2.exe, Shutter_3.exe and Shutter_4.exe could run at the same time, but I don't start an antivirus scan if an scheduled defragmentation is running.

Last edited by 101 (2017-11-09 17:38)

Offline

Board footer

Powered by FluxBB