Posix Path Woes

Hey, I’m trying to write a script that takes an input file and a destination and then runs it through a shell script that unpacks .lit ebooks so I can read them on my mac. I’d eventually like to make it so that the script can take a whole folder of .lit files and pass them through all at once. Thus far, the code goes like this:

set filePath to quoted form of the POSIX path of ((choose file with prompt "Please select the .lit file you would like to decompress.") as alias)

set decompressionPath to quoted form of the POSIX path of ((choose folder with prompt "Please create and select the folder you wish to decompress into.") as alias)

do shell script "/bin/bash clit " & filePath & " " & decompressionPath


The problem lies in the way that I’m currently handling the path of the input file. There are spaces in the file name which the script is just passing on without adding in slashes. Any help would be greatly appreciated.

Model: pbook 12"
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

˜Quoted form’ is supposed to handle all the escaping. You probably need to provide a full path to the ˜clit’ tool.

Side note: choose file and choose folder returns aliases (or a list of aliases when applicable), so you don’t need that coercion.

remove your /bin/bash from the do shell scritp as you can see with

do shell script "echo $SHELL"

do shell script uses bash by default.

your shell script should have #!/bin/bash as its first line so you don’t have to do this