Posts: 5
Threads: 2
Joined: Sep 2018
Hello:
I've made a script and exported it as an EXE file, but there are errors when it's executed on other computers. I think it's due to different computer monitors. Is there a quick way that scripts can be used directly on different computers without or relatively quickly modifying code (such as the coordinates of X, Y, or other objects of the mouse)? Thank you.
Posts: 1,338
Threads: 61
Joined: Jul 2006
09-29-2018, 03:00 PM
(This post was last modified: 09-29-2018, 03:00 PM by Kevin.)
Please show your code in order for us to help you better
read here on how to post code to the forum
http://www.quickmacros.com/forum/showthread.php?tid=786
Posts: 5
Threads: 2
Joined: Sep 2018
Macro 脚本1
int w4=win("分版制版传票" "TFrmZbSummonFbNew")
Acc a43.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=66 140" 0x1005) ;;这是订法
Acc a41.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=247 140" 0x1005) ;;这是印张
Acc a42.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=209 36" 0x1005) ;;注意这是采集订单的名称
str+ ddmc=a42.Name
str dingfa=a43.Name
str yz=a41.Name
double yz_dou=val(yz 2)
int yz_int=yz_dou
double ly=yz_dou-yz_int
str ly_str=ly
if (yz_dou<=3 and dingfa="胶订")
,mes- F"该订单正文有【{yz}】个印张,但其装订方式为胶订,订单无误请继续?" "提示" "OC!"
if (yz_dou>=8 and dingfa="骑马订")
,mes- F"该订单正文有【{yz}】个印张,但其装订方式为骑马订,订单无误请继续?" "提示" "OC!"
Acc a3.Find(w4 "CLIENT" " 对象列表" "class=TPanel" 0x1005)
a3.Mouse(1 150 8)
int w5=win("选择印件对象" "TfrmSelObjNew")
act w5
;
;
;wait 0.5
;
rep 20
,
,y=11+(20*h)
,
,int w7=win("选择印件对象" "TfrmSelObjNew")
,Acc a11.Find(w7 "CLIENT" "" "class=TdxTreeList" 0x1004)
,a11.Mouse(1 600 y)
,Acc a6.Find(w7 "CLIENT" "" "class=TdxInplaceTreeListTextEdit" 0x1005)
,str name=a6.Name
,if (name="胶轮" or name="胶平" or name="彩平" or name="彩轮")
,,yf[count]=a6.Name
,if (name="胶轮" or name="胶平" or name="彩平" or name="彩轮")
,,int w6=win("选择印件对象" "TfrmSelObjNew")
,,Acc a4.Find(w6 "CLIENT" "" "class=TdxTreeList" 0x1004)
,,a4.Mouse(1 12 y)
,,a4.Mouse(1 55 y)
,,Acc a4a.Find(w6 "CLIENT" "" "class=TdxInplaceTreeListTextEdit" 0x1005)
,,dx[count]=a4a.Name
,,if (matchw(dx[count] "*插*"))
,,,int cy=1
,,a4.Mouse(1 112 y)
,,Acc a4b.Find(w6 "CLIENT" "" "class=TdxInplaceTreeListTextEdit" 0x1005)
,,dxlx[count]=a4b.Name
,,if (dxlx[count]="单页")
,,,int+ dxjs=count
,,h=h+1
,,count=count+1
,else
,,h=h+1
,,
,,if(h>20) break
Posts: 1,338
Threads: 61
Joined: Jul 2006
it appears that your working with some type if treeview application
i would try and redo these lines
avoid using xy coordinates if all possible
Acc a43.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=66 140" 0x1005) ;;这是订法
Acc a41.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=247 140" 0x1005) ;;这是印张
Acc a42.Find(w4 "CLIENT" "" "class=TdxEdit[]xy=209 36" 0x1005) ;;注意这是采集订单的名称
in the lines below see if you can find the specific element your trying to click
,,a4.Mouse(1 12 y)
,,a4.Mouse(1 55 y)
and instead of a.Mouse
maybe try
something like
example of selecting a desktop item
int w=win("Desktop" "CabinetWClass")
Acc a.Find(w "LISTITEM" "New folder (2)" "class=DirectUIHWND" 0x1035)
a.Select(1|2)
or here is an example of selecting and putting a check mark in a treeview item in CCleaner
int w=win("CCleaner" "PiriformCCleaner")
Acc a.Find(w "OUTLINEITEM" "Internet History" "class=SysTreeView32[]id=1068" 0x1005)
a.Select(1|2)
a.Mouse(1 -2)
Try if at all possible not to use x y positions if you can
Posts: 5
Threads: 2
Joined: Sep 2018
Thank you for your answer! I haven't found the best way to find someone. Coordinates are one of the quickest ways to locate objects, but they don't work on other computers. The demonstration you gave made me suddenly enlightened. I will try hard and believe that I will succeed. Thank you again!
Posts: 5
Threads: 2
Joined: Sep 2018
I later used the discovery dialog's MATH # function to find the serial number of the corresponding object edit box so that I could locate the desired item without coordinates. The problem has been satisfactorily resolved. Thanks again, Kevin!
|