WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinCloseNot Doesn't Work with file list

Keywords:  WinCloseNot 

NB: WinCloseNot is in the processing of being phased out of the help file, since it seems to have caused more problems than it resolved. Therefore, if you click on some of the links to WinCloseNot in the help file, it may give you an error message. This just means we didn't remove all the links yet.

Here is an alternative to using WinCloseNot.

:CloseNot    ; Close all applications except WinBatch & WinZip
allwins = WinItemize()
index=ItemLocate(WinName(), allwins, @TAB) ; Current WinBatch application
allwins = ItemRemove(index, allwins, @TAB)     ; Remove from close list
index=ItemLocate('WinZip Self-Extractor', allwins, @TAB) ;WinZip
if index>0 then allwins = ItemRemove(index, allwins, @TAB) ;Exclude WinZip
wincount = ItemCount(allwins, @TAB)
for pos = 1 to wincount
   index = ItemExtract(pos, allwins, @TAB)
   if WinState(index) > 0       ; Skip, do not close, hidden windows
      Pause(1, WinExeName(index),StrCat('Closing: ',Index))
      WinClose(index)
endif
next
Return


It's tricky to get WinCloseNot working with a file list variable. WinCloseNot expects to receive the data in a certain format; the function used to build the list may use an entirely different format.

WinCloseNot likes to receive a list which looks like this: "CompuServe Navigator","Netscape","Program Manager"

Here's an example of how to alter your data to fit.

;grab a list, hidden windows will be shown.
   a=WinItemize()		       
   list=AskItemList("don't close me", a, @tab, @sorted, @multiple)     

;alter the list to fit our needs.   
   list=strsub(list,1,strlen(list)-1)	
   list=StrCat(`"`,StrReplace(list, @tab, `","`),`"`)
   ClipPut(list)

;verify what you're closing        
   Message("don't close me", list)    
   WinCloseNot(%list%)

;check to see what's open        
   a=WinItemize()                       
   Message("", a)

Article ID:   W13117
Filename:   WinCloseNot Doesnt Work.txt
File Created: 2001:03:01:11:53:46
Last Updated: 2001:03:01:11:53:46