473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get the output from console to the GUI?

2 New Member
I have a GUI from which I pass argument to another script.
Now this script gives output at console...Iwant to bring the ouput in my GUI,,,

please let me know the way..THANX IN ADVANCE
Feb 9 '11 #1
4 2209
miller
1,089 Recognized Expert Top Contributor
Just use backticks to capture the output from your external script:
Expand|Select|Wrap|Line Numbers
  1. my $results = `perl yourscript.pl`;
  2.  
  3. print "chars is " . length($results) . "\n";
  4. print "lines is " . scalar(split "\n", $results) . "\n";
- Miller
Feb 9 '11 #2
sindabad
2 New Member
@MILLER thanx for the reply.

but i had other concern.
Suppose i have a script hello.pl

Expand|Select|Wrap|Line Numbers
  1. print "Hello World\n";
  2. print "hi \n";
  3.                                                          if($ARGV[0]=~m/(ABC|abc)/)
  4. {
  5. print"successful\n";
  6. }
  7. else
  8. {
  9. print"unsuccessful"
  10. }
and value of ARGV[0] i'm passing from my GUI.

i'm collecting the output as
Expand|Select|Wrap|Line Numbers
  1. my $result = `perl hello.pl`;
#and now i want to display the output in my text wideget.
for which the code is
Expand|Select|Wrap|Line Numbers
  1. $contents->insert('end',"$result\n");
output which i get on my GUI is

Hello World
hii
unsuccessful (even if i'm passing ABC or abc from my GUI)

i know i'm doing something wrong but not finding the correct way.
let me know the way if you know..THANX IN ADVANCE.
Feb 10 '11 #3
rovf
41 New Member
At least in the example which you posted, you don't pass any argument to hello.pl. BTW, you would have found out by yourself if you had used strict and warnings.
Feb 10 '11 #4
miller
1,089 Recognized Expert Top Contributor
All you need to do is pass an argument to your script like the following:
Expand|Select|Wrap|Line Numbers
  1. my $result = `perl hello.pl abc`;
Feb 10 '11 #5

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

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
3
by: Liren Zhao | last post by:
I use some "Console.WriteLine(some strings here)" to display some debug information in my winform program. How can I get the information in my programe or same them in a text file ?
4
by: Bob | last post by:
I just recently noticed that when I start my applicatoin in debug mode, the IDE hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the application shows that it's hung up...
0
by: Christophe HELFER | last post by:
Hi, I've post some question last week about redirecting input and output console. Then I've received some example code from H.K. Wagner to see how redirecting works. This example works fine...
2
by: Steve | last post by:
I have created a console app that simply prints out a message a couple times, then exits, here is the code: <code> for(int i = 0; i < 10; i++) { System.Threading.Thread.Sleep(500);...
1
by: lavu | last post by:
I currently have a C# windows Application . I would like this App to work through an command line interface also. I would like to specify command line params, which should start the app and process...
1
by: skeete1990 | last post by:
heres my code there 1 problem with it (its bolded) its not going through its a math type things if any one can help me please help all i ask is that you no change the code too much if possible, heres...
3
by: pratap | last post by:
I have an application which periodically gives me an output of sonar values .However i am unable to view the values as they get replaced by the new ones below in realtime and are displayed after...
1
by: mpereke | last post by:
Hi How can I send messages to console from GUI apps develped from c++ builder 6. By default runnning the app from the C++ Builder 6 does not start a console as well. So I run the .exe from...
1
by: mquincey | last post by:
One of the features offered by .NET 2.0 is the use of the TraceSource class. In an attempt to demonstrate its use, I wanted to run my test under the following conditions: 1. Use TraceSource class...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.