Sign in to follow this  
Followers 0
anhyeuem

Capture/Get from Console

14 posts in this topic

#1 ·  Posted (edited)

Hello my teachers and friends,
Wen I run a program:

Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText)

I receive a console as result.
But i don't like console, i use:

Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE)

Okay, very good. But i need a msgbox is contained from console or can you show me: how to create a log.txt - this file has content of console.
Thank you so much. 
P,s
Dear Mr. Melba23

How are you?
Can you help me?

Edited by anhyeuem

Share this post


Link to post
Share on other sites



Hi,

Take a look at StdoutRead in the helpfile.

Br, FireFox.

1 person likes this

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

Take a look at StdoutRead in the helpfile.

Br, FireFox.

oh, thank you so much, my friends

StdoutRead vs StdErrRead : i have just read it and i don't understand 100%

I am also newbie at autoit

Can you show me more and more

thanks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It's not related to autoit, you can find on internet the difference between them.

The standard output corresponds to ConsoleWrite and standard error corresponds to ConsoleWriteError in autoit.

The developer chooses to wether write in one of them, depending on wether it's an information or an error.

Br, FireFox.

Edited by FireFox
1 person likes this

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

It's not related to autoit, you can find on internet the difference between them.

The standard output corresponds to ConsoleWrite and standard error corresponds to ConsoleWriteError in autoit.

The developer chooses to wether write in one of them, depending on wether it's an information or an error.

Br, FireFox.

Thank you for reply.

Okay, i am going search from google and read them.

With me: a pupil 12 age, it is very difficult. 

this is a exam, a my homework from teacher.

I need example then try and i will understand.

Share this post


Link to post
Share on other sites

Hi anhyeuem

also, try this

(note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....)

#include <Constants.au3>

Local $dos_output = "" ; declare a variable to get output

; execute your program hidden and with output redirected
Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD)

; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example

While Not @error ; wait the end of your program
    $dos_output &= StdoutRead($cmd) ; get the output from your program while is running
WEnd

MsgBox(0, "", $dos_output) ; display the final output of your program
2 people like this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

 

Hi anhyeuem

also, try this

(note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....)

#include <Constants.au3>

Local $dos_output = "" ; declare a variable to get output

; execute your program hidden and with output redirected
Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD)

; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example

While Not @error ; wait the end of your program
    $dos_output &= StdoutRead($cmd) ; get the output from your program while is running
WEnd

MsgBox(0, "", $dos_output) ; display the final output of your program

oh, this is perfect. Almost pupils from my shool are reading and using this code. They are talking and comment.

But my friend:

$a = (GUICtrlRead($hFileInput))

$hFileInput = GUICtrlCreateInput( "", 19, 33, 474, 19)...

$t ...$szText : they are like $a:  GUICtrlCreateInput

-> your code don't show content of console.

can you help me

Edited by anhyeuem

Share this post


Link to post
Share on other sites

 

Hi anhyeuem

also, try this

(note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....)

#include <Constants.au3>

Local $dos_output = "" ; declare a variable to get output

; execute your program hidden and with output redirected
Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD)

; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example

While Not @error ; wait the end of your program
    $dos_output &= StdoutRead($cmd) ; get the output from your program while is running
WEnd

MsgBox(0, "", $dos_output) ; display the final output of your program

If i use:

 

Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example

it is very good, by my case, it can't not show

very poor my friend

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

what is the program that you want to run?
(what is the content of the $a variable?)

edit:

....I had not seen the post # 7 sorry

Edited by PincoPanco
1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

what is the program that you want to run?

(what is the content of the $a variable?)

I run signtool.exe with parameter

do you have teamviewer software?

myid: 433 082 431

pass: h353gx

-> you can see my computer and you will understand them

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

what is the program that you want to run?

(what is the content of the $a variable?)

#include <Constants.au3> 
Local $dos_output = "" ; declare a variable to get output
$a = "C:\test\signtool.exe"
$t = "http:/google.com"
$f = "C:\test\mycert.pfx"
$p = "password"
$szText =  = "C:\test\test.exe"
Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) 

While Not @error ; wait the end of your program     $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program 

-> very good my friend

it can show very good

But my case: i create GUICtrlCreateInput

...
$hFileInput = GUICtrlCreateInput( "", 19, 33, 474, 19)
...
$a = GUICtrlRead($hFileInput)
$t = GUICtrlRead($hTime)

...

-> not show :((
Edited by anhyeuem

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I do not know the signtool.exe program, and I do not know if it allows I/O redirection,

anyway you could try to change $STDOUT_CHILD with $STDERR_MERGED instead

in this way you could see also error messages coming from that dos program.

(always if it allows i/o redirection....)

Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDERR_MERGED)

p.s.

I do not recommend putting passwords online .... 

EDIT

corrected $STDERR_MERGED

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

I do not know the signtool.exe program, and I do not know if it allows I/O redirection,

anyway you could try to change $STDOUT_CHILD with $STDERR_MERGED instead

in this way you could see also error messages coming from that dos program.

(always if it allows i/o redirection....)

Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDERR_MERGED)

p.s.

I do not recommend putting passwords online .... 

EDIT

corrected $STDERR_MERGED

Dear my friend

all pupil from my school want to say: "thank you so much"

 

#include <Constants.au3> 
Local $dos_output = "" ; declare a variable to get output
$a = "C:\test\signtool.exe"
$t = "http:/google.com"
$f = "C:\test\mycert.pfx"
$p = "password"
$szText =  = "C:\test\test.exe"
Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) 

While Not @error ; wait the end of your program     $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program

Code above is okay, we use it for our homework.

But can you tell me why?

Run: okay but Runwait: don't show msgbox ????

 

Share this post


Link to post
Share on other sites

Dear my friend

all pupil from my school want to say: "thank you so much"

 

 

You are welcome :)

Code above is okay, we use it for our homework.

But can you tell me why?

Run: okay but Runwait: don't show msgbox ????

 

 

I think because RunWait stops the execution of your main script untill the exe program has finished

so in this way you can not grab his output,

but also because, according to the help file, RunWait does not allows Output redirection and so you can't pipe the output of the executed program to your scrpt. (this is obvious, because if the main program stops untill the launched exe has finished, then there is no way to control it in the while....)

bye :bye:

1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0