Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > how to get back focus on opening firefox via firewatir?

Reply
Thread Tools

how to get back focus on opening firefox via firewatir?

 
 
arun
Guest
Posts: n/a
 
      05-23-2008
Hi, I am writing software that will allow persons with severe motor
disabilities -- people who cannot use a full keyboard and mouse -- to
be able to use the Internet, an extension of what you see in
http://www.youtube.com/watch?v=l7eMoA3cr8E

Inputs from a joystick or a special keyboard are picked up by my
program, interpreted, and fed to firefox using firewatir. No problems
with the joystick program, but with the keyboard, there is a tiny one.

When I fire up Firefox, it takes focus, and eats up all my keystrokes.
How can I get my terminal window to come to the foreground without
manual intervention, so that my application gets keystrokes again?

On a related note, how do I, in ruby, reduce the size of the terminal
window the program is running in, so that it does not obscure the
firefox window underneath?

My program is as below...

Thanks,
Arun

#!/usr/bin/env ruby
require 'rubygems'
#Include the FireWatir file.
require 'firewatir'
#include the FireWatir Module.
include FireWatir
begin
th=Thread.new{system('script/server')}
sleep(3)
ff=Firefox.new
ff.goto("http://localhost:3000")
# here is a loop that takes kbd input and passes on to ff until Ctrl-
C is pressed
ensure
ff.close
th.terminate
end
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Firefox back button takes me back 2 pages. Useful Info Javascript 0 06-02-2007 11:21 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Why "Focus and Recompose" causes back-focus issues Carl Miller Digital Photography 7 03-10-2005 12:14 PM
Connecting two 1601's back-to-back via serial interfaces Cyber-Soldier Cisco 1 11-20-2003 07:49 PM



Advertisments