The script flow would be something like this;

open script
script calls for you to locate .md5 file (file which contains the information we need)
parses first line, seperating the MD5 and the Filename into serperate variables (GoodMD5 and File, respectively)
checks the directory of the .md5 file for a file with the same name as File
If found, runs ‘md5’ from terminal on File, setting this output to variable FileMD5
then checks if GoodMD5 = YourMD5
If they match, prints some kind of ‘File Okay’ message
If they don’t match, print a ‘File Corrupt. MD5 is (YourMD5), should be (GoodMD5)’
repeat, parsing next line of the text file until End Of File

What I’m having trouble with here is seperating the lines of the file into variables.

A line of .md5 file looks something like this;

07f73cd474cdf8dcc03c13e7743d4043 *sp112900_d1_t14.shn

I’m currently using a delimiter script to seperate them, as so;

set theText to "07f73cd474cdf8dcc03c13e7743d4043 *sp112900_d1_t14.shn"

set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to " *"
set newText to text items of theText
set AppleScript's text item delimiters to OldDelims

Whew. That was a mouthful.

  • phil

First, be careful because you have now opened two threads for the same topic (make sure you hit the “Post Reply” button, not “New Topic”). Next, take a look at pescados software’s checkSum+.


To get the parts into separate variables, replace the line:

set newText to text items of theText


set GoodMD5 to text item 1 of theText
set theFile to text item 2 of theText

and you’re set.