Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
enumeration of items
#31
Maybe better use scan function? Capture object images with "Find image" dialog.
#32
I need to setup the function so i can access the Arrays from other functions, but i am confusing myself with the logic. What i have so far is

Tree_Array
Code:
Copy      Help
int w=win("Calculator" "SciCalc") ;;QM Options dialog
Acc a.Find(w "WINDOW" "Calculator" "class=SciCalc" 0x1005)
ARRAY(Acc) b.create(0x10000)
ARRAY(str) names.create(0x10000)
int i
ARRAY(str) s
a.GetChildObjects(b -1)
for i 0 b.len
,names[i]=b[i].Role
,names[i+1]=b[i].Name
,b[i].Role(names[i+2])
,
out s

Access_Function
Code:
Copy      Help
function# ARRAY(Acc)&b ARRAY(str)&names int&i ARRAY(str)&s

s.F"{names[i]} : {names[i+2]} : {names[i+1]}"

I know i am missing many things, but can you help me get on the right track again?

Thank you
#33
Function Function209
Code:
Copy      Help
ARRAY(str) a="one[]two"
Function210 a

Function Function210
Code:
Copy      Help
function ARRAY(str)&a

int i
for i 0 a.len
,out a[i]
#34
Thank you for the last piece of information it helped me out a lot. I hate to jump backwards, but is there a way to use GetChildObject and gather all invisible objects? I was looking through the GetChildObject function, and I could not figure out how to get all invisible objects. The (-1) gets all descendants i know, but does that include all invisible as well?
#35
Use flag 16 for invisible, flag 32 for useless. This will get all objects:
Macro Macro1780
Code:
Copy      Help
Acc a
;...
a.GetChildObjects(array -1 "" "" "" 16|32)
#36
Perfect, sorry to backtrack into comparing files and stuff again, but i need to compare data. This is what i have so far

Code:
Copy      Help
int w=win("Calculator" "SciCalc") ;;QM Options dialog
Acc a.Find(w "WINDOW" "Calculator" "class=SciCalc" 0x1005)
ARRAY(Acc) b.create(0x10000)
ARRAY(str) names.create(0x10000)
ARRAY(str) roles.create(0x10000)
int i
str data
str saveTo="$desktop$\Compare.txt"

ARRAY(int) location.create(0x10000)
ARRAY(str) s
a.GetChildObjects(b -1)
for i 0 b.len
,roles[i]=b[i].Role
,names[i]=b[i].Name
,location[i]=b[i].Location
,
,data.formata(" %i : %s : %s : %i[]" i roles[i] names[i] location[i])
if data="$desktop$\Compare.txt"
,out "Same data"
else
,data.setfile(saveTo)
,out "Different data"
#37
Macro Macro1782
Code:
Copy      Help
int w=win("Calculator")
Acc a.Find(w "WINDOW" "Calculator" "class=SciCalc" 0x1005)
;Acc a.Find(w "WINDOW" "Calculator" "class=CalcFrame" 0x1005) ;;Win7

ARRAY(Acc) b
int i
str data
str saveTo="$desktop$\Compare.txt"
str name; int role x y cx cy

a.GetChildObjects(b -1 "" "" "" 16|32)
for i 0 b.len
,role=b[i].Role
,name=b[i].Name
,b[i].Location(x y cx cy)
,
,data.formata(" %i : %i : %s : %i %i %i %i[]" i role name x y cx cy)
;out data

str savedData.getfile(saveTo); err
if data=savedData
,out "Same data"
else
,data.setfile(saveTo)
,out "Different data"

if need array for object properties
Macro Macro1781
Code:
Copy      Help
int w=win("Calculator")
Acc a.Find(w "WINDOW" "Calculator" "class=SciCalc" 0x1005)
;Acc a.Find(w "WINDOW" "Calculator" "class=CalcFrame" 0x1005) ;;Win7

ARRAY(Acc) b
type ACCPROPERTIES int'role str'name int'x int'y int'cx int'cy
ARRAY(ACCPROPERTIES) ap
int i
str data
str saveTo="$desktop$\Compare.txt"

a.GetChildObjects(b -1 "" "" "" 16|32)
for i 0 b.len
,ACCPROPERTIES& r=ap[]
,r.role=b[i].Role
,r.name=b[i].Name
,b[i].Location(r.x r.y r.cx r.cy)
,
,data.formata(" %i : %i : %s : %i %i %i %i[]" i r.role r.name r.x r.y r.cx r.cy)
;out data

str savedData.getfile(saveTo); err
if data=savedData
,out "Same data"
else
,data.setfile(saveTo)
,out "Different data"
#38
That is works perfectly, but after i inserted the code i had a thought. I want to keep the older version and keep it. Every time there is different data i want it to create a different "Compare.txt" file. So the first file will be "Compare_v1.txt" then the next different one will be "Compare_v2.txt". I know i need some kind of for loop that compares old data to new data, then an if statement that says something like "if different, then data.savefile(...)". I have a have a general idea of what it should look like, but i am unable to write out the code to make it work.
#39
I came up on another issue. After running the GetChildObject to get all the objects i just realized that there are a few objects that have the same name, role, and location. The only difference is the element number. The objects with the same name, role and location do the same thing, and i was wondering how i would setup my function to that if there is a repeat of a function ignore it.

I was thinking of doing a scan or find function to search through a file that was just made and then compare if there are more then 1 of the same objects. If there are more then 1 of the same objects i would then call in the objects that were saved in the .txt file. I am not really sure how or if it can be done with Quick Macro.

Any advice would be grateful.

Thank you


Forum Jump:


Users browsing this thread: 3 Guest(s)