Sign in to follow this  
Followers 0
andygo

[SOLVED] SciTE output console as $variable

17 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

no solution for that?

Share this post


Link to post
Share on other sites

Have you tried what UEZ suggested?

Did it not work as a CUI?


If you try to fail and succeed which have you done?AutoIt Forum Search

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
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 :)

Share this post


Link to post
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Is it possibly writing to stderr rather than stdout?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

ah, yes, 2> is the error output...

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Try:

v 2> out.txt

Br,

UEZ

thank you too, this also contains the data i need :)

Share this post


Link to post
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 :)

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

  • Similar Content

    • Clark
      By Clark
      $Form1 = GUICreate("Entity Tracker", 606, 425, 500, 241,-1, $WS_EX_ACCEPTFILES)
      $Tab1 = GUICtrlCreateTab(0, 0, 625, 441)
      $TabSheet1 = GUICtrlCreateTabItem("Tracker")

      I was hoping to to be able to disable (i.e. prevent a user from activating the tabsheet) by:
      GUICtrlSetState($TabSheet1, $GUI_DISABLE)

      But this doesn't work. (Or at least I can't get it to work).

      I've checked the help files and searched but can't seem to see an obvious and easy solution to this, but I'm sure one must exist.

      Hoping someone might know how to do this.
    • marko001
      By marko001
      Hi mates,

      The tool I developed uses different folders where files are located:

      @scriptdir contains all the .exe, some .dll and some .ini
      /logs contains log.txt
      /images contains all images needed to _imagesearch()
      /manual contains manual.chm and manual.chw
      /DB contains db.xml

      As previously discussed with Zedna, I can't use Resources UDF since _imagesearch() doesn't support embedded images but needs them stored on HDD.
      As previously discussed with Trancexx, I can embedd binaries (runbinary) but It's too risky so I decided to avoid it.

      So question is: How can I embeed all these files and folders into an executable so that when it's run it re-builds the original folders/file structure?

      What I expect to have is:

      Before compiling : all the .au3 and the folders with the files
      After compiling : just one compiled.exe and all folders with their files.

      Thanks for the support,

      Marco