Interrupting a script during execution for user help file

Discussion in 'Perl Misc' started by daveyand, Jan 4, 2006.

  1. daveyand

    daveyand Guest

    Hey Guys,

    I've tried to search this group for some help with my problem but i
    cant seem to find anything. It could be my search term, not exactly
    sure what i'm trying to do is called.

    Basically what i've done is create a script that creates a directory
    tree and also creates some files based on user input. The idea is that
    i will be creating a number of firefox extensions so want the structure
    to be the same. A template type thing, as it were. (I know this might
    exist already but i'd like to see how i can do it myself, still got
    alot of perl to learn).

    Anyway....

    I'd like to be able to get the script to listen to key presses and when
    a user presses H the script will load up a browser with an HTML file,
    or at least open up a text document. So the user can look through that
    whilst doing their work. I dont have delusions of granduer and i doubt
    many people will see my script but still ;)

    I know how i can do a simple, do you need help now type situation, and
    then do stuff there and then, but thats not really what i want, i want
    it always to listen.

    Is this infact possible, what other info might you need to understand
    what i am doing.

    Hope someone can help. Thanks guys.
     
    daveyand, Jan 4, 2006
    #1
    1. Advertising

  2. daveyand

    Guest

    daveyand wrote:
    > I'd like to be able to get the script to listen to key presses and when
    > a user presses H the script will load up a browser with an HTML file,


    How about something like this:

    #!/usr/bin/perl
    use strict; use warnings;
    use Term::GetKey;
    use Proc::Fork;

    while ( $_ = qtty() ) {
    if (/H/i) {
    print "Help is on the way!\n";
    child {
    exec ("/usr/bin/firefox http://google.com");
    }
    }
    }

    __END__

    --
    http://DavidFilmer.com
     
    , Jan 5, 2006
    #2
    1. Advertising

  3. daveyand <> wrote:

    > I'd like to be able to get the script to listen to key presses



    perldoc -q keyboard

    How can I read a single character from a file? From the keyboard?

    How do I do fancy stuff with the keyboard/screen/mouse?

    How do I check whether input is ready on the keyboard?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jan 5, 2006
    #3
  4. daveyand

    daveyand Guest

    cheers for the suggestions, will look into them. And jim, the first
    section was just the problem that i have. Not a problem in perl The
    task. was giving some background knowledge so people wouldnt say erm
    why are you doing this.

    So in essence you could have ingnored the first thing.

    also does anyone know of a good firefox extensions workgroup. Mainlyl
    focusing on creating one in FF 1.5+.

    Thanks for the help.
     
    daveyand, Jan 5, 2006
    #4
  5. daveyand

    Eric Bohlman Guest

    "daveyand" <> wrote in news:1136456453.057939.91070
    @g44g2000cwa.googlegroups.com:

    > also does anyone know of a good firefox extensions workgroup. Mainlyl
    > focusing on creating one in FF 1.5+.


    If you've got access to a well-stocked news server (e.g. individual.net),
    check out the various mozilla.public.* groups; they seem to be where most
    of the action is.
     
    Eric Bohlman, Jan 5, 2006
    #5
  6. daveyand

    Dr.Ruud Guest

    [OT] quoting (was: Re: Interrupting a script during execution for user help file)

    daveyand schreef:

    > So in essence you could have ingnored the first thing.


    For Daveyand and everybody else with "User-Agent: G2/#.#":

    "How can I automatically quote the previous message when I post a
    reply?"
    http://groups.google.co.uk/support/bin/answer.py?answer=14213

    See also:
    http://www.safalra.com/special/googlegroupsreply/

    What's good 'netiquette' when posting to Usenet?
    http://groups.google.co.uk/support/bin/answer.py?answer=12348
    http://directory.google.com/Top/Computers/Usenet/Etiquette/

    But Google needs you to vote for 'Default quoting of previous message in
    replies'
    http://groups-beta.google.com/support/bin/request.py?contact_type=features

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Jan 5, 2006
    #6
    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. Oliver
    Replies:
    2
    Views:
    2,896
    Oliver
    Feb 12, 2004
  2. kaburke

    Non-Interrupting Logins

    kaburke, Aug 16, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    383
    kaburke
    Aug 18, 2005
  3. Replies:
    4
    Views:
    943
    Roland
    Jan 27, 2005
  4. stephan
    Replies:
    1
    Views:
    313
    Andrew Dalke
    May 1, 2005
  5. Emmanuel Emmanuel

    Interrupting the evaluation of a ruby script

    Emmanuel Emmanuel, May 28, 2010, in forum: Ruby
    Replies:
    11
    Views:
    237
    Charles Oliver Nutter
    Jun 10, 2010
Loading...

Share This Page