simple applescript?
Sarah Reichelt
sarahr at genesearch.com.au
Sun Dec 12 17:38:14 EST 2004
Hi Chipp,
As others have said, you need to include the word "file" or "alias"
before the file path in your AppleScript. Also, AppleScript file paths
are different to the Unix style paths used by Rev. e.g. for the same
test file, AppleScript gives me this path "Sarah
HD:Users:sarah:Desktop:test.txt" and Rev gives me this:
"/Users/sarah/Desktop/test.txt
", with the crucial difference being that one path includes the hard
disk name and the other doesn't. To convert from one to the other, you
can use the AppleScript POSIX file description, but the easiest way is
to use the revMacFromUnixPath function.
Editing your script, I get:
on mouseUp
answer file ""
if it is empty then exit to top
put revMacFromUnixPath(it) into pPDFpath
put "tell application " "e& "Finder" & quote & cr into tScript
put "set the file type of alias " "e& pPDFpath "e& \
" to " "e& "PDF " "e& cr after tScript
put "end tell" after tScript
do tScript as Applescript
put the result into sError
end mouseUp
Cheers,
Sarah
On 10 Dec 2004, at 8:05 pm, Chipp Walters wrote:
> on mouseUp
> answer file ""
> if it is empty then exit to top
> put it into pPDFpath
> replace "/" with ":" in pPDFpath
> if char 1 of pPDFpath is ":" then delete char 1 of pPDFpath
> put "tell application " "e& "Finder" & quote & cr into tScript
> put "set the file type of " "e& pPDFpath "e& \
> " to " "e& "PDF " "e& cr after tScript
> put "end tell" after tScript
> do tScript as Applescript
> put the result into sError
> end mouseUp
More information about the use-livecode
mailing list