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

Strings

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

Checking Length of Strings and Check for Spaces and Tabs in Window Names

Keywords:	 Check length string window name win title wbt	 winclose

To check the length of a window name, write the following script:

Delay(10)

A=WinGetActive( )

B=StrLen(A)

Message(B,A)
If you're having a problem closing a Window, sometimes the problem is that the window title actually has an extra space or tab in it, which is not immediately apparent. So it may look like you're specifying the correct window title, but might be off by a space.

Here's how to illuminate the situation a bit more, so we know how many spaces and tabs are in the window title:

wins=WinItemize()
line=askitemlist("all windows",wins,@TAB,@sorted,@single)

;;This section of code is for debugging.
;;It will replace all the spaces with "?" and
;;replace all the tabs with "!". This way you can
;;make sure all the appropriate spacing is put back
;;in the winclose line, if you're going to use the 
;;Window title name.  Alternatively, you could use
;;the Window ID handle.

length=Strlen(line)
c=Strreplace(line," ","?")   ;substitute ?s for spaces
d=strReplace(c,@TAB,"!")     ;substitute !s for tabs
message(length,d)	     ;display Window title with !s and ?s for tabs/spaces

;Now, if you want, you close the window with a Windows ID handle

Winid=Winidget(line)
message("Window ID",winid)
Winclose(winid)

Article ID:   W13331
Filename:   String Length & Check for Spaces and Tabs in Windows.txt
File Created: 1999:04:15:16:53:18
Last Updated: 1999:04:15:16:53:18