character replacement

how do i replace a certain character in a string? ex: “Macintosh HD:User:Username:Directory:File” becomes “/User/Username/directory/file”.

If you have an alias or file such as “Macintosh HD:User:Username:Directory:File”, then do something like this:

set myPath to "Mac mini HD:User:Username:Directory:File"
set myPath to POSIX path of myPath

To go the other way:

POSIX file myPath

This is covered in the FAQ, as well as Apple Technical Note TN2065.

Hi code_monkey,

Not replacing a character in a string, but does what you seem to be asking.

set x to "Macintosh HD:User:Username:Directory:File"
set y to POSIX path of x

Best wishes

John M