I'm trying to create a way of converting a windows path to a Mac path and back again. I've found varous examples of how to do this online but going from Mac to windows is causing me a problem. This seems to be mainly due to the script not being able to remove part of the folder structure to go to a mapped drive letter
Mac
Volumes/Storage/Dropbox/Live/1152_projectFolder/05_cg/renders/anim_test/RR01c_chalk_rl.0350.exr
Windows
S:\1152_projectFolder\05_cg\renders\anim_test\RR01c_chalk_rl.0350.exr
See the above examples, to go from Mac to Windows i need to remove "Volumes/Storage/Dropbox/Live/" from the path which i can't seem to do without causing an error.
Windows to Mac
Mac to Windows
(no idea why the last script is double spaced, its not in automator for me)
Additonally i'd like the script to open the finder location of the file, for the Windows to Mac path. I'd like the whole script to run from a droplet on the desktop the path is dragged into rather than from the services menu because various chat programs don't support services in the right click menu so if im set a path in a chat conversation with these scripts i have to paste into a TextEdit doc to convert, a step i'd like to remove.
Thanks
Mac
Volumes/Storage/Dropbox/Live/1152_projectFolder/05_cg/renders/anim_test/RR01c_chalk_rl.0350.exr
Windows
S:\1152_projectFolder\05_cg\renders\anim_test\RR01c_chalk_rl.0350.exr
See the above examples, to go from Mac to Windows i need to remove "Volumes/Storage/Dropbox/Live/" from the path which i can't seem to do without causing an error.
Windows to Mac
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 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
set mylocation to searchReplace(mylocation, "smb:S:", "Volumes/Storage/Dropbox/Live/")
return mylocation
end run
Mac to Windows
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 mytext to searchReplace(myClip, "<", "")
set mytext to searchReplace(mytext, ">.", "")
set mytext to searchReplace(mytext, ">", "")
set mytext to searchReplace(mytext, "smb://", "\\\\")
set findIt to "/"
set replaceIt to "\\"
set mylocation to searchReplace(mytext, findIt, replaceIt)
set mylocation to "S:\" & mylocation
return mylocation
end run
(no idea why the last script is double spaced, its not in automator for me)
Additonally i'd like the script to open the finder location of the file, for the Windows to Mac path. I'd like the whole script to run from a droplet on the desktop the path is dragged into rather than from the services menu because various chat programs don't support services in the right click menu so if im set a path in a chat conversation with these scripts i have to paste into a TextEdit doc to convert, a step i'd like to remove.
Thanks