Re: File creation date in a macro?
Posted by
vischer on
Nov 14, 2008; 11:34pm
URL: http://imagej.273.s1.nabble.com/File-creation-date-in-a-macro-tp3694500p3694504.html
Hi Curtis
here is a macro that extracts the creation date via AppleScript.
It has been partly created with my AppleScript Wrapper
(see
http://simon.bio.uva.nl/AppleScript/AppleScriptWrapper.html )
It only works on the startup volume - perhaps some AppleScript expert
can tell
me how to remove this limitation.
macro "myScript"{
pth = File.openDialog("Select a File");
idx = indexOf(pth, "/") ;
if (idx >= 0)
pth= substring(pth, idx+1, lengthOf(pth));//remove first element
pth = replace(pth, "/", ":");
pth = '"' +pth + '"' + " of startup disk ";
var1 = pth;
cr = fromCharCode(13);
String.resetBuffer;
String.append('tell application "Finder"' +cr);
String.append('set var1 to file' + var1 +cr);
String.append('get the creation date of var1' +cr);
String.append('end tell');
result = exec("osascript", "-e", String.buffer);
print(result);
}
result:
Monday, 27. October 2008 23:20:45
Norbert