Jump to content
Sign in to follow this  
babelpatcher

Copy data from Edit Control (Stdout)

Recommended Posts

babelpatcher

This is part of my code.

$Log is an Edit control

$fd_bin = @WorkingDir & "binary" ; path to openvpn.exe
$config = @WorkingDir & "configconf.ovpn" ; path to config file

Local $Pid = Run(@ComSpec & " /c " & $fd_bin & 'openvpn.exe' & $config, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

While $Pid ;
     $msg = GUIGetMsg()
     Select
         Case $msg = $GUI_EVENT_CLOSE
             ProcessClose ($Pid)
             Exitloop
EndSelect
$line = StdoutRead($Pid)
     If @error Then
         ExitLoop
     Else
GUICtrlSetData($Log, $line, True)
     EndIf
WEnd

the code write the openvpn log to Edit control very well.

but, i can not select/copy the data/text from the Edit control.

when i select or try to copy the data/text, the text is gone.

Any idea how to solve this?

thanks :)

Edited by babelpatcher

Share this post


Link to post
Share on other sites
babelpatcher

this is another example, same problem.

; Demonstrates the use of StdinWrite()
#include 

Local $foo = Run("sort.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
; Write string to be sorted to child sort.exe's STDIN
StdinWrite($foo, "rat" & @CRLF & "cat" & @CRLF & "bat" & @CRLF)
; Calling with no 2nd arg closes stream
StdinWrite($foo)

; Read from child's STDOUT and show
Local $data
While True
$data &= StdoutRead($foo)
If @error Then ExitLoop
Sleep(25)
WEnd
MsgBox(0, "Debug", $data)

Share this post


Link to post
Share on other sites
PhoenixXL

u need to post the full code

Since the problem is with the EditControl

BTW I dont find any problem with the second example

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
babelpatcher

1st and 2nd is same

do you get what i mean?

i can not copy text from the Edit Control

Share this post


Link to post
Share on other sites
SmOke_N

I'm trying to figure out if your examples were just cut and paste of what you think should be there, or if it was just coded bad from the get go.

And hiding in your own topic anonymously is .... :(

Anyway, if you're not going to provide actual code that you took time to try to make work, let alone the app to test ( for real ), or the output that works, then take notes on how this is different from what you provided.

;sneaky suspicion you mean script directory
Global $fd_bin = @ScriptDir & "binaryopenvpn.exe"
Global $config = @ScriptDir & "configconf.ovpn"

Global $Pid = Run('"' & $fd_bin & '" "' & $config & '"', "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
Global $sOutData = "", $sOutTemp = ""
While 1
    $sOutTemp = StdoutRead($Pid)
    If @error Then ExitLoop
    $sOutData &= $sOutTemp
WEnd
MsgBox(64 + 262144, "Info", "Data Out:" & @CRLF & $sOutData)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
babelpatcher

thanks SmOke_N, solved :ILA: :ILA: :ILA:

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  

×