Access Violation

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Access Violation

Post by johngccfc » Mon Nov 21, 2011 6:14 pm

Hi,

I'm banging my head off the wall a bit and would really appreciate any help or advice on my issue.

I've written my first script (v13) and am having constant Access Violation errors.

I have a relatively straight forward script which opens a program, moves around, clicks an update button, moves around and then clicks an export button to export this updated data and provide a filename to an openfile dialogbox in the program.

Besides moving the mouse, doing a few Press button commands it actually does little except for the following commands;

- WaitScreenImage
- FindImagePos

These both seem to work ok, as in, they do find the bmp successfully.

So back to the Access Violation.

I'm a competant .NET developer so am aware of attempting to overcome issues.

I've tried using WriteLn writing to a log to find out where the problem is occuring, it doesn't seem to be in THAT many places though it seems mainly (though not at all exclusively) around the programs "open/select file" dialog box. However, this is not by any means the rule.

I'm using a while loop to cycle round 14 similar iterations of the routine, only difference being a variable that changes each loop.

One time the access violation occured, I clicked OK to acknowledge the violation and miraculously, as the program was in a particular place, it actually carried on and successfully completed all 14 loops (the violation message came in loop 1 or 2). I have had the script successfully complete loop 1 and commence loop 2 on occasion so I don't believe, for example that the end of loop 1 is obviously errant.

The point is that I'm sure the script is good. I have run each of the 14 loops individually and each has worked on its own. There was though, more often than not, an access violation message that would spring up at the end though this didn't affect the independant running of the 'loop item'.

I've tried scp and exe called from VBA, and running the script directly from Macro Scheduler, and have tried all combinations in an individual and altogether as a 14-loop process. Nothing seems to stop the access violation message from appearing.

I've tried putting ever longer wait commands all over the place too.


here's the script as a whole;

-------------------------------


// COMPILE_OPTS|D:\Macro Scheduler Scripts\CallMishMashFromAccessQuicker_ALL.exe||CONSOLE=0|INCLUDES=1|

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1


Let>iCount=0
Let>TheStatus=NOTHING
Let>CurrentProject=NOTHING
MouseMove>100,100


While>iCountC:\Program Files (x86)\MishMash\MishMash.exe,

WaitWindowOpen>MishMash - Paid Version (Registered To: [email protected])
MoveWindow>MishMash - Paid Version (Registered To: [email protected]),33,24
ResizeWindow>MishMash - Paid Version (Registered To: [email protected]),1024,720
Wait>2



If>iCount=0
Let>CurrentProject=AUTH_BestNoise
Endif
If>iCount=1
Let>CurrentProject=AUTH_CircularSaw
Endif
If>iCount=2
Let>CurrentProject=AUTH_DigiMusic
Endif
If>iCount=3
Let>CurrentProject=AUTH_Generator
Endif
If>iCount=4
Let>CurrentProject=AUTH_GPS
Endif
If>iCount=5
Let>CurrentProject=AUTH_LawnMower
Endif
If>iCount=6
Let>CurrentProject=AUTH_MiterSaw
Endif
If>iCount=7
Let>CurrentProject=SPR_BestNoise
Endif
If>iCount=8
Let>CurrentProject=SPR_CircularSaw
Endif
If>iCount=9
Let>CurrentProject=SPR_DigiMusic
Endif
If>iCount=10
Let>CurrentProject=SPR_Generator
Endif
If>iCount=11
Let>CurrentProject=SPR_GPS
Endif
If>iCount=12
Let>CurrentProject=SPR_LawnMower
Endif
If>iCount=13
Let>CurrentProject=SPR_MiterSaw
Endif


// ** 2, OPEN PROJECT **
Press ALT
Send>f
Release ALT
Press Down
Press Enter
WaitWindowOpen>Open Project
MoveWindow>Open Project,42,85
ResizeWindow>Open Project,758,519
Wait>2
Send>%CurrentProject%.msam
Wait>2
Press Enter
WaitWindowOpen>MishMash - Paid Version (Registered To: [email protected])
MoveWindow>MishMash - Paid Version (Registered To: [email protected]),33,24
ResizeWindow>MishMash - Paid Version (Registered To: [email protected]),1024,720
Wait>30

// ** 3, UPDATE HISTORIC RANK DATA **
//
// check All Keywords box
Press Tab * 12

// ensure set to Majestic SEO
Press ALT
Press Up
Release ALT
Press Enter
Wait>2
Press Tab
Wait>2

// ensure set to Historic
Press ALT
Press Up
Release ALT
Wait>2

// move to All Keywords checkbox
Press Tab * 4
Wait>2
Press Space
Wait>2

// click Update Rank Data button
Press SHIFT
Press Tab
Release SHIFT
Press Enter
Wait>90

// detect when updating has finished
WaitScreenImage>D:\Macro Scheduler Scripts\BottomBtns.bmp
Wait>5

// ** 4, EXPORT HISTORIC RANK DATA **
//
// click Export Button
FindImagePos>D:\Macro Scheduler Scripts\ExportBtn.bmp,WINDOW:MishMash - Paid Version (Registered To: [email protected]),0,1,XArr,YArr,NumFound
if>imgs>0
MouseMove>XArr_0,YArr_0
LClick
Wait>2
MouseMove>100,100
Endif

WaitWindowOpen>Export Rank Tracker Keyword Data
MoveWindow>Export Rank Tracker Keyword Data,42,85
ResizeWindow>Export Rank Tracker Keyword Data,758,519
Wait>10

//write export file
Year>the_year
Month>the_month
Day>the_day
Let>filename=%CurrentProject%_%the_year%%the_month%%the_day%_Historic
Send>%filename%
Wait>10
Press Enter
Wait>10

WaitWindowOpen>MishMash - Paid Version (Registered To: [email protected])
MoveWindow>MishMash - Paid Version (Registered To: [email protected]),33,24
ResizeWindow>MishMash - Paid Version (Registered To: [email protected]),1024,720
Wait>10

// ** 5, UPDATE FRESH RANK DATA **
//
// check All Keywords box
Press Tab * 9

// ensure set to Fresh
Press ALT
Press Down
Release ALT
Wait>2

// move to All Keywords checkbox
Press Tab * 4
Wait>2
Press Space
Wait>2

// click Update Rank Data button
Press SHIFT
Press Tab
Release SHIFT
Press Enter
Wait>20

// detect when updating has finished
WaitScreenImage>D:\Macro Scheduler Scripts\BottomBtns.bmp
Wait>2

// ** 6, EXPORT FRESH RANK DATA **
//
// click Export Button
FindImagePos>D:\Macro Scheduler Scripts\ExportBtn.bmp,WINDOW:MishMash - Paid Version (Registered To: [email protected]),0,1,XArr,YArr,NumFound
if>imgs>0
MouseMove>XArr_0,YArr_0
LClick
Wait>2
MouseMove>100,100
Endif

WaitWindowOpen>Export Rank Tracker Keyword Data
MoveWindow>Export Rank Tracker Keyword Data,42,85
ResizeWindow>Export Rank Tracker Keyword Data,758,519
Wait>10

//write fresh export file
Year>the_year
Month>the_month
Day>the_day
Let>filename=%CurrentProject%_%the_year%%the_month%%the_day%_Fresh
Send>%filename%
Wait>10
Press Enter
Wait>10

WaitWindowOpen>MishMash - Paid Version (Registered To: [email protected])
MoveWindow>MishMash - Paid Version (Registered To: [email protected]),33,24
ResizeWindow>MishMash - Paid Version (Registered To: [email protected]),1024,720
Wait>10


// 7, CLOSE PROJECT
Press ALT
Send>f
Release ALT
Press Down * 3
Press Enter
Wait>5


// 8, CLOSE MishMash
Press ALT
Send>f
Release ALT
Press Up
Press Enter
Wait>10


Let>iCount=iCount+1

EndWhile



MessageModal>Job Complete

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Nov 21, 2011 7:06 pm

Your opening While> statement is

"While>iCountC:\Program Files (x86)\MishMash\MishMash.exe, "

Is that correct or did the forum software rearrange the text for you.

johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Post by johngccfc » Mon Nov 21, 2011 7:12 pm

its correct in the code

the forum must have messed it up

good spot though

johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Post by johngccfc » Mon Nov 21, 2011 7:13 pm

snip, dupe post

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Nov 21, 2011 8:55 pm

So what DO the lines around the While> look like?

I don't see anything else in your code that might cause any problems. Perhaps there is some interference with the "MishMash" software? I don't have it or even know what it does so I can't test that notion.

johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Post by johngccfc » Mon Nov 21, 2011 8:58 pm

While>iCount<14

...


EndWhile

johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Post by johngccfc » Mon Nov 21, 2011 9:03 pm

JRL wrote:Perhaps there is some interference with the "MishMash" software? I don't have it or even know what it does so I can't test that notion.
MishMash is to disguise the real name, a better clue would be;

m*rket samur*i

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

Post by Marcus Tettmar » Mon Nov 21, 2011 9:11 pm

Can you try v13.0.01 which has just been uploaded to the site. Available in the registered area and trial downloads.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

Post by johngccfc » Mon Nov 21, 2011 10:27 pm

using v13.0.01 things are much the same.

if anything, it now happens slightly more randomly (gut feel)

perhaps even Macro Scheduler seems to hanging more often rather than getting as far as the error message

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Tue Nov 22, 2011 5:38 am

Johngccfc,
I've read your original post and script.
1. What's the exact wording of the error message in question?
2. Have you checked trailing spaces?
It seems to me a timing issue.
For example,
While>iCountC:\Program Files (x86)\MishMash\MishMash.exe
WaitWindowOpen>MishMash - Paid Version (Registered To: [email protected])
// Insert a wait here to allow time for MishMash to be loaded
Wait>5
/* You may use WaitScreenImage to check if the desired screen shows up
successfully. */


MoveWindow>MishMash - Paid Version (Registered To: [email protected]),33,24
ResizeWindow>MishMash - Paid Version (Registered To: [email protected]),1024,720
Wait>2

You may check if Macro Scheduler is compatible with Adobe AIR 3.

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

Post by Marcus Tettmar » Tue Nov 22, 2011 8:45 am

@johngccfc could you email support and we'll return with a debug version which logs the AVs and hopefully will give us a clue as to what is going on.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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