0

I was looking for automating windows applications and was asked to explore with rautomation, which I just started using it.

Now, after going thru' documentation on github and Jarmo's few blogs, I am posting a very simple problem here and I am sure I am doing something very basic wrongly.

Here is my code -

>> require "rubygems"
=> true
>> require "rautomation"
=> true
>> @window = RAutomation::Window.new :title => "System Volume (C:)"
RuntimeError: unsupported platform for RAutomation: java
    from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/helper.rb:16:in `default_adapter'
    from C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/window.rb:65:in `initialize'
    from (irb):10:in `new'
    from (irb):10

So, question is - what am I doing wrong? Here, I am trying to get handle on windows explorer.

Done - Done. The problem is with Jruby usage. If I use (plain) ruby with rubymine then I don't get any problem. Stackoverflow won't allow me to close my question until I have 100 reputation.

Parva Thakkar
  • 637
  • 1
  • 8
  • 25
  • Done - Done. The problem is with Jruby usage. If I use (plain) ruby with rubymine then I don't get any problem. Stackoverflow won't allow me to close my question until I have 100 reputation. – Parva Thakkar Oct 26 '11 at 19:46
  • You do not need to close the question. Post your comment as an answer and accept it. – Željko Filipin Oct 27 '11 at 09:43
  • Yes, that's what I meant.. It won't allow me to answer my own question until I have 100 reputation... So, I added it as comment – Parva Thakkar Oct 27 '11 at 20:25

1 Answers1

2

This happens because RAutomation was determining compatibility from the RUBY_PLATFORM. Next version will use OS Environment variable instead: https://github.com/jarmo/RAutomation/commit/dd825b04aab6d90cfedf385a620095c17da92644

But, you could also use it with JRuby (it's untested though, but it should work) right now by specifying the adapter itself so that #default_adapter method won't be executed. You can do that in two ways:

1) Specify the adapter to the Window.new method:

RAutomation::Window.new(:title => //, :adapter => :win_ffi)

2) Specify the adapter in the environment variable:

set RAUTOMATION_ADAPTER=win_ffi
Jarmo Pertman
  • 1,905
  • 1
  • 12
  • 19