Translate and open Windows network location strings
Mar 29, '04 10:01:00AM • Contributed by: HazMatt

Mar 29, '04 10:01:00AM • Contributed by: HazMatt
I saw this tip and it gave me the idea to write a script to solve an annoyance I've been having for a while: I work in a mostly Windows workplace and I often get emails with windows oriented paths:
Here's the AppleScript:
Save this AppleScript as an application, and to use, just copy the Windows path into into the clipboard and launch the script.
\\servername\volumename\directory\directory
I always thought it would be nice to be able to just click on the link like you can in Windows. Well, this isn't quite that nice, but it's better than having to go through the steps of navigation to the directory.Here's the AppleScript:
set myClip to the clipboard
set mytext to searchReplace(myClip, "<", "")
set mytext to searchReplace(mytext, ">.", "")
set mytext to searchReplace(mytext, ">", "")
set findIt to "\\"
set replaceIt to "/"
set mylocation to searchReplace(mytext, findIt, replaceIt)
set mylocation to "smb:" & mylocation
tell application "Finder"
open location mylocation
end tell
on searchReplace(theText, SearchString, ReplaceString)
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to SearchString
set newText to text items of theText
set AppleScript's text item delimiters to ReplaceString
set newText to newText as text
set AppleScript's text item delimiters to OldDelims
return newText
end searchReplace
Note: I got the searchReplace handler code from MacCentral
Save this AppleScript as an application, and to use, just copy the Windows path into into the clipboard and launch the script.
•
[8,061 views]