Hi,
I’ve got an occasional problem with out MYOB data file, in that it occasionally, and for no obvious reason, makes its way into the trash. Currently, it’s held on a spare internal drive on one of the macs on our network. When it happened yesterday, I found the path to the file in the drive’s .Trashes folder, and wrote the following applescript:
set theFile to "/Volumes/Repository/.Trashes/501/ourFile.myo/" as string
tell application "Finder"
if exists file theFile then tell application "Mail"
activate
set theAddress to "kevin@domain.co.uk, kate@domain.co.uk, accounts@domain.co.uk, ian@domain.co.uk"
set theSubject to "MYOB's in the trash again"
set theBody to "Warning! Warning! Warning! The MYOB file's in the Trash again!"
tell application "Mail"
set newMessage to make new outgoing message with properties {recipient:theAddress, subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to true
make new to recipient at end of to recipients with properties {address:theAddress}
send
end tell
end tell
end tell
tell application "Finder"
if not (exists file theFile) then display dialog "everything's cool"
end tell
end tell
end
end
The idea is that this will be set to run a couple of times a day, and just alert everyone if there’s been a problem. Doesn’t work, though. The path’s right, permissions on the .Trashes/501 folder allow access, but the script keeps returning ‘everything’s OK’ even when it isn’t (binned the file for a test).
I’ve have tried this script on a test file binned from the spare drive in my mac, and it works then, but not on the mac that’s hosting the data file.
Any ideas?
cheers,
Kev.