I am using Macro Scheduler to automate 4 reports generated by Quickbooks on a terminal server.
Once the reports reports are displayed on the screen I save them to an Excel file. The saving code is in a subroutine so it is the same for all 4 reports.
The problem is it doesn't work for the 3rd and 4th reports. Here is the code I have.
If I use debug or trace and start at line //Report #3 it works for #3, but doesn't for #4. Same if I start debug or trace from line //Report #4.
What is causing it not to execute the Excel sub correctly the 3rd and 4th time?
Thanks for looking.
//Report #1
//Wait for
WaitScreenImage>%BMP_DIR%\image_7.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.5
gosub excel
Let>SK_DELAY=20
Let>SK_IGNORECAPS=0
SendText>\\tsclient\C\Users\GPetersen\Documents\2013\Monthly\GBT P&L
wait>0.2
Press Enter
gosub confirm
wait>5
SetFocus>192.168.196.40 - Remote Desktop Connection
Press Tab
//Report #2
Let>SK_DELAY=10
SendText>1/1/2013
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_6.bmp,WINDOW:192.168.196.40 - Remote Desktop Connection,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
//Wait for
WaitScreenImage>%BMP_DIR%\image_9.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>1
gosub excel
//Wait for
WaitScreenImage>%BMP_DIR%\image_8.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.2
Let>SK_DELAY=15
Let>SK_IGNORECAPS=0
SendText>\\tsclient\C\Users\GPetersen\Documents\2013\Monthly\GBT P&L YTD
wait>0.2
Press Enter
gosub confirm
gosub close
//Report #3
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_11.bmp,WINDOW:192.168.196.40 - Remote Desktop Connection,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
wait>0.1
LClick
Endif
//Wait for
WaitScreenImage>%BMP_DIR%\image_14.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>1
gosub excel
This is where it stops, it is not doing the excel sub and then waits here
//Wait for
WaitScreenImage>%BMP_DIR%\image_8.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.7
Let>SK_DELAY=15
Let>SK_IGNORECAPS=0
SendText>\\tsclient\C\Users\GPetersen\Documents\2013\Monthly\GBT BS
wait>0.2
Press Enter
gosub confirm
gosub close
//Report #4
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_12.bmp,WINDOW:192.168.196.40 - Remote Desktop Connection,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
wait>0.1
LClick
Endif
//Wait for
WaitScreenImage>%BMP_DIR%\image_13.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.2
gosub excel
//Wait for
WaitScreenImage>%BMP_DIR%\image_8.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.7
Let>SK_DELAY=15
Let>SK_IGNORECAPS=0
SendText>\\tsclient\C\Users\GPetersen\Documents\2013\Monthly\GBT CF
wait>0.2
Press Enter
gosub confirm
gosub close
Let>MSG_STAYONTOP=1
MessageModal>All Done
SRT excel
Press ALT
Let>SK_DELAY=10
SendText>x
SendText>n
SendText>x
Release ALT
wait>5
END>excel
SRT confirm
//Wait for
WaitScreenImage>%BMP_DIR%\image_5.bmp,0.7,CCOEFF
SetFocus>192.168.196.40 - Remote Desktop Connection
wait>0.2
Press Tab
wait>0.1
Press Enter
wait>10
END>confirm
SRT close
// CLOSE P&L Window
SetFocus>192.168.196.40 - Remote Desktop Connection
Press CTRL
wait>0.1
Press F4
wait>0.1
release CTRL
END>close
Doesn't work the same
Moderators: Dorian (MJT support), JRL
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Hello,
Not sure if it helps but you are not sticking with the correct way of using some of the commands. I.E.
gosub excel should be GoSub>excel
gosub confirm should be GoSub>confirm
gosub close should be GoSub>close
and the Subroutines
SRT close
...
END>close
should be
SRT>close
...
END>close
Try fix those and see if you have any more luck...
Not sure if it helps but you are not sticking with the correct way of using some of the commands. I.E.
gosub excel should be GoSub>excel
gosub confirm should be GoSub>confirm
gosub close should be GoSub>close
and the Subroutines
SRT close
...
END>close
should be
SRT>close
...
END>close
Try fix those and see if you have any more luck...
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Then image_8.bmp never appears, is never found.This is where it stops, it is not doing the excel sub and then waits here
//Wait for
WaitScreenImage>%BMP_DIR%\image_8.bmp,0.7,CCOEFF
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
I fixed the syntax, but it did not seem to make a difference.
After working with TRACE more it seems like the excel subroutine is not working after the first 2 times.
Also, if I start at the begining of report #3, then #3 works fine, but stops at #4.
Any ideas as to why? Is there something I need to reset during the program?
After working with TRACE more it seems like the excel subroutine is not working after the first 2 times.
Also, if I start at the begining of report #3, then #3 works fine, but stops at #4.
Any ideas as to why? Is there something I need to reset during the program?