Class: Wasko::Applescript
- Inherits:
-
Object
- Object
- Wasko::Applescript
- Defined in:
- lib/wasko/applescript.rb
Class Method Summary collapse
-
.run ⇒ Object
Runs a piece of Applescript,.
Class Method Details
.run ⇒ Object
Runs a piece of Applescript,
Wasko::Applescript.run do
"set ten_and_ten to 10 + 10"
end
=> "20"
Since Applescript has a nasy bit of littering its return values with ‘n`, already escaping those.
12 13 14 15 |
# File 'lib/wasko/applescript.rb', line 12 def self.run value = `/usr/bin/osascript -e "#{yield.gsub('"', '\"')}"` value.gsub("\n", '') end |