From: Kajan Sittampalam Date: 2008-12-25T21:30:59+09:00 Subject: Re: Send keystrokes to Firefox or Safari? Hi, how can i send keystokes to a flash object (i.e. Textbox) in Internet explorer? at the moment all i can do is send words to normal HTML pages. Thanks in advance. Kajan. hengist podd wrote: > On 18 Feb, 00:41, Stedwick wrote: >> Well, how about this: is there something like AutoIt for the Mac (if I >> can control it with Ruby, so much the better)? >> >> I tried rb-appscript already, but I couldn't figure out how to send >> keystrokes =P > > See: http://www.apple.com/applescript/uiscripting/index.html > > The sample scripts given there are written for AppleScript, obviously, > but could be translated to Ruby with a little work. (Hint: > ASDictionary and ASTranslate are your friends.) > > Example: > > #!/usr/bin/ruby > > begin; require 'rubygems'; rescue ImportError; end > require 'appscript' > include Appscript > > app('Safari').activate > app('System Events').keystroke('Your text here') > > > GUI scripting is crude and fragile, but can be useful when dealing > with applications that don't provide a proper scripting API for the > features you need. > > You can also script Safari directly, including executing your own > JavaScripts via its 'do JavaScript' command. (This is what SafariWatir > [http://safariwatir.rubyforge.org/] does.) Dunno about Firefox as I > don't use it myself, but maybe someone else will know. > > HTH > > has -- Posted via http://www.ruby-forum.com/.