473,513 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

monitoring a pressed key from keyboard

63 New Member
Hi, I have a script that is allways running, monitoring a folder to see if there is any new file.
i'd like to add to this script something else like "if you want to run this thing, press "a" ".
This option will be allways there. If the user press the key it runs some code.
It have to watch the folder but watch the key either.


How can I do this?

Thnaks,

Joćo Correia
Sep 15 '08 #1
4 2392
Arepi
62 New Member
Hi!

download the term TermReadKey( when u a non blocked read will?)

Example:
Expand|Select|Wrap|Line Numbers
  1. ReadMode 4, IN;
  2. $k = "";
  3. #$in = *STDIN;
  4. $in = \*IN; # or *IN or "IN" 
  5. while($k ne "q")
  6. {
  7.  print "Press a key, or \"q\" to stop: ";
  8.  $count=0;
  9.  #print "IN = $in\n";
  10.  $count++ while !defined($k=ReadKey(-1, $in));
  11.  #print "IN2 = $in\n";
  12.  print "\nYou pressed `",makenice($k),"' after the loop rolled over $count times\n";
  13. }
  14. ReadMode 0, IN;
  15.  
Sep 15 '08 #2
numberwhun
3,509 Recognized Expert Moderator Specialist
Arepi,

Please learn to use the code tags. They are necessary in the forums when you are posting code.

Regards,

Jeff
Sep 15 '08 #3
Arepi
62 New Member
Thanks Jeff!

Sorry but I beginner and I don't now what are "code tag" and how can I use them.
Sep 15 '08 #4
numberwhun
3,509 Recognized Expert Moderator Specialist
Thanks Jeff!

Sorry but I beginner and I don't now what are "code tag" and how can I use them.
If you edit the post that you put the code in, you will see the code tags. Also, when you are replying or posting, there is a "Reply Guidelines" box to the right of the reply box that shows you as well.

Regards,

Jeff
Sep 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
6188
by: webzila | last post by:
Hello, I have to write a program for an 8051 micro-controller using micro-C to monitor Switch 1 and if the switch in pushed the message "switch 1 pushed" should be displayed in the LCD. Also the...
3
7917
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
2
2137
by: Diffident | last post by:
Hello All, How can I force the control to go to click event handler if a keyboard's enter key is pressed instead of the user clicking the button. I remember that we need to create a hidden...
2
1632
by: Austin T | last post by:
Hello I wish to set up a handler to detect when the <Delete> key is pressed on the keyboard. This is so that I can intercept it and if the focus is on my datagrid, I will display a confirmation...
2
3495
by: genojoe | last post by:
I have a Windows form application running that contains a button and textbox. An easy thing to do is to monitor the last time a keystroke was executed in the textbox. I can then click the button...
16
3320
by: sudhir | last post by:
hi how to check escape key is pressed when accepting the string as input. Because I do not want to receive a string if user presses the ESCAPE key.. I used ascii code for comparision but I...
4
2289
by: tidegenerator | last post by:
Hi; How can I know the Key c and Ctrl on the keyboard are pressed? Or how to let the program press the key Ctrl+c automatically? I just want to use python to develop a script program. gear
11
8978
by: bluesteel | last post by:
Hi guys, this is what i wrote: if(kbhit()){ a=; doaction(a); } doaction() is a function i wrote but it doesnt matter. What does matter is how to get a character from keyboard without...
1
3669
Atran
by: Atran | last post by:
Hello, When a key pressed on keyboard, I want my program capture the pressed key, and save the pressed keys in a notepad. You listen about monitor programs, that programs capture keys........ How I...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.