|
How-To Write an Open Handler
Here's a sample showing how to declare a handler that responds to the
Open Document AppleEvent (the one generated when you drop files onto a
script using the Finder). This sample also shows how to ask the Finder
for information about a file.
|
Sample
|
function open(AE_params) {
var theFiles = AE_params.of;
var theNames = "";
for (var i = 0; i < theFiles.length;
++i) {
with (MacOS.finder())
{
if
(theNames != "")
theNames
+= ", ";
//
ask the Finder for the name of the file
theNames
+= newReference(_types.item, theFiles[i]).name;
}
}
MacOS.message("open: " + theNames);
} |
|
|