I’m trying to update my AppleScripts to use System Events instead of “info for”, which I know has been deprecated. This has been fairly easy, except for this one. I use modification date and current date to determine whether a file has been completely written to the OS X file system from the SheepShaver emulator, like this:
delay 1
repeat while (current date) - (modification date of (info for thisFile)) < 2
delay 2
end repeat
Can anyone suggest how I can use System Events instead of “info for” in this routine?
set thisFile to "a:b:c:d"
delay 1
repeat
tell application "System Events" to modification date of disk item (thisFile as text)
if (current date) - result < 2 then exit repeat
delay 2
end repeat
would do the trick.
Yvan KOENIG (VALLAURIS, France) lundi 10 septembre 2012 10:27:14
This doesn’t use ‘current date’ at all but simply compares the file’s modification date with its previous value:
set thisFile to "a:b:c:d"
tell application "System Events"
set thisItem to disk item (thisFile as text)
set |then| to thisItem's modification date
delay 1
set now to thisItem's modification date
repeat while (now comes after |then|)
delay 2
set |then| to now
set now to thisItem's modification date
end repeat
end tell
delay is together with display dialog and display alert in the User Interactions Suite of Standard Additions, I guess the whole suite are exceptions from the rules about privilege violation.
set thisFile to "Macintosh HD:Users:yvankoenig:Desktop:convert & merge excel to csv.scpt"
delay 1
repeat
tell application "System Events" to modification date of disk item (thisFile as text)
if not (current date) - result < 2 then exit repeat
delay 2
end repeat
Yvan KOENIG (VALLAURIS, France) lundi 10 septembre 2012 17:02:48