Jump to content

[SOLVED] SciTE output console as $variable


andygo
 Share

Recommended Posts

hello, please take a look:

Posted Image

i use a vlc-plugin within my script, to remote and watch tv from my dreambox.

the plugin causes some lines i can see in the SciTE console.

how can i get / store these outputs to a $variable when the script is compiled?

Edited by andygo
Link to comment
Share on other sites

Compile your script with

#AutoIt3Wrapper_Change2CUI=y

and the output should be seen in the cmd box. You can pipe the output to a file.

Is this what you are looking for?

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Oder ein zweites Skript, dass die Console ausliest. Siehe Beispiel ConsoleRead.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

sorry, i can't figure it out... even not with your hints. maybe you can modify the following little example to make it work?

#AutoIt3Wrapper_Change2CUI=y
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
global $text, $services, $ii, $array2[2], $count2, $chars, $info, $pm, $oVLC, $oPlaylist, $oAudio, $vp, $oVLC, $Event_Now_Extended_Description, $msg
$gui = GUICreate("E2C", 512, 363)
$oVLC = ObjCreate("VideoLAN.VLCPlugin.2")
if NOT IsObj($oVLC) then exit msgbox(16, "error", "embedding failed. vlc must be installed correctly.")
$oPlaylist = $oVLC.playlist
$oAudio = $oVLC.audio
GUICtrlCreateObj($oVLC, 0, 0, 512, 288)
GUISetState()
$oPlaylist.add("file:///"&@TempDir & "xy.jpg"); file dont have to exsist.
$oPlaylist.playitem(0)
while 1
sleep(20)
If $msg = $GUI_EVENT_CLOSE then ExitLoop
$msg = GUIGetMsg()
wend
Link to comment
Share on other sites

Might be another possibility:

;~ #AutoIt3Wrapper_Change2CUI=y
#include <constants.au3>
#OnAutoItStartRegister "OnAutoItStart"
Global $__Restart = False
If Not $CmdLine[0] Then _ScriptRestart()

Global $timer = TimerInit()
While Sleep(50)
    ConsoleWrite(Random(0, 20000, 1) & @LF)
    If TimerDiff($timer) > 2000 Then ExitLoop
WEnd

Exit

Func OnAutoItStart()
    Sleep(50)
    Local $pid = ConsoleRead(1)
    If @extended Then
        While ProcessExists($pid)
            Sleep(100)
        WEnd
    EndIf
EndFunc   ;==>OnAutoItStart

Func _ScriptRestart($fExit = 1)
    Local $pid
    If Not $__Restart Then
        If @Compiled Then
            $pid = Run(@ScriptFullPath & ' ' & $CmdLineRaw & "1", @ScriptDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
        Else
            $pid = Run(@AutoItExe & ' "' & @ScriptFullPath & ' " ' & $CmdLineRaw & "1", @ScriptDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
        EndIf
        If @error Then
            Return SetError(@error, 0, 0)
        EndIf
        StdinWrite($pid, @AutoItPID)
    EndIf
    $__Restart = 1
    Local $line
    If $fExit Then
        While ProcessExists($pid)
            $line &= StdoutRead($pid)
        Wend
        MsgBox(0, "STDOUT read:", $line)
        Exit
    EndIf
    Return 1
EndFunc   ;==>_ScriptRestart

It will write some random numbers to the console while it reads the console output.

Thanks to Yashied for the restart code!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Might be another possibility:

...

It will write some random numbers to the console while it reads the console output.

Thanks to Yashied for the restart code!

Br,

UEZ

a kind of loader, nice idea. i tried it with the exe of my compiled script:

#include <constants.au3>
Local $pid
$pid = Run(@ScriptDir&"myscript.exe" & ' ' & $CmdLineRaw & "1", @ScriptDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
Local $line
While ProcessExists($pid)
$line &= StdoutRead($pid)
Wend
MsgBox(0, "STDOUT read:", $line)
Exit

script.exe starts, i performe some actions and then finish the script.

all i get from the loader is an empty msgbox. so that means to me that the vlc-plugin-debuglines are invisible for stdoutread....

hopefully i am not to stupid for that :)

Link to comment
Share on other sites

Try it with #AutoIt3Wrapper_Change2CUI=y

Meanwhile I will start my vm where VLC is installed...

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Your example script in post#4 crashes -> !>23:42:15 AutoIT3.exe ended.rc:-1073741819.

Probably caused by $oVLC = ObjCreate("VideoLAN.VLCPlugin.2")

Probably best is to compile your script with #AutoIt3Wrapper_Change2CUI=y

and run your script in cmd:

yourscript.exe > vlc_output.txt

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Your example script in post#4 crashes -> !>23:42:15 AutoIT3.exe ended.rc:-1073741819.

Probably caused by $oVLC = ObjCreate("VideoLAN.VLCPlugin.2")

Probably best is to compile your script with #AutoIt3Wrapper_Change2CUI=y

and run your script in cmd:

yourscript.exe > vlc_output.txt

Br,

UEZ

did it exactly like this. but: still nothing.... i really thank you for spending your time

and would understand if you couldn't further give attention to this.

Posted Image

it''s no world-sunset, i just like to understand...

Edited by andygo
Link to comment
Share on other sites

did it exactly like this. but: still nothing.... i really thank you for spending your time

and would understand if you couldn't further give attention to this.

Posted Image

it''s no world-sunset, i just like to understand...

Try:

v 2> out.txt

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Is it possibly writing to stderr rather than stdout?

YES MAN!!!! Indeed it did!!!! Thanks a lot :) with the following script i get the data i want:

#include <constants.au3>
Local $pid
$pid = Run(@ScriptDir&"myscript.exe" & ' ' & $CmdLineRaw & "1", @ScriptDir, @SW_SHOW, $STDERR_CHILD)
Local $line
While ProcessExists($pid)
$line &= StderrRead($pid)
Wend
MsgBox(0, "Console:", $line)
Exit

when we have come this far: is it possible to clear the consoles output ?

Edited by andygo
Link to comment
Share on other sites

for those who are intrested, here is my complete solution:

i start my mainscript via loader (with some parameters), loader runs invisible parallel to the mainscript.

it checks just the last line of the StderrRead-Stream and stores it via iniwrite.

$pid = Run(@AppDataDir&"mainscript.exe "&@AutoItPID&" "&$ip&" "&GUICtrlRead($vdo), @AppDataDir, @SW_SHOW, $STDERR_CHILD)
    GUIDelete($pregui)
    While ProcessExists($pid)
        $ct = StderrRead($pid)
        $ct = StringTrimLeft($ct, StringInStr($ct, "[", 0, -1)-1)
        $ct = StringLeft($ct, StringInStr($ct, @LF)-1)&"+ "&StringInStr($ct, @CR)
        if StringInStr($ct, "[") > 0 and IniRead ( @AppDataDir & "vlc"&@AutoItPID&".ini", "receiver", "console", "" ) <> $ct then iniwrite(@AppDataDir & "vlc"&@AutoItPID&".ini", "receiver", "console",  $ct)
        endif
        sleep(125)
Wend
Exit

then in the mainscript, i evaluate the loader's data via iniread:

if $CmdLine[3] = 1 then _Timer_SetTimer($gui,100,"addup");VLC DEBUG
func addup($a, $b, $c, $d)
    $tmp = IniRead ( @AppDataDir & "vlc"&$CmdLine[1]&".ini", "receiver", "console", "" )
    if GUICtrlRead($cinfo) <> $tmp then
        GUICtrlSetData ($cinfo, $tmp)
        _GUICtrlEdit_AppendText($c16, @CRLF & $tmp)
    endif
endfunc

the rest is pure cosmetic. on my mainwindow i show just the latest iniread, in a separate window

i collect all data:

Posted Image

thanks again all involved of this thread :)

Link to comment
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
 Share

×
×
  • Create New...