Apple scripts and "get from list

Thread Tools Search this Thread
Operating Systems OS X (Apple) Apple scripts and "get from list
# 1  
Old 09-09-2011
Apple scripts and "get from list

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

# 2  
Old 09-09-2011
Not missing a double quote somewhere? (line answer...)
# 3  
Old 09-09-2011
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"}
    if item is equal to "Prodcution" then
        tell application "iCal"
            GetURL "http://intranet/webdav/Conferance_Room.ics"
        end tell
    end if
end if

if i click on producation it does not do anything

thanks for the help
# 4  
Old 09-09-2011
In general, you should seek help regarding AppleScript from AppleScript related sites. Likewise, Ruby from Ruby, Python from python...

The 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

I'm a bit rusty on the ol' applescript. Sorry.
# 5  
Old 09-09-2011
thanks, after some messing around i got it to work

you suggestion on debugging works perfectly

btw i am not a big fan of applescript, it just works nicely for users who need a GUI, Buttons etc

# 6  
Old 09-22-2011
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 ;

	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 ""
		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 ""
		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 ""
		end tell
	end if
on error errMsg number errorNumber
	display dialog "sumthin broke"
end try

Last edited by doctorfoo1; 09-22-2011 at 10:19 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scheduling scripts with "at" command

Hi All , I need to create a scheduling capability on one of Linux boxes so that i could some 6 scripts back to back after a gap a given time difference . To run script1 :-- my for 3 hrs , followed by 2nd script , for 10 hrs , then for 2 hrs , then... (3 Replies)
Discussion started by: Anamica
3 Replies

2. UNIX for Dummies Questions & Answers

Meaning of "exec 9<name" in scripts

I have found code like exec 9<filename a number of times when looking over commonly used scripts here. What all does this do? Sometimes the filename is simply a list, but seems to always have read/write/execute attributes for all. I think the "<" means to accept this as input, but don't know... (3 Replies)
Discussion started by: wbport
3 Replies

3. Shell Programming and Scripting

Read from "list1" and list matches in "list2"

I want to print any matching IP addresse in List1 with List 2; List 1 List of IP addresses; (3 Replies)
Discussion started by: lewk
3 Replies

4. UNIX for Dummies Questions & Answers

Scripts exists but crontab says "File not found"

Hi All, We have an archiving script on our applications box. It is scheduled to run at 36th minute every hour. 36 * * * * / But it throws an error saying "sh: / not found". I am not able to understand why. # ls -l / ; file / -rwxr-xr-x ... (4 Replies)
Discussion started by: satish51392111
4 Replies

5. Ubuntu

Ubuntu Server 10.04 LTS - Regular crontab "caches old scripts"

Hi, I'm using a Ubuntu Server 10.04 LTS and it works like a charm, except for the regular crontab. Onde day a user had some problems with crontab, i analyse it and i see no problemns, all my stuff is working right. Cron is running smoth... I only noticed it when i altered a script already... (2 Replies)
Discussion started by: grafman
2 Replies

6. Shell Programming and Scripting

list all scripts in crontab which contains the string "sqlplus"

Hi folks I use a Solaris 10 box with Bash shell. I have here a script (it works!) to list all scripts in crontab which contains the string "sqlplus": for i in $(ls `crontab -l | grep -v '#' | awk '{ print $6 }' | grep -v '^$'`); do grep -l 'sqlplus' "$i"; done Is there a more elegant... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

7. Shell Programming and Scripting

Joining 3 AWK scripts to avoid use "temp" files

Hi everyone, Looking for a suggestion to improve the below script in which Ive been working. The thing is I have 3 separated AWK scripts that I need to apply over the inputfile, and for scripts (2) and (3) I have to use a "temp" file as their inputfile (inputfile_temp and inputfile_temp1... (2 Replies)
Discussion started by: cgkmal
2 Replies

8. UNIX for Dummies Questions & Answers

UNIX Scripts "Load Error" with MicroFocus COBOL subprograms

When running our UNIX job scripts we randomly get the following 198 error below. When we restart the job it works fine. I haven't been able to recreate the problem in test, so I'm wondering if it has something to do with Cron or possibly a memory error or memory leak. I don't see anything... (5 Replies)
Discussion started by: rthiele
5 Replies

9. News, Links, Events and Announcements

Open Group suing Apple over "Unix"

Our Admin, Neo, has some experience with the subject of this news item: It appears that The Open Group is suing Apple for using the term Unix without licensing from The Open Group. (3 Replies)
Discussion started by: auswipe
3 Replies
Login or Register to Ask a Question