i have this code that i want to run but it is not working
i.e if the user slected say production it will then run the command for production
any ideas what i need to change
set question to choose from list {"production"}
set answer to question
if answer question is "Production: then
tell application "iCal"
getURL" http:///intranet/prod"
end tell
end if
sorry i miss type it in the post
there should have been a " around Prodcution
in my script i do have it correctly done
---------- Post updated at 09:08 AM ---------- Previous update was at 06:38 AM ----------
sorry here is my code fully
set theQuestion to choose from list {"Prodcution", "201sa", "SS Meeting Room", "503ms"} with prompt " Choose a Calendar to Subscribe to"
if theQuestion is false then
display dialog "You have clicked cancel" with icon stop buttons {"Exit"}
else
if item is equal to "Prodcution" then
tell application "iCal"
GetURL "http://intranet/webdav/Conferance_Room.ics"
end tell
end if
end if
In general, you should seek help regarding AppleScript from AppleScript related sites. Likewise, Ruby from Ruby, Python from python...
The unix.com forums are primarily targeting command line scripting issues, involving shell commands one might use in bash, ksh, sh, and the like.
But, to your specific AppleScript issue, in the post containing "sorry here is my code fully" change the line that tests for "Prodcution" to this:
if theQuestion contains "Prodcution" then
No need to set another variable to the contents of theQuestion.
When you lack feedback from AppleScripts, create your own.
display dialog "You chose " & theQuestion
here is a snippit I modified your code using Safari instead of Ical, it was easier to pull a webpage as a demo than an iCal doc ;
try
choose from list {"Prodcution", "201sa", "SS Meeting Room", "503ms"} with prompt " Choose a Calendar to Subscribe to"
if the result is {"Prodcution"} then
tell application "Safari"
make new document at end of documents
set URL of document 1 to "http://en.wikipedia.org/wiki/Get_a_Clue/"
end tell
else if the result is {"201sa"} then
tell application "Safari"
make new document at end of documents
set URL of document 1 to "http://en.wikipedia.org/wiki/Get_a_Clue/"
end tell
else if the result is {"SS Meeting Room"} then
display dialog " you eat f00"
tell application "Safari"
make new document at end of documents
set URL of document 1 to "http://en.wikipedia.org/wiki/Get_a_Clue/"
end tell
end if
on error errMsg number errorNumber
display dialog "sumthin broke"
end try