Source language: Translate to:

Compare files query

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Sam Cox » Thu Feb 15, 2007 3:00 pm

Hello nikos,

Are you looking for an exact match, or do you want to compare details of the files' content? That is, would it suffice to show that the files are identical byte-for-byte, or must you examine the content?

If all you need is byte-for-byte comparison AND you are willing to use the hpwNewLisp plugin, comparing any two files straightforward. It would be a newLisp one-liner.

-- Sam
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby Sam Cox » Thu Feb 15, 2007 3:13 pm

Hello nikos,

If you're look for an exact file match, Neobook can do it without newLisp's help:
Code: Select all
SetVar "[File]" "C:\Downloads\Cupertino Phone List.xls"
FileRead "[File]" "all" "[Bob]"
FileRead "[File]" "all" "[Eddie]"
If "[Bob]" "=" "[Eddie]"
   Alertbox "MATCH" "The files match."
Else
   Alertbox "NO MATCH" "The files don't match."
Endif
Strlen "[Bob]" "[Bob.Len]"
AlertBox "LENGTH" "Bob.Len = [Bob.Len]

In this example, I read the entire contents of the file named in [File] twice and compare the results of the two reads. In your case, you would read two different files -- the master file and the student's file. The bit at the end involving StrLen is there just to show that we've read every byte of the file. It's not necessary in actual operation.
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby TMcD » Thu Feb 15, 2007 4:27 pm

Nikos,

I'm not sure if pulling the contents (of something other than text/ascii) will work when comparing them as variables. (Forgeive me if I am wrong Sam... eheh, I trust you more than myself... eheh) :roll:

Troy
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron