# RejectConf RubyOSA hack

**URL:** <https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010>\
**Category:** Ruby\
**Created:** [January 23, 2007, 12:33am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010 "2007-01-23T00:33:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 12:33am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/1 "2007-01-23T00:33:19Z")

</div>

I remember vaguely from RejectConf someone hacked up something to  
position windows on OS X using Ruby OSA.

Did this ever get released? Or at least, is that code available  
somewhere?

If anyone remembers this and has some info, I’d be much obliged.

I’ve been doing a lot of hacking on OS X lately rather than GNU/Linux,  
and the window manager is nice but it ain’t no DWM.

Something like the hack from RejectConf might help that some 🙂

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 2:00am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/2 "2007-01-23T02:00:30Z")

</div>

On Jan 22, 2007, at 3:32 PM, Gregory B. wrote:

> Something like the hack from RejectConf might help that some 🙂

Greg-

That was Sebastian D. who wrote that hack. I had a copy of it  
somewhere but I cannot find it right now. I do knwo sebastians blog  
though:

[http://www.notsostupid.com/](http://www.notsostupid.com/)

Maybe you can find him armed with that info 😉

Cheers-  
– Ezra Z.  
– Lead Rails Evangelist  
– removed\_email\_address@domain.invalid  
– Engine Y., Serious Rails Hosting  
– (866) 518-YARD (9273)

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 3:25am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/3 "2007-01-23T03:25:37Z")

</div>

On 1/22/07, Ezra Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> That was Sebastian D. who wrote that hack. I had a copy of it
> 
> ```
> 
> somewhere but I cannot find it right now. I do knwo sebastians blog  
> though:

Oh, i’ll just hunt him down at a NYC.rb meeting or something. Thanks!

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 3:23am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/4 "2007-01-23T03:23:37Z")

</div>

On 1/22/07, Ezra Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> >

Oh, i’ll just hunt him down at a NYC.rb meeting or something. Thanks!

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/5 "2007-01-23T19:51:48Z")

</div>

On 1/23/07, has [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Gregory B. wrote:
> 
> > I remember vaguely from RejectConf someone hacked up something to  
> > position windows on OS X using Ruby OSA.
> > 
> > Did this ever get released? Or at least, is that code available somewhere?
> 
> Dunno about RubyOSA, but here’s the ‘Stagger Finder Windows’ example  
> from rb-appscript which might give you some ideas:

Thanks for the snippet and the advice. Not sure when I’ll get a  
chance to play with all of this, but this post will sure help.

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 11:20am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/6 "2007-01-23T11:20:45Z")

</div>

Gregory B. wrote:

> I remember vaguely from RejectConf someone hacked up something to  
> position windows on OS X using Ruby OSA.
> 
> Did this ever get released? Or at least, is that code available somewhere?

Dunno about RubyOSA, but here’s the ‘Stagger Finder Windows’ example  
from rb-appscript which might give you some ideas:

#######

#!/usr/bin/env ruby

# Rearranges Finder windows diagonally across screen with title bars

# one above another. (Could easily be adapted to work with any

# scriptable application that uses standard window class terminology.)

require “appscript”  
include Appscript

x, y = 0, 44  
offset = 22

# Get list of window references, ignoring any minimised windows

window\_list = app(‘Finder’).windows[its.collapsed.not].get

# Move windows while preserving their original sizes

window\_list.reverse.each do |window|  
x1, y1, x2, y2 = window.bounds.get  
window.bounds.set([x, y, x2 - x1 + x, y2 - y1 + y])  
x += offset  
y += offset  
end

#######

A couple of tips:

- If writing general-purpose a script to work with multiple apps, note  
that the terminology tends to vary a bit: Carbon scriptable apps often  
use ‘collapsed’ while Cocoa ones use ‘minimized’. You could probably  
just try ‘minimized’ first, then try ‘collapsed’ if an ‘unknown  
property’ error occurs. If both fail, the app is probably  
non-scriptable, in which case it’ll either have to be ignored, or  
controlled via System Events’ GUI Scripting facilities.

- If you’re writing a script to adjust multiple applications’ windows  
at once, some apps (e.g. Photoshop, InDesign, XCode) can have pretty  
huge terminologies, so there may a perceptible delay while appscript  
parses all of these these. Should you find the script lacks teh snappy  
because of this, you could avoid the overhead by using the lower-level  
AEM module, which uses raw Apple event codes, instead of the  
terminology-driven Appscript module.

HTH

has

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 23, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/7 "2007-01-23T23:10:40Z")

</div>

Has anyone successfully created an Exchange mailbox using Ruby? I am  
stuck at a dead-end trying to do so.

Thanks,

Charles

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [January 24, 2007, 12:22am UTC](https://www.ruby-forum.com/t/rejectconf-rubyosa-hack/83010/8 "2007-01-24T00:22:53Z")

</div>

On 1/23/07, Charles L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Has anyone successfully created an Exchange mailbox using Ruby? I am  
> stuck at a dead-end trying to do so.
> 
> Thanks,
> 
> Charles

It looks like you could use the CDOEXM in Microsoft Exchange System  
Manager  
Tools. I googled this: [http://support.microsoft.com/kb/327079](http://support.microsoft.com/kb/327079), which is  
in  
VB, but could easily be translated to use WIN32OLE in Ruby.

Another thing, slightly offtopic and not directly pertaining to this  
question, there seem to be many questions on this list about  
WIN32OLE/WIN32API that aren’t necessarily Ruby specific and would be  
essentially the same in Perl/Python/C#/VB/et, al. I don’t mind posts  
like  
this at all, but they might appear as noise to those who aren’t  
interested.  
Does anyone know of any programming language agnostic mailing lists for  
Windows OLE programming? Just a thought.

Nate
