Access Violation in MSched.exe

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Access Violation in MSched.exe

Post by Jerry Thomas » Wed Oct 06, 2010 4:35 pm

I am getting an access violation at address 00419AFS in msched.exe.

My script is reading a text filelist (~2000 files) looking for duplicate names (excluding the extension ex; abc.JPG = abc.BMP). If I find a match, I rename the 2nd occurance to filename.ext.ext (abc.BMP.BMP).

On the 21st loop when I hit this line I get the violation.

StringReplace>strPrevFileName,strPrevExtension,.zzz,strPreviousZZZ
(On the previous file name, replace the extension with .zzz)

This happens in debug mode and in Run.
There is nothing unusual about this filename that is different than the previous 20. I tried removing it, and still crash.

Any suggestions how can I debug this further and see what is happening?
Windows7 (x64), MS 12.0.8

Here is entire subroutine

Code: Select all

SRT>CreateFileList
  Let>RP_WAIT=1

  // Create a filelist of all files under directory contained in image_path
  RunProgram>cmd /c dir %IMAGE_PATH% /s /b > %tempFile%

  Let>iCntr=1
  Let>strPreviousFile=blank.zzz

  // Write FILE_LIST
  ReadLn>tempFile,iCntr,strCurrentFile

  While>strCurrentFile<EOF>strCurrentFile,strCurrentExtension
    Length>strCurrentExtension,iCurrentExtension

    If>iCurrentExtension>1
      // Set previous and current file to .zzz extension and compare names
      StringReplace>strCurrentFile,strCurrentExtension,.zzz,strCurrentZZZ

      ExtractFileExt>strPreviousFile,strExtPrevious
      StringReplace>strPreviousFile,strExtPrevious,.zzz,strPreviousZZZ
      
      If>strCurrentZZZ=strPreviousZZZ
        // Rename current by adding the ext on the end again
        Let>strCurrentFile=%strCurrentFile%%strCurrentExtension%
      EndIf
      WriteLn>FILE_LIST,wrtResult,%iCntr%:%strCurrentFile%
    EndIf

    Let>iCntr=iCntr+1
    Let>strPreviousFile=strCurrentFile
    ReadLn>tempFile,iCntr,strCurrentFile
  EndWhile

END>CreateFileList
Thanks,
Jerry

[email protected]

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed Oct 06, 2010 5:24 pm

The corrected line vs. your incorrect line

Code: Select all

    While>strCurrentFile<>##EOF##
  //While>strCurrentFile<EOF>strCurrentFile,strCurrentExtension


Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Wed Oct 06, 2010 10:38 pm

I must have messed that up while cleaning up the pasted code.

My code reads as you state:
While>strCurrentFile##EOF##

The code is running. It just crashes on the 21st iteration.

Suggestions?
Thanks,
Jerry

[email protected]

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

Post by Marcus Tettmar » Thu Oct 07, 2010 8:06 am

Using the debugger with a breakpoint set befor that StringReplace line can you determine the values of:

strPrevFileName
strPrevExtension
.zzz
strPreviousZZZ

We can then try with the same set of values.

One issue with StringReplace just now is that it will cause a violation of the text you want to replace (in your case strPrevExtension) is an empty string. This will be fixed in the next update. I wonder if this is what you are running into. Maybe, maybe not, but until we can see the data values we can't test it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Thu Oct 07, 2010 3:41 pm

Sorry, I am being brain dead...

My string (strPrevExtension) was empty, as you suggested.
Thanks,
Jerry

[email protected]

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