Register / Login | Desktop view |
set commandSuccess to (system attribute "QR_COMMAND_SUCCESS")
if commandSuccess is "0" then
-- the command's success is "0" (in other words, the action was NOT successful)
-- note: if the action was canceled, QR_COMMAND_SUCCESS will be "1" and QR_COMMAND_CANCELED will be <who>,
-- so if you want to be notified of canceled actions you'll need to add a check for that.
-- note: that if run as a prolog, there is no QR_COMMAND_SUCCESS value, so this will never execute
-- compose a message with a summary of the problem
set recipientName to "QRecall Administrator"
set recipientAddress to "your@email.com"
set theSubject to "QRecall action failed"
set theContent to "The QRecall action '" & (system attribute "QR_COMMAND_TITLE") & "' failed." & return & return ¬
& "Reason: " & (system attribute "QR_COMMAND_EXCEPTION") & return & return ¬
& "Archive: " & (system attribute "QR_ARCHIVE_NAME_DISPLAY")
tell application "Mail"
-- create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
-- set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
-- and send the message
send
end tell
end tell
end if