Jump to content
4 posts in this topic

Recommended Posts

Hi,

 

I am using AppleScript with POSIX paths and I am having trouble here. So say if I did this:

 

set theFile to choose file with prompt "Choose a file" without invisibles

 

The variable "theFile" would be something like this when I choose the file:

 

HD:Kexts:mykext.kext

 

So then I use POSIX to change the colons into slashes:

 

set theFilePOSIX to POSIX path of theFile

 

And the value of theFilePOSIX would be like:

 

HD/Kexts/mykext.kext/

 

The problem is that POSIX puts a slash at the end of mykext.kext, so it gets messed up, any way to remove this slash?

Link to comment
https://www.insanelymac.com/forum/topic/104899-applescript-posix-path/
Share on other sites

Thanks, but the problem with that method and the other one I tried is, strangely POSIX puts an extra slash on some kexts, but not for others, so sometimes it works for some kexts and for others it doesn't. I found the perfect solution though.

 

tell application "System Events" to set newVariable to POSIX path of oldVariable

 

Works fantastic.

×
×
  • Create New...