Interrupting a script during execution for user help file

D

daveyand

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.
 
U

usenet

daveyand said:
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__
 
T

Tad McClellan

daveyand said:
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?
 
D

daveyand

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.
 
E

Eric Bohlman

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.
 
D

Dr.Ruud

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top