So che questo è un vecchio scambio, ma funziona ancora. Ho biforcato il codice per mostrare un esempio di conversione di un percorso di unità di rete in un protocollo SMB con un indirizzo IP del server.
Questo è utile se gli utenti di Windows hanno un drive di rete con caratteri come W: \ a \ really \ tedious \ folder \ path
link
Grazie per lo script originale PenguinRob.
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
on run {input, parameters}
set myClip to the input
set mylocation to searchReplace(myClip, "<", "")
set mylocation to searchReplace(mylocation, ">.", "")
set mylocation to searchReplace(mylocation, ">", "")
set mylocation to searchReplace(mylocation, "\", "/")
set mylocation to "smb:" & mylocation
# convert Windows network drive paths to SMB addresses EXAMPLE:
set mylocation to searchReplace(mylocation, "smb:W:", "smb://10.0.0.1/shares")
# check if the person who gave you the windows link used a lowercase drive letter:
set mylocation to searchReplace(mylocation, "smb:w:", "smb://10.0.0.1/shares")
# fix issue with spaces
set mylocation to searchReplace(mylocation, " ", "%20")
tell application "Finder"
open location mylocation
end tell
# after setting the location, set Finder to topmost, or delete this section if you dont want that.
tell application "Finder"
activate
end tell
return input
end run