enumeration of items Gintaras Administrator Posts: 11,002 Threads: 128 Joined: Dec 2002 06-26-2012, 05:01 PM Maybe better use scan function? Capture object images with "Find image" dialog. Reply Reply Amzerik Junior Member Posts: 45 Threads: 10 Joined: May 2012 07-12-2012, 01:52 PM 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: ```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: ```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 Reply Reply Gintaras Administrator Posts: 11,002 Threads: 128 Joined: Dec 2002 07-12-2012, 04:53 PM Function Function209 Code: ```ARRAY(str) a="one[]two" Function210 a``` Function Function210 Code: ```function ARRAY(str)&a int i for i 0 a.len ,out a[i]``` Reply Reply Amzerik Junior Member Posts: 45 Threads: 10 Joined: May 2012 07-13-2012, 02:44 PM 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? Reply Reply Gintaras Administrator Posts: 11,002 Threads: 128 Joined: Dec 2002 07-13-2012, 02:58 PM Use flag 16 for invisible, flag 32 for useless. This will get all objects: Macro Macro1780 Code: ```Acc a ;... a.GetChildObjects(array -1 "" "" "" 16|32)``` Reply Reply Amzerik Junior Member Posts: 45 Threads: 10 Joined: May 2012 07-13-2012, 08:48 PM Perfect, sorry to backtrack into comparing files and stuff again, but i need to compare data. This is what i have so far Code: ```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"``` Reply Reply Gintaras Administrator Posts: 11,002 Threads: 128 Joined: Dec 2002 07-14-2012, 04:00 AM Macro Macro1782 Code: ```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: ```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"``` Reply Reply Amzerik Junior Member Posts: 45 Threads: 10 Joined: May 2012 07-16-2012, 01:56 PM 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. Reply Reply Amzerik Junior Member Posts: 45 Threads: 10 Joined: May 2012 08-01-2012, 05:08 PM 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 Reply Reply « Next Oldest | Next Newest »