Putting current network location in alert dialogue box.

This is what I have so far. It’s a combination of scripts I have found on the net so I can’t take any credit.


try
	set the_locations to (do shell script "scselect")
on error e
	set the_locations to e
end try
set the_locations to the_locations's paragraphs 2 thru -1
repeat with i from 1 to (count the_locations)
	set this_location to item i of the_locations
	set item i of the_locations to my extract_location_name(this_location)
end repeat
set the_delim to ASCII character 10
tell (a reference to my text item delimiters)
	set {old_tid, contents} to {contents, the_delim}
	set {the_locations, contents} to {the_locations as text, old_tid}
end tell
--return (do shell script "echo " & quoted form of the_locations & " | sort")'s paragraphs

set the_choice to (display alert "Current Locations" message "" & the_locations & "" buttons {"View Files", "Connect...", "Continue"} default button 3 giving up after 15)

on extract_location_name(this_location)
	tell (a reference to my text item delimiters)
		set {old_tid, contents} to {contents, tab}
		set {this_location, contents} to {this_location's text item 2's text 2 thru -2, old_tid}
	end tell
	return this_location
end extract_location_name

When I use “scselect” in terminal a “*” comes up next to the active network location. With the script above it comes up with all my network locations… minus the star. What I need is the star to show up as well. Or better yet, only the active network location. Any help would be appreciated.

This also works here:

try
	set l to do shell script "scselect"
on error l
end try
set d to text item delimiters
set text item delimiters to "*"
set l to paragraph 1 of l's text item -1
set text item delimiters to "("
set l to l's text from text item 2 to -2
set text item delimiters to d
display alert "Current Location:" message l