AppleScript Question

Sivakatirswami katir at hindu.org
Mon Dec 17 16:40:01 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, (since you want
to poke values in already compiled apps...) but it works great 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/apps
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 with 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 "someuser"
set tPassword to "somePassword"

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
    do tApplescript as AppleScript
end doUpload

Of course one day I will change all the above and use the on board FTP
commands, but .... need a little more robust feedback...


 
> 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