Does Applescript work?

Sarah Reichelt sarahr at genesearch.com.au
Sun Feb 3 21:29:00 EST 2002


Having struggled with AppleScript for many years, I have a few pieces of
advice. 

Firstly, always write & debug in an AppleScript editor before transferring
the script to HyperCard or Rev.

Secondly, do the bare minimum in AppleScript and do as much as you can in
xTalk - it is faster to run and easier to program & debug.

With your list of processes, I used the following technique:

I copied this script into a field:
    tell application "Finder"
        return every process
    end tell

Then I had a button with this script:
    on mouseUp
      do fld "AppleScript1" as AppleScript
      -- now get what the AppleScript returned
      put the result into processList
      -- now do your stuff
    end mouseUp

I prefer to use a field rather than assembling the script in a Rev script
because it is much easier to catch any errors and to edit later. You can
hide the field once you have it working properly. If there is any chance of
the AppleScript failing, use a "try" construct and return the error to your
Rev script.

Cheers,
Sarah


> I'm still struggling with Revolutions ability to use (or not) Applescript.
> The following script doesn't work at all for me.  It works fine from the
> script editor but not from Revolution.  You'll see I set x to three
> different values, comment out the later one or two to try different tests.
> 
> The tests are these:
> 
> tell application "Finder" to set the clipboard to name of every process as
> text
> 
> tell application "Finder" to set the clipboard to "test"
> 
> set the clipboard to "test"
> 
> 
> My clipboard remains unchanged throughout.   Is this true for everyone?
> Also my Finder doesn't seem to collect the name of every process running.
> 
> 
> on mouseUp
> put "tell application "&quote&"Finder"&quote&" to set the clipboard to
> name of every process as text" into x
> put "tell application "&quote&"Finder"&quote&" to set the clipboard to
> "&quote&"test"&quote into x
> put "set the clipboard to "&quote&"test"&quote into x
> put x
> put empty into card field "Procs"
> do x as AppleScript
> select text of card field "Procs"
> paste
> end mouseUp
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 




More information about the Use-livecode mailing list