Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 5, 2012, 11:24 PM   #1
Jack9034
macrumors member
 
Join Date: Dec 2011
AppleScript Editor Question

I need help with this script:

Code:
set a to display dialog "What server would you like to connect to?" default answer "Student Server Disks" with title "Connect to Server"
if text returned of a is "Student Server Disks" then
	try
		mount volume "afp://Student:student@server.school.school.nz/"
	end try
end if
if text returned of a is "Colin" then
	try
		mount volume "smb://Colin/Owner/"
	end try
end if
if text returned of a is "Jacks Laptop" then
	try
		mount volume "smb://Jack-pc/Reynolds/"
	end try
end if
if text returned of a is "Kaitlins Laptop" then
	try
		mount volume "smb://Kaitlin-pc/Kaitlin/"
	end try
end if
If the text that I type in to the text box does not match Student Server Disks, Colin, Jacks Laptop or Kaitlins Laptop, I want it say There was a problem connecting the the server "what-ever-i-typed-in".

PLEASE HELP I NEED HELP!!!

THANKS IN ADVANCE
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2012-05-06 at 4.10.06 PM.png
Views:	49
Size:	73.8 KB
ID:	338667  
__________________
15" Retina MacBook Pro, 2.3GHz, 8GB RAM, 256GB SSD
Jack9034 is offline   0 Reply With Quote
Old May 6, 2012, 09:43 AM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
No need to shout. You only get the second message if the mount volume statement encountered an error. If you want to display a dialog when the text you type doesn't match try this :

Code:
display dialog "What server would you like to connect to?" default answer "Student Server Disks" with title "Connect to Server"
copy the result as list to {text_returned, button_pressed}
if text_returned is "Student Server Disks" then
	try
		mount volume "afp://Student:student@server.school.school.nz/"
	end try
else if text_returned is "Colin" then
	try
		mount volume "smb://Colin/Owner/"
	end try
else if text_returned is "Jacks Laptop" then
	try
		mount volume "smb://Jack-pc/Reynolds/"
	end try
else if text_returned is "Kaitlins Laptop" then
	try
		mount volume "smb://Kaitlin-pc/Kaitlin/"
	end try
else
	display dialog "There was a problem connecting to the server" & space & "“ " & text_returned & " ”" & "." buttons {"OK"} default button 1 with icon stop
end if

Last edited by kryten2; May 7, 2012 at 09:37 AM.
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Upgrade AppleScript editor tcpms Mac Applications and Mac App Store 5 Apr 14, 2014 10:49 AM
Possible AppleScript question Telp Mac Basics and Help 2 Mar 28, 2014 10:04 PM
\n within regex gets replaced with new line by AppleScript Editor poobear Mac Programming 7 Jun 27, 2012 05:51 PM
iCal "Run Script" alert opens .scpt file in AppleScript Editor instead of running it drskot Mac Programming 3 Jun 7, 2012 12:47 PM

Forum Jump

All times are GMT -5. The time now is 05:21 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC