I can do this with Automator or Applescript, I don’t care which – but Automator tends to want to create the event at the same time every time no matter what time it is when I execute. I want to run a compiled Applescript (or Automator) app that at the time I execute creates either a little 1 minute event, or an all day event, for the date/time at which the script is executed. It’s for keeping up with my anti-seizure meds without having to keep a bunch of little scraps of paper and notebooks all over the place. Basically, I’d trigger the script and it would log into that day, either at the exact time or as an all-day event (because it’s not so much important that I take it at a specified time as that I take enough of it during the day) an event in iCal.
Here’s my “natural language” – ha ha – version of what I’d like to do.
Tell application iCal
create event with name “took meds” in calendar “med schedule”
start date (now)
end date (now +1 minute)
end tell
or…
Tell application iCal
create even with name “took meds” in calendar “med schedule”
start date (now)
allday event (true)
end tell
I think I’m going to have use Applescript for this because automator won’t let me set the date other than the date it used when I first set up the workflow.
tell application "iCal"
tell calendar "med schedule"
make new event at end of events with properties {summary:"took meds", start date:current date, end date:(current date) + 60}
end tell
end tell
this is:
tell application "iCal"
tell calendar "med schedule"
make new event at end of events with properties {summary:"took meds", allday event:true}
end tell
end tell
If sanford has repetitive events in his medical calendar (like get a blood test every 4 weeks, for example), I have a script for correctly extracting those from a calendar.
First of all this script works perfectly! I put it in an Automator wrapper so I can easily add a verification dialog ahead of the actual recording of the meds taking.
Second, for Adam, this one actually requires user intervention to build a calendar, rather than remind me on a regular basis to take it. I can generally remember to take it, it’s just the after I’ve taken it I sometimes can’t remember if and when I did!
Actually, Adam, could I have that script. My meds dosage is variable, as in as-needed – there’s a minimum to maximum range I prescribed to take – and I’d be interested to see how much I take on which days of the week under what conditions. This is personal info, but I suppose it doesn’t matter too much. It’s a sort of seizure disorder that is most often set off by emotional/physical stress and I’d like to compare what’s going on in the day with how much of the meds I can take so I can potentially due some alternative stress-relief technique, take a lower dose, and not be so tired all the (anticonvulsants make you tired!).
So it would be great if I could go back and extract each incident of med taking from that meds calendar, going back to the date I began a new prescription.
Sanford,
Nice idea, when I am ill I always forget when I have taken medicines. and try and write it down some were.
The other thing I forget is what it is I took if I am using a combination of pills…
So here is a version that helps me add info to the entry.
tell application "iCal"
display dialog "What Meds taken" default answer "" buttons {"OK"} default button 1
copy the result as list to {medtype, button_pressed}
display dialog "What was the Dosage" default answer "" buttons {"OK"} default button 1
copy the result as list to {dosage, button_pressed}
display dialog "Set Meds iCal Entery to : All Day entry or Intervals" buttons {"All Day", "Interval", "Cancel"} default button 2
set the button_pressed to the button returned of the result
if the button_pressed is "All Day" then
my dailies(medtype, dosage)
else if the button_pressed is "Interval" then
my intervals(medtype, dosage)
else
end if
end tell
on intervals(medtype, dosage)
tell application "iCal"
tell calendar "med schedule"
make new event at end of events with properties {summary:"Took meds", description:"meds : " & medtype & return & "Dosage : " & dosage, start date:current date, end date:(current date) + 60}
end tell
end tell
end intervals
on dailies(medtype, dosage)
tell application "iCal"
tell calendar "med schedule"
make new event at end of events with properties {summary:"Took meds", description:"meds : " & medtype & return & "Dosage : " & dosage, allday event:true}
end tell
end tell
end dailies
Wow. That one is cool. I’ll have to test it in a separate iCal than the one I’m using already. Although my dose per incident of taking is usually the same it’s not always; sometimes it’s double. I’ve just been running the script twice to handle that. This would handle that and record the dose too, in one event. You can imagine the anticonvulsants make me so drowsy, like being stuck in a cotton-lined box, sometimes, it’s hard to remember to write down what I took and when.
What I need too, what I mentioned for Adam, is a script that will extract each “took meds” entry and tally the total mg for each and export that to a text file that I could keep in something like MacJournal, CP Notebook, or even export into Excel – so I could even, don’t laugh, graph my meds usage versus what’s going on circumstancially in my daily life.
Mine are pretty simple, they look like, mixed in a normal day:
6:00 AM clonazepam
12:30 PM Lunch with Tod Pamm
5:42 PM clonazepam
They are the same dose each tablet. I just use double entries – in other words, trigger the script twice – if I have to take a little more at a dosing time. So:
6:00 AM clonazepam
6:01 AM clonazepam
1:00 Phone interview with L. Frisk, PhD
7:02 PM clonazepam
Knowing how many times I made an entry per day means knowing how many mgs I took per day. It’s only a moderate seizure disorder, with, when medicated, infrequent – or nonexistent – brief, weak-to-moderate temporal lobe seizures. So it’s a low dose per dosing and I’m not having to take them all day long, like every hour or anything.
I just have a tendency at the end of the day some times – even a low dose makes you really tired much of the day – to wonder if I took at least the minimum dose; it’s also tempting not to take the minimum dose to avoid the sleepiness. So I have to count my whole monthly prescription out and make guesses about how much I took on even given day – and those pills are quite tiny when counting them, exhausted and somewhat ataxic from the medication in the first place. That’s why I implemented the iCal system originally, so I don’t have to wonder and then count pills. And I thought it would be cool to know which days I take more and which less, as the seizures are usually but not always triggered by some physical or emotional stress a few hours before I have one. Obviously, I can just look at the calendar, but it would be neat to be able to pull a running tally to see if I’ve been taking more or less since the beginning of the prescription month, like, you know, during the holidays or if I’ve decided to move all the heavy furniture around the living room, or if the kids are going wild.
Just reading you last post now but while i digest it I will post the script I have been playing with a bit more
tell application "iCal"
display dialog "Name of Meds taken" default answer "" buttons {"OK", "cancel"} default button 1
copy the result as list to {medName}
display dialog "What form" buttons {"Pills", "Liquids", "cancel"} default button 2
copy the result as list to {dosage_Type}
if dosage_Type is "Liquids" then
set measure_Type to "MilliLitres"
set dosage_Type to ""
else
display dialog "Is dosage of " & medName & space & dosage_Type & " In MilliGrams or Number " buttons {"MilliGrams", "Number", "cancel"} default button 1
copy the result as list to {measure_Type}
end if
display dialog "Enter Total " & measure_Type & " of " & medName & space & dosage_Type & " taken" default answer "" buttons {"OK", "cancel"} default button 1
copy the result as list to {dosage}
---
if dosage_Type is "MilliLitres" then
set measure_Type to ""
else if measure_Type is "Number" then
set measure_Type to "x"
end if
if dosage_Type is "Pills" and measure_Type is not "x" then
set dosage_Type to " total in " & dosage_Type
end if
set medtype to "meds : " & medName & space & return & "Dosage : " & dosage & space & measure_Type & space & dosage_Type
---
display dialog "Set Meds iCal Entery to : All Day entry or Intervals" buttons {"All Day", "Interval", "Cancel"} default button 2
set the button_pressed to the button returned of the result
if the button_pressed is "All Day" then
my dailies(medtype, dosage)
else if the button_pressed is "Interval" then
my intervals(medtype, dosage)
else
-- action for 3rd button goes here
end if
end tell
on intervals(medtype, dosage)
tell application "iCal"
tell calendar "meds"
make new event at end of events with properties {summary:"Took meds", description:medtype, start date:current date, end date:(current date) + 60}
end tell
end tell
end intervals
on dailies(medtype, dosage)
tell application "iCal"
tell calendar "meds"
make new event at end of events with properties {summary:"Took meds", description:medtype, allday event:true}
end tell
end tell
end dailies
Ok let me know the bits you want to keep in the last script, and I will trim it for you where pos.
( From what you have posted you only need pill count as the actual dosage of each pill is the same.)
I will write the rest to export it to Excel. I already should have a bit of script some where for that.
Two things I can not promise when I will complete this but will try for by the end of this weekend.
Nor if I it will meet all your need. But I am happy to give it a try.