Apple Script: posix alias to posix file

I have path /private/tmp/test.txt, need to convert it into POSIX file (I need just convert "/private/tmp/test .txt" to "StartUpDisk:private:var:tmp:test.txt)". Can I do it?

Thanks :)

It's application, written on AppleScript using Script Editor

Answered by DTS Engineer in 714879022

As long as the file exists, you can use code like this:

set p to POSIX file "/Users/quinn/test.txt"
set f to p as alias
set s to f as string

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

As long as the file exists, you can use code like this:

set p to POSIX file "/Users/quinn/test.txt"
set f to p as alias
set s to f as string

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It works, Thanks!

Apple Script: posix alias to posix file
 
 
Q