Applescript & Runtime Rev

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Applescript & Runtime Rev

Post by johnmiller1950 » Wed Feb 20, 2008 3:52 am

Greetings All,

I am writing the script to create a Mac Installer for one of my programs. I have never used Applescript before, but it appears that it is what I need to determine the size of various folders. I am using the following script:

tell application "Finder"
set x to ":Users:johnmiller:Desktop:MISC Folders" as alias
get physical size of folder x
set y to result
set y to (y / 1024 / 1024 / 1024)
end tell

This runs great in Apple's Script Editor, but when I place the script in a card field (cd fld "myScript") and use the following script in a button, I get the error message ("execution error").

on mouseUp
do cd fld "myScript" as appleScript
put result ()
end mouseUp

If I run just the first 2 lines of the script, x is returned as the result and reports correctly. When I add the next line "get physical size of folder x",
I get the "execution error" message.

Does anybody have any ideas and/or expertise they would like to share?

Oh, I have played around with various other applescripts in Revolution, and they have all worked the same as in Apple's Script Editor. I can't figure this one out.

Thanks,
John Miller

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Applescript & Runtime Rev

Post by johnmiller1950 » Thu Feb 21, 2008 11:54 am

I think I found the answer.

Adding the volume name to the script inside Revolution solved the problem.

My script now reads . . .

tell application "Finder"
set x to ":Mac OS X HD:Users:johnmiller:Desktop:MISC Folders" as alias
get physical size of folder x
set y to result
set y to (y / 1024 / 1024 / 1024)
end tell

The Result now returns the correct folder size.

-- John

Post Reply