Dates in Numbers to iCal?
Is there a way to create a date in a "date" field in Numbers and then have it show up in iCal as an event? Is there an Applescript that will do that?
iMac (27-inch Mid 2010), OS X Yosemite (10.10.4), Numbers 3.5.3
Is there a way to create a date in a "date" field in Numbers and then have it show up in iCal as an event? Is there an Applescript that will do that?
iMac (27-inch Mid 2010), OS X Yosemite (10.10.4), Numbers 3.5.3
If you have the cursor on the cell containing a date when you run the script below, the result will be a 1-hour event in Calendar (formerly called iCal).
SG
set tgtCal to "Personal"
set tblName to "Table 1"
set cellWithDate to "A2"
tell application "Numbers"
tell document 1 to tell active sheet
tell table tblName
tell cellcellWithDate
set startDate to its value
end tell
end tell
end tell
end tell
set startDate to startDate - (time to GMT)
set endDate to startDate + 1 * 60 * 60 -- 1 hour
set theSummary to "Test from Numbers"
tell application "Calendar"
tell calendartgtCal
set theEvent to make event ¬
at end of eventswith properties {summary:theSummary, start date:startDate, end date:endDate}
end tell
view calendartgtCalatstartDate
showtheEvent
activate
end tell
Correction. The above script will create a event for the date contained in cell A2 of "Table 1".
A script to create an event for the date contained in the cell on which you have your cursor and have clicked (the first selected cell) is as below. Copy-paste into AppleScript Editor (in Applications > Utilities), a Numbers cell containing a date, and in Script Editor click the triangle 'run' button.
SG
set tgtCal to "Personal"
tell application "Numbers"
tell document 1 to tell active sheet
tell (table 1 whose selection range's class is range)
tell selection range's cell 1 to set startDate to its value
end tell
end tell
end tell
set startDate to startDate - (time to GMT)
set endDate to startDate + 1 * 60 * 60 -- 1 hour
set theSummary to "Test from Numbers"
tell application "Calendar"
tell calendartgtCal
set theEvent to make event ¬
at end of eventswith properties ¬
{summary:theSummary, start date:startDate, end date:endDate}
end tell
view calendartgtCalatstartDate
showtheEvent
activate
end tell
Dates in Numbers to iCal?