Hi George !
A simple solution with just one macro MINST and a BAT file . The next beta should do the same thing as the macro and bat does .
No CAN | END support . Passing the hWnd it's just a relict . ( didn't manage to wait with IsWindow function in tbasic . Just use PAUSE in Bat )
' MInst.MACRO
' Syntax: MINST instance-name [ -O openlist-filename ][ -D do-macro ][ KEEP ] both -D -O can be used (Similar to the CmdLine operands)
uses "OS"
uses "UI"
dim hWnd, Pid as number value 0
dim PidFullPath as string
hWnd= Win_GetForeground ' this one works instead of Win_GetActive() to pass it to MUENT.tbasic
Pid = OS_GetCurrentProcessID
PidFullPath = OS_ProcessGetFullPath(Pid)
if EndsWith(Get_Arg$(0),"KEEP",%false) then Pid = 0 ' no Pause in BAT required
if Get_Instance$ <> ucase$(Get_Arg$(1)) then Pid = 0 ' no Pause in BAT required
' msgbox (0 ,"WW30T.bat "+hWnd+" "+Pid+" """+PidFullPath+""" -I "+trim$(rtrim$(rtrim$(Get_Arg$(0)," KEEP")," keep"))) ' max 9 Parameters
SPF_EXEC(ASYNC,"WW30T.bat "+hWnd+" "+Pid+" """+PidFullPath+""" -I "+trim$(rtrim$(rtrim$(Get_Arg$(0)," KEEP")," keep"))) ' max 9 Parameters
if isfalse EndsWith(Get_Arg$(0),"KEEP",%false) then SPF_Post_Do("=X")
and the bat file
if NOT %2 == 0 pause Wait for termination of instance
start "SPFLV30" %3 %4 %5 %6 %7 %8 %9
Some Sample 's
MINST NEWINST KEEP Start instance and keep the old Instance running
MINST DEFAULT Switch back to default instance and end NEWINST with =X
MINST DEFAULT -O openlist done in DEFAULT Instance . ends Default Instance and restarts it with OPENLIST or MRFLIST+OPENLIST depending if openlist starts with ","
What you should not do is use of -O and the other Instance is already active . This is a switch and SPFlite undestands only a single file name .
Hope this helps
P.S. Does anyone know of a Programming interface which alllows to check if PID is still active ?
thinbasic OS_ProcessGetID("SPFLite30.exe") returns only first PID found .
if no feeback i will use following cmd in a replacement pgm for PAUSE .
tasklist /Fi "IMAGENAME eq SPFLite*"
Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung
SPFLite30.exe 21052 Console 4 289.820 K
SPFLite30.exe 6216 Console 4 224.820 K
SPFLite223278.exe 24116 Console 4 57.156 K