A bit new to AS so i am having trouble creating or finding the right script.
I would simply like to copy the path of a file/folder and replace the forward slashes with back slashes then copy the result to the clipboard ( i need to send the path to PC users).
Help is much appreciated! Thanks in advance.
set macPath to POSIX path of (choose file)
set pcPath to srchRep(macPath, "/", "\\")
on srchRep(theStr, fndStr, repStr)
set atid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {fndStr}
set tempList to text items of theStr
set AppleScript's text item delimiters to {repStr}
set theStr to tempList as string
set AppleScript's text item delimiters to atid
return theStr
end srchRep
::edit:: I forgot the clipboard part but im getting off the train, be back soon.
thank you for the quick reply!
this is definitely part of what i need, however i would like to use this in a context menu…i’m adding it to the BigCat context menu plugin…this allows me to simply right click on a file (or folder) and run a script. Any suggestions? Thanks James.
Hi James,
save the following script as application
and drag it into an Finder window next to the search field in the toolbar.
Then select an item and click the script’s icon
tell application "Finder" to set these_items to selection
try
set macPath to POSIX path of (item 1 of these_items as alias)
set the clipboard to srchRep(macPath, "/", "\\")
end try
on srchRep(theStr, fndStr, repStr)
set atid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {fndStr}
set tempList to text items of theStr
set AppleScript's text item delimiters to {repStr}
set theStr to tempList as string
set AppleScript's text item delimiters to atid
return theStr
end srchRep
surely you mean Hi redbrick
That rocks.
Thank you so much guys!
I do indeed