use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
property holidays : {date "Monday, May 29, 2017 at 12:00:00 AM", date "Tuesday, July 4, 2017 at 12:00:00 AM", date "Monday, September 4, 2017 at 12:00:00 AM", date "Thursday, November 23, 2017 at 12:00:00 AM", date "Monday, December 25, 2017 at 12:00:00 AM", date "Monday, January 1, 2018 at 12:00:00 AM"}
logToConsole given theString:"Update TIAA Executed."
if weekday of (current date) is in {Saturday, Sunday} then
logToConsole given theString:"Weekend Day Detected and TIAA script not run."
return
end if
if (current date) is in holidays then
logToConsole given theString:"Holiday Detected and TIAA script not run."
return
end if
logToConsole given theString:"TIAA Total Begun."
tell application "Numbers"
activate
tell table 1 of sheet 1 of document "Finances TIAA and BofA"
set theCell to first cell of column "R" whose value is missing value
set value of theCell to value of cell "E5"
set format of theCell to format of cell "E5"
logToConsole of me given theString:"TIAA Total Completed."
set value of cell "Symbol Date and time of last script run" to (current date)
set value of cell "Close Date and time of last script run" to (current date)
logToConsole of me given theString:"TIAA Date Stamp Updated."
end tell
end tell
to logToConsole given theString:aMessage
set theString to "logger -t TIAADaily" & space & quoted form of aMessage
do shell script theString
return
end logToConsole
Hello,
The above script works fine if run from Script Debugger, but when double-clicked in the Finder (in the User Library /Scripts/Applications/Numbers), or run with a launchd plist, it errors out and the message is :
Can’t get every scripting addition of file “…Library:Scripts:Applications:Numbers:Update TIAA 7 PM.app:”.
Also, on some attempts, the error is:
current date
privilege violation occurred: errAEPrivilegeError -10004
Never have seen this before. Anyone can help?