Applescript - Adding "if" condition ICal  on/off alerts

I'm using this script to turn off my ICal alerts while running scripts that conflict with schudule tasks.
I have serveral scripts that need to run throughout the day useing this process and some that need ICal alert on as well.
Is there a way to have this script not toggle on/off?  Currently, if I run another script while the ICal alert is off it will toggle ICal alerts to an "on" state.
Maybe an "if" statement - if "off" then quit,  --------------------------For those scripts which require ICal alerts to remain off.
And a "if" statement - if "off" then click the menu item to it's "on" state.  --For those scripts that require iCal alerts to be on.
I don't want it to be a dialog task. These scripts need to run in the background.
This is the script I'm currently using:
tell application "System Events" to tell process "iCal"
   --click menu item "Preferences…" of menu 1 of menu bar item "iCal" of menu bar 1
   click menu item 3 of menu 1 of menu bar item 2 of menu bar 1
   --click button " Advanced " of tool bar 1 of window 1
   click button 3 of tool bar 1 of window 1
   --click checkbox "Turn off all alarms" of window 1
   click checkbox 1 of window 1
   --click menu item "Close" of menu 1 of menu bar item "File" of menu bar 1
   click menu item 10 of menu 1 of menu bar item 3 of menu bar 1
end tell
tell application "iCal" to quit
Any help or advice would be greatly appriciated.  
Ron

Well.....  I got a script to work after trying for several days.   I'm not good at writing scripts so I'm sure there is a better way of writing them.  At least a cleaner way....
I found a script to base mine off of at:
http://macscripter.net/viewtopic.php?id=30031
Towards the bottom of that website there is a script which is half in German.
Here is that script::
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
end tell
tell me to activate
tell application "System Events" to tell process "iCal"
   set check to value of checkbox 1 of window 1
end tell
if check = 0 then
   display dialog "Erinnerungen sind AKTIV!" buttons ["Abbrechen", "Deaktivieren"] default button "Deaktivieren"
   if button returned of result is "Abbrechen" then
       tell application "iCal" to quit
   else
       tell application "System Events" to tell process "iCal"
           click checkbox 1 of window 1
       end tell
       tell application "iCal" to quit
   end if
else
   display dialog "Erinnerungen sind NICHT aktiv!" buttons ["Abbrechen", "Wieder aktivieren"] default button "Wieder aktivieren"
   if button returned of result is "Abbrechen" then
       tell application "iCal" to quit
   else
       tell application "System Events" to tell process "iCal"
           click checkbox 1 of window 1
       end tell
       tell application "iCal" to quit
   end if
end if
So I tested the script to see if it would work...   And it does...  The only thing is it had a dialog function which I don't want to use....  
I came out with two scripts   One to activate and one to disable ICal alarms.
Here they are.........
---------ICal Alarm Activate Script---------------
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
end tell
tell me to activate
tell application "System Events" to tell process "iCal"
          set check to value of checkbox 1 of window 1
end tell
if check = 0 then
          tell application "iCal" to quit
else
          tell application "System Events" to tell process "iCal"
                    set check to value of checkbox 1 of window 1
          end tell
          if check = 1 then
                    tell application "System Events" to tell process "iCal"
  click checkbox 1 of window 1
                    end tell
                    tell application "iCal" to quit
          end if
end if
---------ICal Alarm Activate Disable --------------
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
end tell
tell me to activate
tell application "System Events" to tell process "iCal"
          set check to value of checkbox 1 of window 1
end tell
if check = 1 then
          tell application "iCal" to quit
else
          tell application "System Events" to tell process "iCal"
                    set check to value of checkbox 1 of window 1
          end tell
          if check = 0 then
                    tell application "System Events" to tell process "iCal"
  click checkbox 1 of window 1
                    end tell
                    tell application "iCal" to quit
          end if
end if
Like I mentioned above, I'm very, very green in applescript writing.  I'm sure my scripts looks weird but they works.   Feel free to clean them up for me.....
Hope thiis helps others who need a way to control ICal Alarms.
Ron
I

Similar Messages

  • I haven't added events but am getting "This calendar is unreadable. No events have been added to your iCal calendar"

    I recently started getting the message "This calendar is unreadable. No events have been added to your iCal calendar".  However, I typically add my events by typing them myself either on my MacBook Pro or my iPhone. I don't import from outside sources. I don't know if it's related or just coincidental that around the same time, events that I add to my MacBook Pro are not syncing to my iPhone, but the events added by iPhone seem to appear on my MacBook Pro and my MiniMac.  Is there a way to find the event that is being referenced in this error message??

    iPhone:
    Plug in your iPhone
    Go to iTunes > Your iPhone > Info and ensure that calendars is not checked off to sync -- if you are using MobileMe to sync, this option should not be checked
    On both Macs:
    1.) Go to Apple > System Preferences > MobileMe > Sync and remove the check Mark for calendars.  With the new MobileMe calendar system there is no need to have this checked.  Close the MobileMe window once this is complete.
    2.) Open iCal and then go to iCal > Preferences > Accounts and remove the MobileMe account from here with the minus sign.
    3.) Go to iCal > Quit iCal
    4.) Remove the following to the trash and restart your computer:
    Home > Library > Caches > com.apple.ical
    Home > Library > Calendars > Calendar Cache, Cache, Cache 1, 2, 3, etc. (Do not remove Sync Cache or Theme Cache if present)
    Home > Library > Preferences > com.apple.ical (There may be more than one of these. Remove them all.)
    5.) Open iCal and go to iCal > Preferences > Accounts
    -- If the MobileMe Account is already here remove it again and then re-add it being very careful to use the correct name and password (for your 10.5 system follow these steps for re-adding: http://support.apple.com/kb/HT4330)
    -- If the MobileMe account is not already here, add it in.
    iCal will download your calendars from the MobileMe server.  Watch and see if you get the error message.  If it completes the download (little spinning gear stops spinning next to the MobileMe calendar) go ahead and add a new uniquely named event to one of your MobileMe calendars on both computers and see if it syncs between.
    Let us know what happens.

  • ICal cuts off text of some events in month view

    I've noticed that iCal cuts off the text of some events, while displaying the full text of longer events in the month view. For example, if I create an event titled "Test Event" only "Test" shows up in the day it's created, but if I enter "Longer Event" the entire text shows up, on two lines. These events are on separate days with no other events on those days, so there's nothing to get in their way. Why is this?

    This is so utterly annoying- I never had this issue with previous versions of iCal, and I can't even run those versions on tiger now that I've upgraded. The tiger upgrade in general has disrupted my workflow much more than I thought it would-
    Because of the way I use iCal, not seeing the full even title in month mode makes iCal pretty much useless to me. I don't want to have to click between dozens of events that begin with "Renders of" to find which set of renderings are due on which days. Nor do I want to go through and rename all of my "Renders of Levels 1a-3c" etc to make the titles more useful. It should just WORK.
    Well, let me know if anyone finds a better way of making this work other than "resizing ad lib until things sorta show up"

  • Sales Order creation of adding new condition type to Item

    Hi Expert,
    The sales order has been created and need to add new condition type (Z601) to the first item(10). While adding the condition I am getting warning message like
    "Item 000030 exists already; the entry will be ignored".
    Where item 030 will be the last item.
    I have cheked but it's a standard report SAPFV45P, we can't modify. Please let me know can we set any field in the sales order so that we wont be getting this message.
    Regards,
    Mahesh

    Hello,
             If you would like to add the Condition Type automatically for a specific Item based on some condition (Lets say, Item Category), then you can code a Pricing Routine in VOFM Transaction and it will be automatically assigned.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • I need help!!! Did my iOS 6 update today, thought it was fine!! Then my friend text me and instead of saying Siobhain it says voicemail text message!! I've tried deleting her and adding her again, turning phone off etc etc!! Please help!!

    I need help!!! Did my iOS 6 update today, thought it was fine!! Then my friend text me and instead of saying Siobhain it says voicemail text message!! I've tried deleting her and adding her again, turning phone off etc etc!! Please help!!

    I know of no way to remove encryption on iTunes backups if you've forgotton the password.  If you've used the 4 digit PIN code to lock your iPhone in the past that can sometimes default as your "password" for this encryption in iTunes.  Try that PIN or any PIN you've used in the past.  If you don't use a lock maybe you played around with that feature once when you first got your phone....try "1,2,3,4" or anything you could have possibly tried.
    As far as accessing older unencrypted backups you can try this software.  I do not have any experience using it but it seems like it's what you need and is probably the easiest route for both voicemail and texts:
    http://deciphertools.com/products.html
    If you want to try to find voicemails using Terminal, I found this link as well:
    http://mikereys.wordpress.com/2011/10/18/iphone-backup-restoring-visual-voice-ma il/
    I know with AT&T, voicemails are only stored on their servers for 30 days so any voicemail older than that you would not have been able to access again.
    Best of luck.

  • How to turn off alerts for incoming emails

    How do you turn off alerts for incoming emails on the iphone?

    Settings>Sounds>Ringer and Alerts>New Mail>Off.

  • Adding pricing condition type  while complaint creation

    Hi,
    I want to add condition type , whille calim creation. I have written the Zpgm using crm_ordwer_maintian , we can do that.
    But the problem is I need to put in some BADI, i tried order_Save and pricing_I badi.
    But it gives dump 'maintian'  bapi in the order_Save. I treid with 'multi_ow'  but its not adding the condition type.
    Please help me , where I need to put this code ?
    Thanks,
    Sushant

    heyy, its working fine , some parameter missing.

  • How to disable alarms when iCal is off

    Hi all,
    I might be missing something here, but I believe there used to be two settings to turn off alarms in 10.4 and 10.5:
    1) disable all alarms
    2) disable alarms when iCal is off
    Did option 2) disappear in 10.6? I am really missing this feature.
    Thanks for your insights

    I too would like to know a way around this problem. In the prior version of iCal, you could enable alarms only when iCal was running. I routinely sync three computers, sometimes hours to days apart. So unless I remember to turn alarms off prior to shutting down the machines, the alarms are not properly updated upon syncing when an idle machine is turned back on.
    Hope this makes sense. Either way, it would have been better if Apple had not gotten rid of this feature in the new iCal.
    Eddie

  • How to shut off alerts ??

    Can anyone tell me how to shut off alerts?

    http://mynews.apple.com/unsubscribe/EN
    This is the link to unsubscribe!

  • "iCal can't read this calendar file. No events have been added to your iCal calendar."

    How do I deal with this error message-"iCal can’t read this calendar file. No events have been added to your iCal calendar." ? .ics vs .vcs?
    Thanks

    Greetings,
    What version of the Mac OS and what version of iCal are you running?
    Are you using MobileMe calendars (or any other server based calendars like Google) in your iCal?
    While you answer those questions you can try the following troubleshooting:
    1. First make an iCal backup:  Click on each calendar on the left hand side of iCal 1 at a time highlighting it's name and then going to File Export > Export and saving the resulting calendar file to a logical location for safekeeping.
    2. Remove the following to the trash and restart your computer:
    Home > Library > Caches > com.apple.ical
    Home > Library > Calendars > Calendar Cache, Cache, Cache 1, 2, 3, etc. (Do not remove Sync Cache or Theme Cache if present)
    Home > Library > Preferences > com.apple.ical (There may be more than one of these. Remove them all.)
    ---NOTE: Removing these files may remove any shared (CalDAV) calendars you may have access to. You will have to re-add those calendars to iCal > Preferences > Accounts.
    Once the computer is back up and running open iCal and test.
    Hope that helps.

  • Tutorial: 8 Adding a Conditionally Dependent Field

    Hi,
    I am trying to implement chapter 8 Adding a Conditionally Dependent Field. However, the Commission percentages stays enabled no matter what the value of the jobid is.
    Is this a bug or am I doing something wrong here?
    Thanks, Joep

    Joep,
    If you send your testcase for the LOV problem, we will also look at this issue.
    The conditionally dependent items work for me, so may be you made some typo.
    Steven Davelaar,
    JHeadstart Team.

  • Can you turn off alerts for when your on a call

    It drives me nuts when my cell beeps and vibrates while Im on a call...
    can I turn off alerts/notification for when I am on the phone.

    Maybe we shouldn't have to? It seems like a very simple setting to include that allows us to silence alerts while on a call. No other phone has ever blasted my text tone in my ear when I'm talking to someone. And there's no way to silence it once it starts, I had to listen to a 10 second text tone after telling the person to hold on today. Pretty stupid that this tiny feature was overlooked when they released the iphone 4, it was available on the 3. It's become so irritating that I'm considering returning my phone and going droid.

  • "Antispyware is turned off" alert error

    Network Magic version 5.1.8354.0-Pure0 ; Platform version: 11.1.8350.0
    I have Webroot Spysweeper version 6.1.0.100 installed on one my computers but the other computers have earlier versions of Spysweeper (6.0.2.49 and 6.0.2.39).
    It seems that the newer Spysweeper version 6.1.0.100 can't tell Network Magic that it exists and I get the "Antispyware is turned off" alert only on this computer. The older Spysweeper versions don't manifest this way.
    Any ideas?

    Hi renewabill, I think NM is not recognizing the newer version of your antispyware program correctly, Normally changes have to be made to NM when a new version of security program comes out.  The same problem happened when AVG 8 was released.
    My Cisco Network Magic Configuration:
    Router: D-Link WBR-2310 A1 FW:1.04, connected to Comcast High Speed Internet
    Desktop, iMac: NM is on the Windows Partition, using Boot camp to access Windows, Windows 7 Pro 32-bit RTM, Broadcom Wireless N Card, McAfee Personal Firewall 2009,
    Mac Partition of the iMac is using Mac OS X 10.6.1 Snow Leopard
    Laptop: Windows XP Pro SP3, Intel PRO/Wireless 2200BG, McAfee Personal Firewall 2008
    Please note that though I am a beta tester for Network Magic, I am not a employee of Linksys/Cisco and am volunteering my time here to help other NM users.

  • ICal automatic multiple alerts?

    Hello,
    I have an important appointment in 57 days.  I'd like to be reminded by iCal with an alert, 2 weeks, 1 week, 2 days, and 2 hours before that appointment.
    I know I can manually add all these alerts when recording the event in iCal.   Or: I can set an alert 2 weeks before. When that alert appears, I can modify the entry to set it to "2 days before" and so on.
    Is there an automatic --or at least easier-- way of arranging this kind of progression?  
    TIA

    Hi Gaurav,
    You can personalize the way in which you receive alerts.
    Simply choose Personalization to make individual settings for your alert inbox. You can determine a substitute who will then receive the alerts. In addition, you can choose whether alerts are sent to you time-independently or time-dependently. The default setting is that alerts are sent time-independently to your alert inbox and via e-mail when they occur. You can additionally select the communication methods FAX and SMS for time-independent alert notification.
    If you want to receive alerts only on certain days for a certain time, simply select the option for time-dependent sending of alerts and choose Create to create a new table entry. You can then choose the corresponding factory calendar, the time interval, and communication channel. Alerts that arise during this time frame will be sent in any case to your alert inbox. If you have also selected other communication channels, the alerts are additionally sent to you using these other channels. 
    This above text is from SAP help, do you think by changing anything in personnalisation i can stop multiple alerts. I have some issue with Personalisation link so was wondering would be worth to get tht personalisation issue resolved.
    Regards
    Ria

  • Ical appts. w/alerts are one hour off on iphone - how to fix?

    when I create an appointment in ical, it syncs fine with iphone, but the alert (and the appointment) are set for one hour later than what they are set for in ical. The timezone on both is accurate...Any ideas?

    Thx Bernard,
    You are very helpful
    When you went through the steps, were any of the settings different to those that I suggested?
    ......Yes, Time zone was uncheck in iCal and MM
    I don't think you mentioned importing previously. Where are the events originally created?
    .....I have a large spreadsheet of college athletic games that we keep in Excel and I import to iCal, they are ALWAYS one hour off after imported to iCal. Long before iPhone and MM too!
    I don't see that MobileMe is especially different to dotmac - except that you now have explicit control over the time zone of the calendar (whereas it used to be set to the one from which you originally published).
    ...Honestly the TZ Support is a HUGE pain and causes Much more trouble for all than anything it is suppose to help with..., been that way ever since iCal came out...
    One hour time differences often crop-up on a phone and are usually to do with daylight savings issues, but you don't mention a phone in your set-up so I am assuming this is not the case.
    ...again this one hour problem, has been an issue for me long before the iPhone and MM...
    I have to say that I don't have issues with my calendars and I have these synced across different systems and devices, so for me it really is a non-issue. (I should also say that I travel frequently and don't have problems with events in multiple time zones either.)
    ...glad it works for you, but it appears this is an issue for many. I used Now Up-To-Date for 10+ years and NEVER had trouble with import/export/sync...
    One thing I neglected to ask you is whether you do need to have time zone support - i.e. do you travel with any of the macs to which you sync or do you get invitations that originate in different time zones?
    ...I have no need for TZ Support even if I were and astronaut
    It would also be enormously helpful if you would provide data on what version of OS X and iCal you are using.
    ....I am on 10.5.5 and iCal 3.0.5
    Thx Much

Maybe you are looking for

  • Statistical condition type is not showing same value

    Dear All, I have one issue related with pricing condition that i want to use one statistical condition type ZEM1 suppose 100 INR which is entered manually at the contract level for suppose 10 qty but when i am creating the First sales order for 5 qty

  • Xcode 5 Clean failed

    I'm getting a strange error when trying to clean. It fails and: in the left sidebar it says "Uncategorized" next to the red exclamation point. At the top it says: Clean [app name]: Failed Beneath that it says: Create product structure -  /bin/mkdir -

  • Photo counts in Library Tab of Inspector Pane

    I run Aperture 3.1 on a home and work computer. Home runs Snow Leopard. Work runs Leopard. On my home computer there is a photo count shown along the right edge of the library tab across from each Project name. On the work computer, there is none. I

  • Change of PO Delivery Date

    Hi All, We have this user requirement. User wants to change the delivery date of aged  purchase orders raised. If the purchase order is more than three months old, then they are reevaluating the delivery date. Is it possible to change the delivery da

  • Printer Preferences is not available when printing PDF

    Printer Preferences is not available when printing PDF I have a PSC 1315 printer I have been using for several years on a system with Windows XP without any problem.  After purchasing an HP Pavilion 500 with Windows 8.1 Pro, I migrated my printer to