Script File comparison

Hi,

When I am using FileMerge and compare two different versions of a script file, it says "Files are not ASCII", if I 'proceed anyway' I am seeing lots of special characters.

How can I do a better file comparison(.scpt)?

regards
Mowri

MacBook Pro, Mac OS X (10.5.8), comparison, FileMerge, Version control

Posted on Mar 31, 2010 6:08 AM

Reply
5 replies

Mar 31, 2010 8:55 AM in response to Mowri

Here's a very basic script that will accomplish what you're asking:

<pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
title="Copy this code and paste it into your Script Editor application.">
set tmpDir to do shell script "mktemp -d /tmp/CompareScripts.XXXXXXXXX"
set leftFile to tmpDir & "/left"
set rightFile to tmpDir & "/right"
set script1 to quoted form of POSIX path of (choose file)
set script2 to quoted form of POSIX path of (choose file)
do shell script "osadecompile " & script1 & ">" & leftFile & ¬
";osadecompile " & script2 & ">" & rightFile & ¬
";/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge -left " & ¬
leftFile & " -right " & rightFile & ";rm -rd " & tmpDir
</pre>

This script is very basic and has no error checking incorporated. Here's what the script does when run:

1) Creates a uniquely named directory in the "/tmp" directory.
2) Asks you to locate script file #1 (left file for FileMerge comparison).
3) Asks you to locate script file #2 (right file for FileMerge comparison).
4) Launches FileMerge and loads the 2 files for comparison.
5) Deletes the directory it created in the beginning when you quit FileMerge.

The script will continue to run until you quit FileMerge. The script can be modified in many different ways depending on the exact task you'd like for it to achieve. You can also modify the script to be a droplet so you can just drop 2 scripts on it for comparison.

Hope this at least gets you started in the right direction.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Script File comparison

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.