Alarm scripts

Curious, if I'm writing a script to run on an alarm, how do I get the details of the firing event? For instance, a script to speak an alarm:
on run
     set introText to "Excuse me. It's time for"
     (* Somehow get eventText from current active event
in iCal
     set eventText to "a meeting"
     say introText & eventText
end run

Hi Zurich,
Try this script. You will need to change the variables myCalName and myAdv as needed.
-- John Maisey -- 13 Aug 2005
set myCalName to "Home" -- name of the calendar -- change
set myAdv to 15 -- look ahead in minutes -- change
set timeStart to (current date) - 1 * minutes
tell application "iCal" to set myEvents to summary of events of calendar myCalName whose start date is greater than timeStart and start date is less than (timeStart + myAdv * minutes)
set eventText to item 1 of myEvents
say "Excuse me. It's time for " & eventText
Best wishes
John M

Similar Messages

  • Mac mail alarm script needed

    Total noob here so forgive the language use - looking for an applescript which will launch using the mac mail rules to set up an alarm after a certain amount of time has past from ical... does one exist or can it be done?
    Looking forward to hearing from you and thanks in advance for your time.

    1. the mail rule will activate when I type in the already chosen set of words in the subject (I can do this)
    I am not sure that you can. Mail rules only fire AUTOMATICALLY on incoming messages, so you would need some other way of triggering the rule and hence launching the script.
    2) There is plenty of material on learning Applescript on the web, but having some programming experience helps. It can be very frustrating sometimes, and others delightfully straightforward.
    Suppose you give a bit more detail on what you are rying to achieve, and maybe someone can suggest an alternative approach.
    AK

  • Mavericks Calendar Open File Alarm Scripting Failure

    Hi all,
    I just recently upgraded to 10.9 from 10.8.5. Part of my daily routine is to download an excel file, gather information from that excel and, using applescript, add information from that document to an icloud calendar found in Apple Calendar, and create an alarm that opens an application after the specified event time.
    The upgrade to Mavericks did two things, first it stripped away all of the "Open File Alarms" from existing events on the icloud calendar, and now when I attempt to create new events with the below applescript, I get an error  "There was an error saving calendar data. Calendar encountered a critical error while saving to the database, and recent changes may be lost. More information may be available in the console." If I strip away the code for adding the open file alarm, the events add properly. If I manually add an open file alarm by clicking the event and selecting the necessary info, the calendar and event save fine. I've checked the applescript dictionary for Calendar in 10.9 and I don't see a difference in how Open File Alarms are handled.  Can anyone offer any suggestions? Below is the snippet of code that grabs the data from excel and loads it into the event in Calendar.
    --opens data in excel
    tell application "Microsoft Excel"
      activate
              set theDoc to "Mac HD:Automatic User:CSV File From Form:Re-Hire Form.csv" as text
      open file theDoc
      --get the outdate programmed for iCal & expiration function
              set eventFirstName to the value of range "B2" & " " as string
              set eventLastName to value of range "C2" & " out" as string
              set eventname to eventFirstName & eventLastName
              set targetDate to the value of range "I2" of active sheet
      quit
    end tell
    --add outdate events to calendar
    tell application "Calendar"
              if class of targetDate = date then
                        set newTargetDate to targetDate + (1 * days)
                        set outDate to short date string of newTargetDate
              end if
              set theoutdatecal to "Show_trans"
              tell calendar theoutdatecal
                        set deactivate_date to make new event with properties {start date:targetDate, summary:eventname, allday event:true, status:confirmed}
              end tell
              tell deactivate_date
                        make new open file alarm at end with properties {trigger interval:1440, filepath:"/Automatic User/Workflows/deactivation.app"}
              end tell
    end tell
    Thanks!

    As a side note, I have also tried unlinking and relinking the icloud account (to clear the calendar data), and creating fresh calendars "On My Mac" to the same result.

  • Script alarms and parameters / arguments

    ICal 2 now has the capability to use a acript as an alarm target (although I think this is really just 'GUI Candy' for the existing 'run an application' alarm type).
    However there don't seem to be any arguments or parameters passed to the script. I'd like to have a script that 'knows' what event triggered the alarm and can act appropriately. The only examples I have seen have required the script to look back into iCal and try to work out what the event was (based on calendar, date etc).
    Does anyone know how to get iCal to pass event information to the alarm script ? How would I raise this as a feature request ?

    Don't know how to help you but I think you explained it well, other than maybe add what specific information you want from iCal. Then just send the feedback.
    You might also want to check at the Applescript discussion to see if someone there can help you.

  • Alarms - using date in a BPEL Variable

    I have some BPEL Alarm script as below; where I am using the content of a variable (deadline) to hold a date;
    When I compile the WS I get the following error: 'XML parsing failed because Invalid content starting with element "onAlarm"'.
    Any ideas?
    Many thanks in advance
    Vince
    <onAlarm xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" until="bpws:getVariableData('deadline')">
         <bpeld:annotation xmlns:bpeld="http://schemas.oracle.com/bpel/eclipse/designer"><bpeld:meta map.label="untilDeadline"/></bpeld:annotation><throw name="throw-1" faultName="forcedTermination"><bpeld:annotation xmlns:bpeld="http://schemas.oracle.com/bpel/eclipse/designer"><bpeld:meta map.label="forcedTermination"/></bpeld:annotation></throw>
    </onAlarm>

    Hi,
    I Donno wat exactly is your requirement to write it in a switch activity....you can use the transform activity for this.
    Anyways...for your requirement u can use ...ora:countNodes('getTaskDetailsById_OutputVariable','getTaskDetailsById_OutputVariableCollection','/ns5:task/ns5:systemAttributes/ns5:assignees')
    and assign it to a int variable....and use a while loop and each time decrease the value of count by 1...and put a condition in the switch in the while loop as seomething like */task/systemAttributes/assignees[count]/id=bpws:getVariableData('OperatorCode').*

  • Automator Calendar Alarm/iTunes Help

    I have created a Calendar Alarm in Automator to play an internet Radio Station using an iTunes playlist at a specific time.  The  Automator script works fine and the streaming radio starts and runs perfectly when my laptop is running normally during the day.
    Specific sequence:
    Get Specified iTunes Items - which is a streaming radio station set up as a playlist
    Play iTunes Playlist
    Set Computer Volume
    Set iTunes Playing
    My reason for creating this script is for a Wakeup Radio Alarm.  I have my MacBook Pro wake from sleep using the Schedule facility in Energy Saver 5 minutes before the radio alarm is due to start.  No problems, the laptop wakes from sleep mode.
    But when the Calendar Alarm script activates I then get an unhelpful error message saying “The action "Get Specified iTunes Items" encountered an error.  Check the action’s properties and try running the workflow again”.  No other information is provided.
    Then when I switch to iTunes I receive a message saying “iTunes is running in safe mode.  Visual plug-ins you have installed have been temporarily disabled.”  I have not added any plug-ins to iTunes.
    After cancelling the 2 error messages from the above, opening the Calendar Alarm script now with Automator and running it produces no errors whatsoever and the radio station starts playing.
    Any ideas please?
    Rob

    Trust this is what you call the script.
    And as stated in my original post this is the log from running this app in Automator:
    It runs fine like this and the radio station plays but NOT after waking my MacBook from sleep mode as explained in my original post.
    Rob

  • [Solved]how to know if the headphone is plugged in or not?

    hi,
    i just want to know whether there is a package that can test if the headphone is plugged in or not?
    both of lsusb and dmesg dont work.
    thanks for your help and post.
    Last edited by yjcong (2012-09-24 07:01:56)

    brebs wrote:You could try to make sense of CONFIG_SND_KCTL_JACK.
    thank your for your link.
    i know how to solve my question.
    amixer scontrols
    to find the corresponding name. then
    amixer set "Headphone Jack Sense" off
    to disable it no matter the headphone is plugged in or not.
    these will be coded into my "alarm" script for nap.

  • ICal scripting an alarm

    I have events in a calendar set up to email an alarm for when I need to service certain machines that are under a service agreement. Then the person will log the call using the system number that I have in notes from their email.
    I am trying to eliminate the person and have the call automatically logged and print out.
    AS can't get anything out from the notes so I thought I would put the system number in the location field so I could get it.
    I need to write a script that will be triggered from an iCal alarm and then go and get the system number out of the location field for that event when it comes up.
    but I am having trouble trying to get the current event in iCal.
    I am not sure if I explained this very well but
    I just need a way to get a number from the current event that triggered the alarm so I can add it to the rest of my script.
    Thanks
    darock

    There is no current event in iCal. Austin Kinsella posted a work around in this thread.
    http://discussions.apple.com/thread.jspa?messageID=1340164&#1340164

  • MS IE toStaticHTML String Parsing Cross-Site Scripting Vulnerability alarms

    Hi,
    I was wondering if someone else has noted an increase in false positives concerning the following 2 events:
    - Microsoft Internet Explorer toStaticHTML String Parsing Cross-Site Scripting  Vulnerability
    - Microsoft Office Excel Ghost Record Parsing Arbitrary Code Execution Vulnerability
    Obvisouly I see these events because the signature has been introduced recently!!!
    But I wonder if these alarms I'm getting are genuine (and I have a big problem), or if the signature needs to be 'tuned' by Cisco to be a bit less sensitive?
    Anyone has experienced something similar or can shed a light?
    Thanks,
    seb.

    Hello Seb,
    Since I don't have the entire transmission, I can't tell what exactly is commented out in regard to the tags, but the data appears to look something like below.
    e){  
      //v3.0..   
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    //-->
    @td  
    img{display: block;}
    @import url("p7tp/p7tp_01.css
    With 30419 being related to CVE-2010-3324, I assume the signature is firing due to some match variation of the fact that @import and the tags are showing up in a response from your web server. The toStaticHTML method should remove tags, but the vulnerability is causing that mechanism to fail.
    The oBot User-Agent caught my eye. Google returns several pages to the effect of oBot being a:
    "German spider from Cobion, now part of Internet Security Systems. Scans the web for their clients looking for copyright infringement."
    I'm not sure what benefit this search bot would receive from injecting Javascript into the response.
    I'll forward the capture data to our sig team to confirm whether this should be a legitimate match.
    Thank you,
    Blayne Dreier
    Cisco TAC Escalation Team
    **Please check out our Podcasts**
    TAC Security Show: http://www.cisco.com/go/tacsecuritypodcast
    TAC IPS Media Series: https://supportforums.cisco.com/community/netpro/security/intrusion-prevention?view=tags&tags=tac_ips_media_series

  • Scripts and Workflows set as iCal alarms not functioning in Lion...

    ...or it could be becuase i am using a Beta version related to the Beta for iClloud and iOS5....I'm not 100% sure....
    All I know is that I have scripts and workflows that used to work before the upgrade, they STILL work when I run them independantly using Script editor and Automator, but they do not run when the iCal alarm that they are tied to goes off.  Coem to think of it, the only way that i know those alrms are going off is that I get a notification on my synced iPhone that tells me they are going off.  - so i guess I really don't know if those alarms are working on my mac at home.
    any thoughts or help?

    For me it's completely random. Some examples of what's happened to me...
    - I've set a new alarm (that I need to go off weekly) When I first set it it will pop up, but then the next week it will not. But then sometimes it will.
    - I also have an alarm to check woot.com everyday that NEVER goes off.
    I don't know if anyone else is having this problem (or if it's related) but something else also started happening the same time I installed Leopard... Occasionaly whatever window in any program I'm working in will all of a sudden go inactive / ghosted so I'm not able to type, etc. I have to click on the window I was working in to make it active again.
    The tech I talked to thought that perhaps a pop up alarm was popping up OFF screen and therefore causing the inactive window problem. But after erasing all the info in my iCal (that's right, EVERY appointment had to be reentered) I know for a fact that's not the problem.

  • ICal alarm to send email or open script

    I know I can set iCal alarms to send myself an email. What I'd really like to do is:
    1) have an iCal alarm that prompted a script
    2) that would create an email message where I can fill out a template
    3) to send to a pre-addressed recipient to remind them of something that needs to be done.
    Any help is greatly appreciated. Thanks in advance for any help!

    It looks as though the Mac application I was thinking of was AIM, which is still at version 4.7 from 2004 (and still available for download at aim.com). You simply entered a mobile phone number as the buddy and used the application's text messaging.
    But I don't know whether it is scriptable.
    There are web sites which provide the SMS send feature for free, and Safari is scriptable, but its a bit more of a task to script a web site that may change its display.
    Of course, if his mobile has an email address, an email will work (mine is through O2 and has an address).

  • Alarm Action Script Arguments

    In SMC 3.6.1 are there any other arguments that can be passed into an action script besides the two that appear in the SMC docuentation, statusfmt and statusstringfmt?
    %statusfmt
    The alarm severity, such as Warning, Critical, and so on.
    %statusstringfmt
    The complete alarm string, including severity. For example: Critical: Machine A Kernel Reader Number of User Sessions > 10.

    you don't even have to use the suggested names.  change them to anything unique that you want.
    or don't use the code snippets.  once you've seen one, just copy and paste the code from it and reuse it just changing the listener object and listener function and function body.

  • Disable ical alarms temporarily (e. g. for 2 hours) by apple script ?

    Hi,
    I'm searching for a way to disable the ical alarm pop-ups temporarily (e. g. for 2 hours).
    Is there a way to do that?
    Why?
    For people giving presentations with MS PowerPoint or Keynote it might be a problem if during the talk a window pops open - maybe even with private content..
    I know that there is the option in the preferences, but once I used it I forgot to re-activate the alarms, so it would be better to define for how long the alarms will be disabled before.
    Does anyone know how to do that?
    If there's no complete solution, it would at least be interesting to know how to access this option by AppleScript.
    Martin

    My iCal is up to date in OSX Lion and the script below is working for me. It doesn't actually take time into account, like beckmart had wanted and I'm not very applescript savvy so I just put it into an automator workflow using the script twice with a "pause" in between.
    tell application "iCal" to activate
    tell application "System Events" to tell process "iCal"
              click menu item 3 of menu 1 of menu bar item 2 of menu bar 1
              click button 3 of tool bar 1 of window 1
              click checkbox 1 of window 1
              click menu item 10 of menu 1 of menu bar item 3 of menu bar 1
    end tell
    tell application "iCal" to quit

  • ITunes alarm clock script

    Hi,
    I'm very interested in starting AppleScript...
    My first script I'd like to do is for iTunes to start up in the morning at 07:00 and play a selected track.
    Can someone please give me a link for this and offer some tips for a newbie to AppleScript. I really want my Mac experience to grow and be more.
    And AppleScript, UNIX, and Terminal seem to be the only way to go from what I've studied thus far. Downloading things like free ware and share ware has gotten pretty blah.
    I've downloaded the AppleScript pdf and I'm ready for action!
    Thanks,
    Michael

    these books are pretty useful. (to me they are)
    http://www.oreilly.com/catalog/applescpttdg2/
    The Definitive Guide by Matt Neuburg, second edition.
    http://www.spiderworks.com/books/ashandbook.php
    Danny Goodman's AppleScript Handbook Mac OS X Edition.
    http://www.oreilly.com/catalog/applescripttmm/
    AppleScript: The Missing Manual.
    this thread could be useful.
    http://www.devdaily.com/blog/Content/2/21/566/
    the code from this application by Romeo Opena could be used as a good learning source on which to base your own alarm clock, the application it's self is pretty cool.
    http://scriptbuilders.net/files/itunesmusicalarmclock7.5.1.html
    enjoy
    Budgie

  • Calendar alarm fails to run Automator script if Mac is sleeping

    I have an Automator script to run a backup task which is saved as a Calendar alarm to run once every week.
    This was working perfectly in Snow Leopard - if the computer was asleep at the alarm time, then it would simply run the next time the computer is woken up.
    Then I upgraded to Mountain Lion, and had various issues. First, the alarm got imported to iCloud and caused unwanted pop-up alerts on all my iOS devices, but I resolved that by moving the alarm's calendar from "iCloud" to "On My Mac" (described here).
    Now I'm finding that if the computer is asleep at the alarm time, the script doesn't run at all.
    I don't want the computer to wake up in order to run the script, but to run the next time the computer is woken up, just like it did on Snow Leopard.
    Is this a known difference in behaviour between Snow Leopard and Mountain Lion, and is there any way to get the old behaviour?

    As no-one has confirmed whether this is expected behaviour or a bug, I've assumed it is a bug and raised a bug report at http://www.apple.com/feedback/macosx.html.
    In the meantime, I've created a repeating task in my To Do list app to remind me to run the backup script once a week (I'm using Cultured Code "Things" for task management).
    When the task pops up, I run the Automator workflow MANUALLY by double-clicking on the workflow ".app" file.
    It seems insane, but this is the only way I can be sure the Automator script runs once a week.

Maybe you are looking for