The ScriptingBridge approach is more involved, because the size and
position accessors don't seem to resolve automatically...

My Ruwin library is an example of how to do it though:

http://github.com/lachie/ruwin
http://github.com/lachie/ruwin/blob/20a23ac330f65b4930c1b26be2ce463e05a516c7/ruwin.rb

:lachie
http://smartbomb.com.au
http://www.flickr.com/photos/lachie/



On Wed, Feb 25, 2009 at 3:05 AM, Alan Skipp <al_sk...@fastmail.fm> wrote:
> One way of achieving this is by using rb-appscript, which you can install as
> a rubygem:
> http://appscript.sourceforge.net/rb-appscript/index.html
>
> There's also the Scripting Bridge:
> http://developer.apple.com/documentation/Cocoa/Conceptual/RubyPythonCocoa/Articles/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40005424-SW1
>
> The rb-appscript version of your Applescript would look like this:
>
> require "rubygems"
> require "appscript"
> include Appscript
>
> res = (`/usr/sbin/system_profiler SPDisplaysDataType | grep
> Resolution`).split
> width,height = res.grep(/\d+/)
>
> window = app("System Events").processes[its.frontmost.eq(true)].windows[1]
> window.position.set([0, 22])
> window.size.set([width, height])
>
> -al
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to