Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Long shot... Can an entry in Calendar add a new line in Numbers?

I am a photographer. I am setting up a very simple simple Job tracking spreadsheet. Column A is Job number, column B is Client, column C is Date, etc... One line per job type of thing.


When I get a job I am often not at the computer so I enter it on my iPhone in the Calendar app. Is there a way I can add some sort of flag in that entry which will then open my spreadsheet and add a new line with a new sequential job number and the Client and Date?


I realize that is probably asking for a lot but I thought I would at least ask, just in case...


Thank you for any help!


Bo

Aperture 3, OS X Mountain Lion (10.8.2)

Posted on Apr 2, 2014 6:34 PM

Reply
Question marked as Best reply

Posted on Apr 2, 2014 9:14 PM

No.


If the calendar on your phone syncs with the one on your Mac, it might be possible to make the transfer using AppleScript. If your profile is out of date, and you are actually using Numbers 3 and OS X v10.9 (Mavericks) on the Mac (and iOS 7 on the phone) you should be able to sync the Numbers fie on both machines and update it on either.


Regards,

Barry

19 replies

Apr 3, 2014 7:27 PM in response to Bmachine

Taking it a step at a time...


Below is a script that takes events from today that have "job" in the Notes field and places them on the clipboard for pasting into an empty row in in a table.


You can change "Work" to the name of whatever calendar you are using. Make sure that you have only one calendar with that name.


It assumes you have Client in the "summary" field (that's the one that appears at the top in a calendar). If you are putting "Project" in a separate field in Calendar the script can easily grab that too.


Once you've got the paste working so you get the values you want, then the script can be refined as needed to place them in a specific table in a specific document at specified times.


To test, copy the script and paste into AppleScript Editor. Then click the green triangle "run" button.


SG



--usage: add events with "job" in note field; run; click a cell once, and paste

property targetCalendar : "Work"

property keywordInNote : "job"


set {today, today's time} to {current date, 0}

set beginPeriod to today--today's time set to 0 minutes past midnight

set endPeriod to today + days--this includes one entire day


try

tell application "Calendar" to tell calendar targetCalendar

set eventList to events whose ¬

start date is greater than or equal to beginPeriod and ¬

start date is less than or equal to endPeriod and ¬

description contains keywordInNote

set pasteList to {}

tell eventList to repeat with anEvent in items

tell anEvent to copy its {summary, start date} to end of pasteList

end repeat

end tell

on error

display notification "Can't find that calendar."

end try


set pasteStr to ""

tell pasteList to repeat with i from 1 to count

set pasteStr to pasteStr & my joinList(itemi, tab) & return

end repeat

set the clipboard topasteStr

pasteStr


to joinList(aList, separator)

set {oTID, AppleScript'stext item delimiters} to {AppleScript'stext item delimiters, separator}

set listStr to aList as string

set AppleScript'stext item delimiters to oTID

return listStr

end joinList


--end of script

Apr 4, 2014 6:17 AM in response to Bmachine

You'd need to work out a one-to-one correspondence between the columns in your spreadsheet and the scriptable fields in a calendar event, unless you were going to add some of the information manually.


Perhaps something like this would work:



Event

Spreadsheet

Summary

Client

Location

Project

Start date

Project Date

Notes

Agreement Date

Cost



The Cost and Agreement date would be input as two paragraphs in the event’s Notes. You would have to type these carefully as the spreadsheet and script depend on them being in the right place.


All the events would be saved in a calendar called Jobs. Week to view in Calendar would look like this:


User uploaded file





An individual event would look like this:


User uploaded file


Where would you put the keyword? The way I envisage it working, you wouldn't need one. The script would check the calendar for events that don't contain the word "Logged" in the Notes, log them to the spreadsheet and then add the word "Logged" to the description so they don't get logged again.


The spreadsheet would start off like this


User uploaded file




The script would start to look something like this:


tell application "Calendar"

activate

set x to 1 -- to allow for a header row in the spreadsheet

set the_events to (every event of calendar "Jobs" whose description does not contain "Logged")

repeat with each_event in the_events

tell each_event

set {client, project, pdate, adate, cost} to {summary, location, start date, (paragraph 1 of (description as string)), (paragraph 2 of (description as string))}

set description to description & return & "Logged"

end tell

tell application "Numbers"


activate

tell document 1 to tell sheet 1 to tell table 1

tell column 2 to set value of cell (x + 1) to client

tell column 3 to set value of cell (x + 1) to project

tell column 4 to set value of cell (x + 1) to adate

tell column 5 to set value of cell (x + 1) to pdate

tell column 6 to set value of cell (x + 1) to cost

end tell

end tell

set x to x + 1

end repeat

end tell


DO NOT run this script on a live spreadsheet - at the moment it fills from the top and overwrites whatever is there already, there is no error checking, or testing for the existence of the spreadsheet, or whether it’s open or not, or what to do if you mistype the notes...


But as a proof of concept, the spreadsheet ends up like this:


User uploaded file


The logged events end up like this:


User uploaded file


The next time you run the script, this event won't get added to the spreadsheet because it has the word "Logged" in the notes.



One other thought - if it was me, I wouldn’t run the finalised script from a schedule. What would happen if your desktop was logged out, or the script needed user input and your kids were on it, or it errored halfway through…


I would personally keep human control of when the script is run. Wrap it in an Automator application, open the spreadsheet manually and run the Automator app whenever you wanted to.


Job numbering and detecting the need for extra rows at the bottom of the sheet add an extra layer of complexity which I haven't quite got my head round yet.

Long shot... Can an entry in Calendar add a new line in Numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.