[MacRuby-devel] send keystrokes with system.events?

2013-07-04 Thread bryan rasmussen
Hi,

I've been looking for examples as to how I might send keystrokes using
system.events from macruby, but not finding anything.

Anyone know of any, or can give me an example script so I can get a start.

Thanks,
Bryan Rasmussen
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macruby-devel


Re: [MacRuby-devel] send keystrokes with system.events?

2013-07-04 Thread stephen horne
Hi Bryan,

I've done this in the past using quick and dirty NSApplescript:

def
 applescript_exec(script_string)
    pnt = 
Pointer.new_with_type("@")
    as = 
NSAppleScript.alloc.initWithSource(script_string)
    as.executeAndReturnError(pnt)
  end
  
  script_string = %{
    tell application "System 
Events"
      keystroke "h" using shift 
down
    end tell
  }
  
  applescript_exec(script_string) #
 results in 'H'


You can send special keystrokes using this method also, see 
https://discussions.apple.com/thread/660394?start=0&tstart=0

I think that the 'proper' way would be the Quartz method, but I've never
 delved into that:

http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventCreateKeyboardEvent

fb

   	   
   	bryan rasmussen  
  04/07/2013 11:09
  Hi,I've been 
looking for examples as to how I might send keystrokes usingsystem.events
 from macruby, but not finding anything.Anyone know of any, or 
can give me an example script so I can get a start.Thanks,Bryan
 Rasmussen___MacRuby-devel
 mailing listMacRuby-devel@lists.macosforge.orghttps://lists.macosforge.org/mailman/listinfo/macruby-devel


___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macruby-devel


Re: [MacRuby-devel] segmentation fault 11 with net:http post inside of a function?

2013-07-04 Thread bryan rasmussen
> Perhaps copy has already been defined in top level and it do something 
> >important? Try rename your method to something else and try again.

Hi, that's the ticket.

thanks,
Bryan Rasmussen
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macruby-devel