on run --for Dialog
display dialog "出発地と目的地をスペースで区切って入力" default answer "" buttons {"OK"} default button 1
set theText to text returned of result
openMaps(theText)
end run
on handle_string(theText) --for LaunchBar
openMaps(theText)
end handle_string
on openMaps(theText)
set theList to makeList(theText, " ")
set saddrText to item 1 of theList
set daddrText to item 2 of theList
do shell script "open 'http://maps.apple.com/?saddr=" & saddrText & "&daddr=" & daddrText & "'"
end openMaps
on makeList(theText, theDelimiter)
set tmp to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
set theList to every text item of theText
set AppleScript's text item delimiters to tmp
return theList
end makeList