Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mutiple windows with simuliar names
#1
i am trying 2 make a marco that will look 4 certain windows and when it finds them get the window text.1 can i do no problem,but muliple windows it won't do.it just gets the same window text twice or more.is there a way 2 do this without using a mouse click?
#2
try GetWindowList.

Code:
Copy      Help
ARRAY(int) a
GetWindowList 0 "NOTEPAD" 1|2 0 0 a
int i
str s
for i 0 a.len
,s.getwintext(a[i])
,out s
#3
i have never used that can u give an example using ntoe pad or word pad with 2 windows?
#4
tyvm 4 the quick response.1 more question i need 2 store the text in to variables so i can get the macro 2 work with each window
#5
Code:
Copy      Help
ARRAY(int) a
GetWindowList 0 "NOTEPAD" 1|2 0 0 a
int i
ARRAY(str) at
for i 0 a.len
,;if(!wintest(a[i] "window name" "window class")) continue ;;you can use this if a may contain windows that you don't need
,at[at.redim(-1)].getwintext(a[i])

for i 0 a.len
,out at[i]
#6
again tyvm 4 the quick response.Almost what i need.but i am trying 2 make it so each window is stored in it's own variable...global would be best.abd how do i get rid of unwanted windows it finds?
#7
str+ g_w1text=at[0]
str+ g_w2text=at[1]
...
#8
ok almost there i think.ty again 4 the very quick response.the window i am trying 2 ignore or skip is the main windows these were open from.it's a list of all the files.how would i get it 2 skip that or ignore it and just get the others?
#9
use wintest, as in example
#10
ok now i got lost lol.Just not getting the wintest
#11
ok i got it 2 work,but now i was wondering if there was a way 2 get the macro automatically assign these values 2 the windows =at[0]
str+ g_w2text=at[1] ect..
i can assign them but if the windows don't go as high as what i have assigned it errors

so what i would like 2 do is maybe use an array and assign each window found a str+ g_w1text value and then run a function.

i am calling functions using mac command so they can run at the same time
but i only want 2 call functions 4 the windows that wintest finds.
so like if 2 windows are found assing window 1 to str+ g_w1text and run function 1, ect.so it only assign the str+ g_w?text 2 the winodws found and then runs the a function 4 each 1
this is what i did
str+ g_w1text=at[0]
str+ g_w2text=at[1]
str+ g_w3text=at[3]
str+ g_w4text=at[4]
1
mac "Function8"
mac "Function9"
mac "Function10"
mac "Function11"
but this errors unless i have 4 windows open
can u help?
#12
ARRAY(int) a
GetWindowList 0 "NOTEPAD" 1|2 0 0 a
int i
ARRAY(str)+ at
for i 0 a.len
,;if(!wintest(a[i] "window name" "window class")) continue ;;you can use this if a may contain windows that you don't need
,at[at.redim(-1)].getwintext(a[i])

for i 0 a.len
,out at[i]



Array at will be global if you declare it with +, as in this example. In other functions also insert

ARRAY(str)+ at

, and use at[0], at[1], etc instead of g_w?text.
#13
4 some reason when i use that code i get invalid syntaxt error. but if i change it 2 this it works fine.

ARRAY(int) a
GetWindowList 0 "NOTEPAD" 1|2 0 0 a
int i
ARRAY(str)+ at
for i 0 a.len
,;if(!wintest(a[i] "window name" "window class")) continue ;;you can use this if a may contain windows that you don't need
,at[at.redim(-1)].getwintext(a[i])
,out at[i]
I'm having trouble with a couple of commands not responding
wait 0 WV id(2000 x)
if(IsWindowVisible(id(123 x)));err
x is the wintext ami doing some thing wrong every other command like that works but something with the if(IsWindowVisible and 0 WV 4 some reason isn't repsonding.Any suggetsions?Also once the windows are found and assigned a global varialbe is there a way 2 get the macro 2 run a Fun 4 each window found?


Forum Jump:


Users browsing this thread: 1 Guest(s)