|
How-To Write an Open Handler
Here's a sample showing how to write some text out to a file using AppleScript's
write command (Scripting Addition).
|
Sample
|
var theText = "Some text";
var startupDiskName = MacOS.finder().desktop.startup_disk.name;
var outputFile = new MacOS.FileSpec(startupDiskName + ":Desktop Folder:test.html");
with (MacOS.appSelf()) {
var fileRef = open_for_access(outputFile,
true);
try {
write(theText,
null, null, fileRef);
close_access(fileRef);
}
catch (e) {
close_access(fileRef);
throw e;
}
} |
|
|