It’s possible to use AppleScript and Microsoft Office for the Mac to provide improved integration between Surround SCM and Microsoft Word on the Macintosh. Below are some sample AppleScript snipets that show you how to do this. None of these have full error handling, but should server as an example of how you might leverage these two tools. For all of these samples, open up the AppleScript Script Editor application, paste the script in and save the file as an application.
Compare
To use AppleScript to compare two document revisions, try the following.
on run argv set file1 to (POSIX file (item 1 of argv as string)) as string set file2 to (POSIX file (item 2 of argv as string)) as string tell application "Microsoft Word" activate open file name file1 without add to recent files compare active document path file2 close document file1 (* We don't want the difference file to ask us to save it*) set saved of active document to true end tell end run
In Surround SCM, follow the instructions in the User Guide for setting diff/merge options and use the following command for Word documents (e.g. *.doc). In this case, I’ve saved my script with the name Compare.app in the same folder as the Surround SCM application.
osascript "/Applications/Surround SCM/Compare.app" "%2" "%1"
View
Try the following AppleScript for viewing Word documents to avoid having these “temporary” files added to your list of recently opened files.
on run argv set file1 to (POSIX file (item 1 of argv as string)) as string tell application "Microsoft Word" open file name file1 without add to recent files activate end tell end run
In Surround SCM, follow the instructions in the User Guide for setting view/edit file options and use the following command for all Word documents (e.g. *.doc). Here I’ve save the script with the name Open.app in the Surround SCM application folder.
osascript "/Applications/Surround SCM/Open.app" "%1"Share on Technorati . del.icio.us . Digg . Reddit . Slashdot . Facebook . StumbleUpon
Related posts:










June 24, 2010
[...] I’d like to draw your attention to some AppleScripts written by yours truly. The first is here and provides some instructions on how to use Microsoft Word on the Mac for merging and diffing [...]