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
4 2399
Hi!
download the term TermReadKey( when u a non blocked read will?)
Example: -
ReadMode 4, IN;
-
$k = "";
-
#$in = *STDIN;
-
$in = \*IN; # or *IN or "IN"
-
while($k ne "q")
-
{
-
print "Press a key, or \"q\" to stop: ";
-
$count=0;
-
#print "IN = $in\n";
-
$count++ while !defined($k=ReadKey(-1, $in));
-
#print "IN2 = $in\n";
-
print "\nYou pressed `",makenice($k),"' after the loop rolled over $count times\n";
-
}
-
ReadMode 0, IN;
-
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
Thanks Jeff!
Sorry but I beginner and I don't now what are "code tag" and how can I use them.
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 microcontroller
should display in the LCD the value of the voltage applied to the input
of the ADC.
The above procedure should only execute once the user has entered
"1234" using a keypad that is attached to the 8051 microprocessor.
|
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 other special characters.
I want my program to detect what key the user pressed from the keyboard
and get the associated data from the hash table (associated with the
key he pressed which is the same as the hash key). The user can also
decide to...
|
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 textbox or something of that sort but could you
please guide me in this process?
Thanks,...
|
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 button, if they say No then the delete will be reversed (if possible)
Thanx in advanc
Austin
|
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 and it will say: "The last
keystroke in the textbox was 10 minutes ago."
This is not what I want to do. What I would like to see is a message that
says: "The last keystroke in any running application on this computer was 23
minutes ago."
My...
| |
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 didn't get any fruitful
results. Please help me.
|
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
|
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 interrupting execution just like getch() does. I am thinking of making a game so i need the game not to wait for the player to press a key, the game should go on. By using kbhit() i know whether a key was pressed, but i dunno which key. That is the...
|
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 can capture a pressed key?
If it possible, How to capture the screen (Screen picture)?
Thanks for anyhelp.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |