An Apple OS X folder action script to load a TIFF file saved from VueScan

This is pretty basic, but since I didn't see anything similar on IgorExchange, I decided to submit it.

I do a lot of analyses of scanned images; sometimes hundreds in a marathon session. Typically, the scan will be initiated and the resulting file auto-saved from VueScan (http://www.hamrick.com/). I thought it would be convenient to provide some feedback and perhaps do the full analysis "on-the-fly" during scanning. The following is a Folder Action, created in AppleScript Editor, and then attached, with Folder Actions Setup, to the folder that receives the scanned images. Using the Do Script command, the action script sends the name of the Igor Pro function to execute, along with the full path of the image just placed in the folder. The Igor code is contained in the AppleScript comment and, in this example, it just loads and displays the image. A more general script would check that the correct file format was placed into the folder, that Igor was actually running, etc.

This is a general approach to triggering Igor to do something useful in response to a file being added to an OS folder.


(*
Igor Pro - Load TIFF Image.scpt

This Folder Action handler is triggered whenever items are added to the attached folder.
The script tells Igor Pro to load the TIFF images just added to the folder.

The Igor part of this is very simple and can be extended to perform other image processing operations:

----------------------------------------
Function LoadTIFF(filename)
    string filename
   
    ImageLoad/T=tiff/G filename

End

----------------------------------------

This was originally developed to automatically load images saved from
VueScan using the "@.tif" autonaming option.

So that the script shows up in Folder Actions Setup, it should be located in Macintosh HD\Library\Scripts\Folder Action Scripts
*)

on adding folder items to this_folder after receiving these_items

tell application "Igor Pro"

repeat with aFile in these_items
Do Script "LoadTIFF(" & "\"" & aFile & "\"" & ")"
end repeat

end tell

end adding folder items to

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More