Bill Guindon schrieb:
> Anybody have any samples of ruby/au3 scripts that are a bit more in
> depth than the wiki example?

Hi Bill,

I doubt that it is of any use to you, but here's a script I use when 
developing stored procedures for an Oracle database. There are no 
comments, so feel free to ask if you need more information.

   def main
     start_automation
     if toad_running?
       activate_toad
       switch_away_from_output if output_showing?
       execute_code
       if package_state_changed?
         remove_error_window
         switch_to_output
         restart_output
         switch_away_from_output
         execute_code
       end
       switch_to_output unless error_window?
     end
   end

   TOAD = "FREE TOAD"
   OUT = "DBMS Output"
   ERR = "TOAD Error"

   def start_automation
     require "win32ole"
     @ai = WIN32OLE.new( "AutoItX3.Control" )
   end

   def toad_running?
     @ai.WinExists( TOAD ) > 0
   end

   def activate_toad
     @ai.WinActivate( TOAD )
     @ai.WinWaitActive( TOAD )
   end

   def output_showing?
     window_title =~ /#{OUT}/
   end

   def switch_away_from_output
     switch_with( "^{TAB}" )
   end

   def switch_to_output
     switch_with( "^+{TAB}" )
   end

   def restart_output
     switch_with( "^{F4}" )
     switch_with( "!DD" )
   end

   def execute_code
     @ai.Send( "^{ENTER}" )
     sleep 0.2 while @ai.MouseGetCursor == 0
   end

   def package_state_changed?
     sleep 0.2
     error_window? && window_text =~ /ORA-04068/
   end

   def error_window?
     window_title =~ /#{ERR}/
   end

   def remove_error_window
     switch_with( "{ESC}" )
   end

   def switch_with( cmd )
     title = window_title
     @ai.Send( cmd )
     sleep 0.2 while title == window_title
   end

   def window_title
     @ai.WinGetTitle( "" )
   end

   def window_text
     @ai.WinGetText( "" )
   end

   main


Regards,
Pit