Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iCal alarm opening URL with script. HOW?



Hi Tim,

The script below would allow you to enter the address manually, but I don't think I have got what you are trying to achieve.  If the purpose is to open a given address at a set date, then just set the property to the given address as in the previous example.  If you are trying to automatically set different addresses, then your script suddenly becomes more than a beginner would be expected to achieve.  The script  here allows the user to enter an address, but I don't think that that is what you want:


property target_URL : "www.apple.com"
set target_URL to the text returned of (display dialog "Enter the requested URL" default answer "http://www.apple.com")
tell application "Safari"
open location target_URL
end tell

This next script allows you to set options based on dates and this may be more like what you may wish:
This has a range of dates that opens different web sites based on the date that your script is called.  By setting third, fourth , fifth dates etc., your script will automatically go to the right web page based on the date iCal opens the script.  If the script is run on a date not in the list, then it will ask you for an address.
set myFirstDate to "2007-06-11"
set myFirstAddress to "http://www.apple.com"
set mySecondDate to "2007-06-12"
set mySecondAddress to "http://www.store.apple.com"
set TodaysDate to do shell script "date +%Y-%m-%d"

if TodaysDate is myFirstDate then
set target_URL to myFirstAddress  -->  Sets the first address as the chosen site
else
if TodaysDate is mySecondDate then
set target_URL to mySecondAddress -->  Sets the second address as the chosen site
end if
end if
tell application "Safari"
try
open location target_URL  --> Goes to the Web page chosen
on error  -->  If the dates do not match the current date
set target_URL to the text returned of (display dialog "Enter the requested URL" default answer "http://www.apple.com") --> Asks for you to choose a web page
end try
end tell

-->
On 11/06/2007, at 5:37 AM, Tim Whiteknight wrote:

Ok I did what you said but took out the URL to the store. Something like this. Got errors instead.
The url will be different each day on iCal. It will be on Adobe seminars. So what would I do different to do this. Below is what I wrote to the editor.

property target_URL :

open location target_URL

PS is there an audio book on Applescript. Dyslexic at times.

     Tim 

http://amazinghumor.com/pictures/moon_river.shtml





On Jun 9, 2007, at 9:30 PM, Peter Baxter wrote:

Hi Tim,

1.  An excellent beginners book with lots of good ideas is Applescript: The Missing Manual by Adam Goldstein.  It is available from Pogue press which has lots of other good AS books.
2.  Another starter is to enable the apple scripts that are supplied with your mac and there are lots of them including this one below which starts to answer your question.  the script below opens a URL which may be kind of familiar.  Just select the text and select Mail -> Services -> script editor -> Make new applescript.  Now you have a script that will go to a URL. Just change the URL address to the one you want to go to.

property target_URL : "http://store.apple.com/"

open location target_URL


Now open iCal and make a date in the heading "Alarm" select run applescript and select your script.  It will now open your URL on the set date.

3.  Going back to the supplied applescripts in the menu bar, you can enable these for easy access through Applescript Utility which allows you to put the scripts in the menubar for universal access.



On 09/06/2007, at 9:29 AM, Tim Whiteknight wrote:

I am trying to learn how to write scripts. I have apple scripts editor but can't figure out how to use it. I get lost on the Help menu. Is there an easier way to learn scripts. Is there a tutorial out there for that or a web site to help with that. Not much on reading books but will. Listen to audio tapes or Video.
What I am trying to do is in iCal on the alarms I want to run a script that will go to iCal url and open the address either in safari or Firefox at a certain time. On what ever the address is in the url.
Is there help out there. Send script to email@hidden I will copy it to the editor and run it from there. Thank you for any help.
     Tim Whiteknight




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Peter Baxter

Music creates order out of chaos: for rhythm imposes unanimity upon the divergent, melody imposes continuity upon the disjointed, and harmony imposes compatibility upon the incongruous.
-- Yehudi Menuhin







Peter Baxter

Music creates order out of chaos: for rhythm imposes unanimity upon the divergent, melody imposes continuity upon the disjointed, and harmony imposes compatibility upon the incongruous.
-- Yehudi Menuhin



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >iCal alarm opening URL with script. HOW? (From: Tim Whiteknight <email@hidden>)
 >Re: iCal alarm opening URL with script. HOW? (From: Peter Baxter <email@hidden>)
 >Re: iCal alarm opening URL with script. HOW? (From: Tim Whiteknight <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.