how to get back focus on opening firefox via firewatir?

Discussion in 'Ruby' started by arun, May 23, 2008.

  1. arun

    arun Guest

    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
    arun, May 23, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Szinek

    FireWatir

    Peter Szinek, Dec 8, 2006, in forum: Ruby
    Replies:
    0
    Views:
    95
    Peter Szinek
    Dec 8, 2006
  2. Angrez

    FireWatir 1.0.1 released

    Angrez, Jan 24, 2007, in forum: Ruby
    Replies:
    12
    Views:
    198
    Angrez
    Jan 31, 2007
  3. Mario Ruiz
    Replies:
    0
    Views:
    90
    Mario Ruiz
    May 26, 2008
  4. Manoj Chourasia

    each method in FireWatir::Firefox

    Manoj Chourasia, Jan 7, 2010, in forum: Ruby
    Replies:
    0
    Views:
    79
    Manoj Chourasia
    Jan 7, 2010
  5. Roger
    Replies:
    3
    Views:
    322
Loading...

Share This Page