Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how many times does same line of text appear in List?
#1
Hi Gintaras,

Searched to no avail, I have a program that can have multiple instances of the same window name open at one time.
Need to figure out how many instances of each window is open.

I'm stuck!  Any thoughts on reliable way to accomplish are appreciated.
Thanks in advance.

Code so far, below.

Scott
_____________

Function OpenWindows___NumOfTimes
Code:
Copy      Help
int counter    ;; = number of windows in list
str names    ;; = list of window names

WindowList___Hidden(counter names) ;; <---- Modified GetWindowList function to include Hidden windows and a counter.


ARRAY(str) a
a = (names)
int i
for(i 0 a.len) out "%i %s" i a[i]
out "[][]____ The List of Windows open ___--->  str s:[]"
s=a
out s    ;;  --> The List of open windows.  converted array to use as reference against str names.

;; now trying to see,  how many instances of each window is open?
;; having trouble here.
#2
use function win to find how many windows are open of a certain program

example from qm help
this will find all windows of explorer
Code:
Copy      Help
ARRAY(int) a; int i; str sc sn
out "[9]ALL WINDOWS OF"
opt hidden 1
win("" "" "explorer" 0 0 0 a)
out a.len;; number of windows found
for(i 0 a.len)
,sc.getwinclass(a[i])
,sn.getwintext(a[i])
,out "%i '%s' '%s'" a[i] sc sn

you can define it even more to exclude windows but changing win line
example 2. this will find all windows of explorer with classname "CabintetWClass" 
Code:
Copy      Help
ARRAY(int) a; int i; str sc sn
out "[9]ALL WINDOWS OF"
opt hidden 1
win("" "CabinetWClass" "explorer" 0 0 0 a)
out a.len;; number of windows found
for(i 0 a.len)
,sc.getwinclass(a[i])
,sn.getwintext(a[i])
,out "%i '%s' '%s'" a[i] sc sn


and even further 
example 3
this will find all windows of explorer named This PC with classname "CabintetWClass" 
Code:
Copy      Help
ARRAY(int) a; int i; str sc sn
out "[9]ALL WINDOWS OF"
opt hidden 1
win("This PC" "CabinetWClass" "explorer" 0 0 0 a)
out a.len;; number of windows found
for(i 0 a.len)
,sc.getwinclass(a[i])
,sn.getwintext(a[i])
,out "%i '%s' '%s'" a[i] sc sn
 
Code:
Copy      Help
[b]int win($text [$class_] [$exename] [flags] [$prop] [matchindex|ARRAY(int)&a])   ;;`Finds window.`    flags: 1 use *, 2 insens., 4 main, 8 popup, 16 list, 32 exename is owner w., 0x200 regexp, 0x400 visible.[/b]

name - window title.
  • By default, name can be partial and must match case.
  • Empty string ("") matches any name.
class - window class name.
  • Must be full or with wildcard characters (*?). Case insensitive.
  • Default: "" (any).
  • Before QM 2.3.4, to use wildcard characters, need flag 0x800.
  • You can see class name in QM status bar.
exename - program. Default: "" (any). Can be:
  • Filename (e.g., "NOTEPAD") or full path (e.g., "$system$\notepad.exe").
  • QM 2.2.0. Process id.
#3
I guess I was trying to overthink it!
This makes sense and will do the trick Kevin,
thanks for the clearity.


Forum Jump:


Users browsing this thread: 1 Guest(s)