Doesn't work the same

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
gregpet
Newbie
Posts: 13
Joined: Wed May 22, 2013 8:11 pm

Doesn't work the same

Post by gregpet » Mon Oct 14, 2013 10:52 pm

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

User avatar
Grovkillen
Automation Wizard
Posts: 1045
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Post by Grovkillen » Tue Oct 15, 2013 6:22 am

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...
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Oct 15, 2013 8:56 am

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
Then image_8.bmp never appears, is never found.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

gregpet
Newbie
Posts: 13
Joined: Wed May 22, 2013 8:11 pm

Post by gregpet » Mon Oct 21, 2013 7:56 pm

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?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts