07-25-2012, 01:55 PM
I looked on the forum and checked if there was any post that is like what i want, but i couldn't find one. I want to make a function return objects. I was reading up on the "ret" command and it says i should not return a string or an array. I am not able to create a function that declares all the objects and call them into a function because usually i am unable to get the window right away.
Example: I am using Microsoft Word and write a few words in the beginning using the default black, but later in the same macro i want to write text in a different color. So i hit change text color button and i have to call in this function to get the accessible objects from the Color Window. How would i go about returning "OK", "DefineColor", and "CloseColor" objects i made?
Example: I am using Microsoft Word and write a few words in the beginning using the default black, but later in the same macro i want to write text in a different color. So i hit change text color button and i have to call in this function to get the accessible objects from the Color Window. How would i go about returning "OK", "DefineColor", and "CloseColor" objects i made?
IStringMap m=CreateStringMap
int w=win("Color" "#32770")
Acc a.Find(w "WINDOW" "Color" "class=#32770" 0x1005)
ARRAY(Acc) l
Acc OK DefineColor CloseColor
str role name
str data
int x y cx cy i
a.GetChildObjects(l -1)
for i 0 l.len
,l[i].Role(role)
,name=l[i].Name
,l[i].Location(x y cx cy)
,if role="PUSHBUTTON"
,,if name="OK"
,,,m.IntAdd("OK" i)
,,,OK=l[i]
,,if name="Define Custom Colors >>"
,,,m.IntAdd("Define" i)
,,,DefineColor=l[i]
,,if name="Close"
,,,m.IntAdd("Close" i)
,,,CloseColor=l[i]
,data.formata(" %i : %s : %s : %i %i %i %i[]" i role name x y cx cy)