Tclapplescript has more options (like for compiling and saving, etc.)
but the 'execute' call is the workhorse of dynamic scripting. If you
save the following as a file with execute permissions, then you can
run it just like any other tool from the command line without having
to use tclsh. If you want to use tclsh, then you can (optionally)
leave off the first three lines. The script illustrated is "hard-
quoted" script. If you need to pass variables into a script, then you
can build it up with the 'append' command. All Tcl commands that have
man pages use the 'n' prefix -- "man n append", "man n file", etc.
#!/bin/sh
# tclsh ignores the next line because comments are continued with a
backslash \
exec tclsh "$0" "$@"
package require Tclapplescript
AppleScript execute {
tell application "Finder"
activate
display dialog "Wins the Lottery!" with icon note
end tell
}
PS: Watch it if you clip this from Apple Mail, sometimes spurious
characters not good for shell scripts creep in depending on encoding
factors. You should be able to get rid of them by using the 'nano'
editor.