AppleScript Question

Sivakatirswami katir at hindu.org
Sun Dec 16 13:18:00 EST 2001


on 12/12/01 5:27 AM, Gene wrote:

> I understand how to use AppleScript with the "Do" command but I am also
> interested
> in knowing: Is there a way to call compiled AppleScript scripts or AppleScript
> applications from Transcript  and have the ability to pass parameter values
> back
> and forth?

Our strategy here which may not address your context need, but it works
great (in Supercard but will work in Rev also) is: store applescripts as
text chunks, and replacement strings in those text chunks, then later you
use a replace function to poke your parameters into the text chunk then run
that as an appleScript. If you have external scripts then open them in
script Editor, copy the text, save as raw text in Bbedit or simpleText then
read them first, poke your parameters, then run them... These are not
compiled of course, but will for small scripts it's not much of an issue.
 

create a sub-stack call it something like "code_chunks"
each card carries a field with applescripts like this:

=======
set tFile to "€€€theFileToLoad€€€" as alias
set tHost to "mahiai.aloha.net"
set tPath to "€€€Destination€€€"
set tUser to "hinduis"
set tPassword to "dbNEVH"

tell application "Interarchy 5.0"
    store tFile host tHost path tPath user tUser password tPassword
end tell
=======
Give the card a name and the field a name you will refer to later... then in
your project script you have handlers like this:

(this is in superTalk, but minor changes will make it work in Rev)

on doUpload uploadPath,filePath,ftpServer
-- first get your applescript:
    put field "codeChunk" of card ftpServer of stack "code_chunks" into
tAppleScript
--now insert your values/parameters
    replace "€€€Destination€€€" with uploadPath in tApplescript,
    replace "€€€theFileToLoad€€€" with filePath in tApplescript
--now you run the script... it's not compiled
--but for short scripts time is not an issue
--modify the following for Rev.
    get script (do, AppleScript, it)
end doUpload


 
> Thanks for any help.
> Gene Kennedy


Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
katir at hindu.org 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org

Read The Master Course Lesson of the Day at
http://www.gurudeva.org/lesson.shtml




More information about the use-livecode mailing list