Posts: 795
Threads: 136
Joined: Feb 2009
Hi all,
this is a tricky one...
I've a program i want to interact with (tag&rename).
[img]

[/img]
The window i want to modify contains mainly check boxes, edit controls.
I want to be able to iterate the child window to check all controls that are check boxes, and fill all edit controls
with a certain value, leaving other controls alone.
I searched forum and help without luck.
Would be a life savior for me.
Thanks.
Posts: 12,141
Threads: 143
Joined: Dec 2002
You can do it with
key. Can record. Use Tab to focus next control.
Or use function
id or
child. Then use setwintext to set text of edit controls;
but to check. With
child you can get array of matching controls, if need.
Quote:to iterate the child window to check all controls that are check boxes
Why don't click 'Check All' button?
Posts: 795
Threads: 136
Joined: Feb 2009
for the keyboard, the answer is : no
Too slow, the tab key doesn't follow logical order etc, not an option....
"With child you can get array of matching controls, if need."
so yes the array for child would help, but i can't do it...
"Why don't click 'Check All' button?"
Guess? it does not do what i want, unless i would not bother ask the question
and use QuickMacros with it.
I just want a function or macro that tells me : the windows has X child,
this one is edit, that one checkbox....
Posts: 12,141
Threads: 143
Joined: Dec 2002
Quote:so yes the array for child would help, but i can't do it
If you can capture a control with 'Find window or control' dialog, then you can get array. If not, will need to use keyboard, or maybe accessible object functions.
example with QM Mouse dialog
Macro
Macro1449
out
int w1=win("Mouse" "#32770")
ARRAY(int) a
int i h
out "---- Edit controls ----"
child "" "Edit" w1 0x400 0 0 a
for i 0 a.len
,h=a[i]
,outw h
out "---- Checkboxes -----"
child "" "Button" w1 0x400 0 0 a
for i 0 a.len
,h=a[i]
,if(GetButtonType(h)!=1) continue
,outw h
Function
GetButtonType
;/
function# hwnd ;;Returns: 0 push button, 1 check, 2 radio, 3 group
;Returns Button control type.
sel GetWinStyle(hwnd)&15
,case [2 3 5 6] ret 1
,case [4 9] ret 2
,case 7 ret 3
Posts: 795
Threads: 136
Joined: Feb 2009
ok works well after some tweaking.
A trivial one: i know which controls i want to work for as an integer type
checkbox 1 => number 1
edit 1 => 12
i tried to declare an array for easier use but it does not work...
ARRAY(int) ControlID="1 12 25 45"
_s.getwintext(a[ControlID[0]])
idea?
Posts: 12,141
Threads: 143
Joined: Dec 2002
Macro
Macro1450
;instead of
;ARRAY(int) ControlID="1 12 25 45"
;use
ARRAY(int) ControlID
ArrayIntFromList ControlID "1 12 25 45"
Function
ArrayIntFromList
;/
function ARRAY(int)&a $data
;Populates int array from list of numbers.
;a - receives result.
;data - list of numbers, like "1 12 7 2"
ARRAY(lpstr) b
tok data b -1
a.create(b.len)
int i
for i 0 b.len
,a[i]=val(b[i])
Posts: 795
Threads: 136
Joined: Feb 2009
Ok Gintaras...
Quick macros is great, and i like it so much.
But there are somme baffling stuff in it sometimes, making simple thing hard to do or find.....
I managed to make it simplier, but keep your solution for further use.
ARRAY(str) ControlID="1 12 25"
_i=val(ControlID[0])
....
like
rep 5
,'(VK_RETURN)
why not simply '(VK_RETURN) 5 ?????
Posts: 12,141
Threads: 143
Joined: Dec 2002
Yes, something like it could be useful. Probably will add it in next QM.
Posts: 795
Threads: 136
Joined: Feb 2009
Nice
1. why does the str declaration so much simplier than the int one? implementation problem, choice, memory?
2.
child "" "TCheckBox" w1 0x400 0 0 a
for _i 1 7
,but a[_i]
is it possible to speed up the process? i find it slow...
Posts: 12,141
Threads: 143
Joined: Dec 2002
Currently QM implements ARRAY(str) a="line[]line[]...", but not ARRAY(int) a="number number ...". But it is in my TODO list.
but waits 100 ms. Use
spe to set speed.
Macro
Macro1460
out
int w1=win("Find Image" "#32770")
act w1
ARRAY(int) a
int i h
child "" "Button" w1 0x400 0 0 a
out a.len
int t1=perf
spe 0
for i 0 a.len
,h=a[i]
,if(GetButtonType(h)!=1) continue
,but h
int t2=perf
out t2-t1
spe -1
Posts: 795
Threads: 136
Joined: Feb 2009
Amazing
From cart to rocket speed.
thanks a lot !!!!