Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: WinIdNameID multiple instances application
Do you have any other way to handle this problem?
;DEFINE THESE VARIABLES appname="app.exe" windowname="Title" Run(appname, "") WinWaitExist(windowname,10) ;get main windows, window id Mainid=WinIdGet(windowname); ;call this subroutine if you need to check for and shut down mulitple instances gosub checkapps ;~~~~~~~~~~SUBROUTINE~~~~~~~~~~~~~~~ :checkapps ;activate window, so it will be first one found in WinItemNameid WinActivate(mainid) ;get list of windowname and id's list=WinItemNameId() ;how many windows + id's ? count=Itemcount(list,"|") ;If there is more than one window found if count > 2 For xx=1 to count by 2 ;gets window name thiswin=ItemExtract(xx,list,"|") ;gets window id thisid=ItemExtract(xx+1,list,"|") ;message(thiswin,thisid);debugging ;search for windowname if strindex(thiswin,windowname,0,@FWDSCAN) ;make sure your not closing the main window if thisid != mainid WinClose(Thisid) endif endif Next Endif return
Article ID: W13137
Filename: Check for multiple instances of an application.txt
File Created: 1999:04:15:16:52:00
Last Updated: 1999:04:15:16:52:00