[MacRuby-devel] Ruby scripting of OSX Leopard - pointer needed

Sophie (itsme213) itsme213 at hotmail.com
Mon Feb 23 11:35:51 PST 2009


Somewhat new to OSX, know Ruby well. I'm sure this is not the right list to 
post this to, but I'm getting nowhere, and finally found this list ...

I've spent about 3 hours and untold googling trying to figure out how to do 
the below in Ruby. I cannot even get past what kind of Scripting Bridge if 
any I need, what gems to install if any, and how to get my hands on the 
relevant objects and play with them in irb, learn their methods and 
properties, etc.

Could some kind soul please help with either
  - pointer to where I should look for info
  - some specific things to do for this (totally trivial) script below

Thanks! -- Sophie


set resolution to words
  of (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 
Resolution")
set {width, height} to {item 2, item 4} of resolution

tell application "System Events"
  tell (first process whose frontmost is true)
    set position of first window to {0, 22}
    set size of first window to {width, height}
  end tell
end tell





More information about the MacRuby-devel mailing list