Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scan Issue
#1
Dear Friends,

This code worked first few times then suddenly gets stuck at the SalesBrief.bmp set of commands:
It says cannot find object...Sales Brief is a tab in the CRM

Macro gDN Data
Code:
Copy      Help
;---- Recorded 28-Sep-13 11:54:00 AM ----

opt slowkeys 1; opt slowmouse 1; spe 100

rep 2
,int w1=act(win("Microsoft Excel - " "XLMAIN"))
,'D; 0.25  ;; Down
,;get selected cells in Excel
,ExcelSheet es.Init
,ARRAY(str) vin
,es.CellsToArray(vin "sel")
,str varVin = vin
,;lef 343 15 win("" "Shell_TrayWnd") 1; 1.82 ;;tool bar 'Running applications', push button 'Vehicle Administration - Al...'
,
,;Click Open
,int w2=act(win("Vehicle Administration " "KCMLMasterForm_32"))
,Acc a.Find(w2 "PUSHBUTTON" "Open" "class=ToolBar_Class[]id=66" 0x1005)
,a.Mouse(1)
,
,;Click Full Chassis
,int w3=wait(5 win("Vehicle Search Window" "KCMLMasterForm_32"))
,Acc a1.Find(w3 "RADIOBUTTON" "Full Chassis" "class=KCMLButton_32[]id=26692" 0x1005)
,a1.Mouse(1)
,
,;Enter Full Chassis from vin variable
,int w=win("Vehicle Search Window" "KCMLMasterForm_32")
,Acc a2.Find(w "TEXT" "" "class=Edit[]state=0x100000 0x20000040" 0x1004)
,key (varVin)
,
,;Click Search
,int w6=win("Vehicle Search Window" "KCMLMasterForm_32")
,Acc a3.Find(w6 "PUSHBUTTON" "Start Search" "class=KCMLButton_32[]id=26686" 0x1005)
,a3.Mouse(1)
,
,;Double click record per given vin variable
,int wMain=win("Vehicle Search Window" "KCMLMasterForm_32")
,w=id(100 wMain) ;;KCMLGridPad_32
,RECT r; SetRect &r 114 21 333 46
,WindowText wt.Init(w r)
,wt.Mouse(4 wt.Find(varVin 0x3))
,
,
,;Click Sales Brief
,;wait 30 WT w2 "Vehicle Administration "
,int w7=win("Vehicle Administration - Display mode " "KCMLMasterForm_32")
,scan "SalesBrief.bmp" child("" "KTabEars" w7) 0 1|2|16
,lef; 0.25
,
,
,
,;Obtain Customer Name
,;;int wMain1=win("Vehicle Administration - Display mode " "KCMLMasterForm_32")
,w=child("" "Edit" w7 0x0 "" 7) ;;editable text
,wt.Init(w)
,str customerName=wt.CaptureToString
,wt.End
,
,;Obtain Registration Number
,w=child("" "Edit" w7 0x0 "" 16) ;;editable text
,wt.Init(w)
,str regNumber=wt.CaptureToString
,wt.End
,
,;Obtain PO Box and City in array
,;;int wMain1=win("Vehicle Administration - Display mode " "KCMLMasterForm_32")
,w=child("" "Edit" w7 0x0 "" 8) ;;editable text
,WindowText varCRM.Init(w)
,varCRM.Capture
,varCRM.End
,str varPOBox=varCRM.a[0].txt
,str varCity=varCRM.a[1].txt
,str varSplitPO
,,;split
,,tok(varPOBox varSplitPO 1 "x" 2)
,;Remove Spaces
,varSplitPO.trim(" ")
,
,
,;Click Customer button
,int w5=win("Vehicle Administration - Display mode " "KCMLMasterForm_32")
,Acc a6.Find(w5 "PUSHBUTTON" "Customer" "class=KCMLButton_32[]id=26938" 0x1005)
,a6.Mouse(1)
,
,;Obtain mobile number
,int w4=wait(7 win("Philip Jacob's CRM" "KCMLMasterForm_32"))
,w=child("" "Edit" w4 0x0 "" 4) ;;editable text
,wt.Init(w)
,str varMobile=wt.CaptureToString
,wt.End
,
,;Exit Customer CRM
,Acc a5.Find(w4 "PUSHBUTTON" "Exit" "class=ToolBar_Class[]id=66" 0x1005)
,a5.Mouse(1)
,
,
,
,;;**********************Activate excel & key all obtained variable to excel************************
,act w1
,
,;Key customer Name
,'R; 1     ;; Right
,key (customerName)
,
,
,;Key registration number
,'TTTT; 1  ;; Tab Tab Tab Tab
,key (regNumber)
,'T; 1        ;; Tab
,
,key (varMobile)
,'T; 1
,
,key (varSplitPO)
,
,;Save Excel Data
,'Cs; 3       ;; Ctrl+S

opt slowkeys 0; opt slowmouse 0; spe -1
;----------------------------------------
Best Regards,
Philip
#2
Some possible reasons:
The on-screen image changed. If just background changed, try to use colorDiff with scan, for example 50.
child("" "KTabEars" w7) finds wrong child window. Try to search in whole window, ie replace child("" "KTabEars" w7) to w7.
The image is still not displayed whne scan is executed. Tr to replace scan ... with wait 10 S ...


Forum Jump:


Users browsing this thread: 1 Guest(s)