Today I wrote a Ruby version of my quicky function for calling Applescript from Perl:
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end
The usage looks like this (almost identical to the Perl version):
osascript <<-END
tell application "Finder"
display dialog "Hello"
end tell
END