Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistent Behavior
#1
I have a macro that opens a report off a web site, copies the data to excel and then closes the report web page. It does this process 19 times using 2 functions.

The problem is that I receive the window not found error at different times in the macro. Sometimes I can run the macro through 17 of the reports. The next time I run the macro I can only get through 3 reports. Run it again and get through 15 of the reports.

I am trying to figure out why I receive this error and why at different times. Any ideas of what to look for?

I have slowed the macro done to spe 500.
I close the report window by name.
I always re-activate the menu window prior to selecting the report.

Thanks for any help.
#2
I would like to see the macro.
#3
The really odd thing is I can run these in debug mode. But once I am out of debog mode it stops at various places.

Here is the macro and the functions used.

Thanks!


Attached Files
.qml   CQI Reports.qml (Size: 4.11 KB / Downloads: 455)
#4
1. I recommend to use window handles.
2. Remember that initial function's speed is 0. Maybe it runs too fast.
3. I think the function should wait for the report window, even if it waits while IE is busy.

Macro:

Code:
Copy      Help
;Deb

str ttime
out ttime.time

int ie
ie=win(":: P.E.D.S. :: - Microsoft Internet Explorer provided by CS&O")
if(!ie) ret

;Direct Service Reports
ReportCopy(ie "Direct Services (Aggregate)" "DS (AGG)")
ReportCopy(ie "Direct Services (Individual)" "DS (IND)")
ReportCopy(ie "Direct Services (All)" "DS (All)")
ReportCopy(ie "Direct Service Contacts" "DS - Contacts")

;Participant Data
ReportCopy(ie "Direct Service Contacts by Demographics" "DS - Demo")
ReportCopy(ie "Nonduplicated Participant Counts" "NonDup")
ReportCopy(ie "Counts of Participants (Some Duplication)" "Some Dup")
ReportCopy(ie "Nonduplicated Participant Count by Service" "NonDup -Service")

;Other Activity Data
ReportCopy(ie "Community Strengthening Efforts" "CS")
ReportCopy(ie "Provider Capacity Building/Support" "PC")
ReportCopy(ie "Infrastructure Investments" "II")
ReportCopy(ie "Systems Change Support Activities" "SC")

;Outcome Data (core)
ReportCopy(ie "Intake Report" "Intake")
ReportCopy(ie "Intake / Follow-up Report" "Intake - Followup" 1)

;Progress and Fiscal Reports
ReportCopy(ie "Funds Spent by Strategy" "Funds")
ReportCopy(ie "Achievement Milestones" "AM")

;Service Quality Reports
ReportCopy(ie "Intensity of Services" "Int")
ReportCopy(ie "Duration of Services" "Dur")
ReportCopy(ie "Comprehensiveness of Services" "Comp")

out ttime.time

Function ReportCopy:

Code:
Copy      Help
function ie str'ButtonName str'SheetName [intake]
;Deb
spe 100 ;;because initial function's speed is 0
act ie
Acc rep1=acc(ButtonName "PUSHBUTTON" ie "Internet Explorer_Server" "" 0x1001)
rep1.DoDefaultAction
wait 0 I
int ie2=act(wait(10 "PEDS - Microsoft Internet Explorer provided by CS&O"))

if(intake)
,'TTTTTTTTTiT0

Acc a=acc("Run Report" "PUSHBUTTON" ie2 "Internet Explorer_Server" "" 0x1001)
a.DoDefaultAction
wait 0 I
men 41028 ie2 ;;Select All
men 41026 ie2 ;;Copy
0.2

ExcelPaste SheetName
clo ie2
1
#5
This worked great. I want to thank you for your quick response!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)