disallow multiple instances still allows multiple instances

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
brodie
Posts: 7
Joined: Fri Apr 11, 2003 4:54 am

disallow multiple instances still allows multiple instances

Post by brodie »

I have "allow multiple instances" disabled so that all files open in the same instance. When I run the following command (to open all .php files in the current tree), it issues very quickly many "textpad file.php" calls.

FOR /F "tokens=*" %G IN ('DIR /B /S *.php') DO textpad "%G"

If Textpad is already running, they will all open in the same instance. If it is not already running, then it will start multiple instances. This appears to be a problem in the startup code - there is no mutex or similar strategy used to ensure that only a single instance is being started.

Regards,
Brodie
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Post by Drxenos »

How about:

SET ALL=
FOR /F "tokens=*" %%G IN ('DIR /B /S *.php') DO SET ALL=!ALL! %%G
textpad %ALL%


make sure to use "setlocal enabledelayedexpansion"
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

How about:

SET ALL=
FOR /F "tokens=*" %%G IN ('DIR /B /S *.php') DO SET ALL=!ALL! %%G
textpad %ALL%


make sure to use "setlocal enabledelayedexpansion"
This only works for a smaller number of files, as the length of the command line is limited - the original version has no limit.


Just an idea:
Use
textpad
sleep 1000
FOR /F "tokens=*" %G IN ('DIR /B /S *.php') DO textpad "%G"

Choose a time for sleep long enough for the textpad instance to start up.
(if your system does not have a sleep, you can easily find one with google - make sure to select an appropriate time - some sleep utilities use seconds, some milliseconds).
Post Reply