Windows network path convert for Mac

In my company most people using Windows PC. They are sending always changing Windows Network paths/names so I was trying to use Automator via Apple Script.

I have three issues. The first they share all links with the drive letters, the second the beginning path switches order on the Mac side and lastly once get the right order I still cannot access it because of spaces.

This is one of the original Windows paths: [b] P:\Marketing\Team\Divisions[/b]USB_v_1.21.0.2\Wyse USB Firmware Tool

If I drag drag it into Terminal it displays it like this: /Volumes/Marketing/Team/USB_v_1.21.0.2/Wyse\ USB\ Firmware\ Tool.exe

I can see All directory markers must be changed from '' to ˜/˜ and secondly all spaces must have a preceding delimiter the ˜'; however if I hit connect to server with this path it with not work. I also noticed the initial 3 folders are in reversed order from the P drive format i.e. P:\Marketing\Team\Divisons vs when I manually go on the Mac side i have to type smb://ylbc.local/divisions/Marketing.

i have 5 collueges that use Mac and we all use a short cut to the last folder without spaces smb://ylbc.local/divisions/Marketing/Team/ and then have to go clicking until we get to the correct folder.

I believe found the script below for Automator, but I am just not sure how to make it work:

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, [b]"smb:W:", "smb://10.0.0.1/shares")[/b]

    # check if the person who gave you the windows link used a lowercase drive letter:

    set mylocation to searchReplace(mylocation, [b]"smb:w:", "smb://10.0.0.1/shares"[/b])

    # 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

Any help would be appreciated.

Model: iMac late 2012
Operating System: Mac OS X (10.10)