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
Thanks for this. Now I can call Ruby from Applescript like this
.
set rubyscript to “~/scripts/that-script”
do shell script rubyscript
.
and use Ruby with occasional Applescript thanks to your osascript function. Nicely done!