Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write into the STDIN an ASCII value?

Status
Not open for further replies.

JohnLongHorn97

Programmer
Joined
Oct 21, 2006
Messages
1
Location
IL
Hello everyone,

I would like to write a script that will read several ascii characters directly into the STDIN, so it will be like I pressed these values in my keyboard, in another window.

for exemple, I will insert the ascii value of "tab" into the STDIN, and the focus will be changed in another window (let's say control panel..).

I thought I could simply write into the STDIN, but I haven't made it.
Here what I tried to do:

open (STDIN);

# The function is doing the action of an ASCII value
print STDIN "chr(9)";
system("start control panel");
close(STDIN);

I will be happy to read a solution...

thanks!
 
You can't write to STDIN. It's an input stream, not an output stream. You probably need to write it to a pipe, which gets passed to your command as STDIN. But I don't think that will help you - the only reason you want the tab is to change focus, so you aren't interacting with perl at that point, but the window manager...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top