Jump to content
Sign in to follow this  

Splash Screen with text from ConsoleRead

Recommended Posts



I'm trying to get a "splash screen" while loading a programm via a batch file. This "Splash screen" consists of a background image and and should contain the text, the .bat file echos. But my Splash closes after every message from consoleread and re-opens for the next one.

Here's what my Start.bat looks like:

/Xodu/xodu.exe start first | SplashScreen.exe
/Xodu/xodu.exe start second | SplashScreen.exe

When running these commands in the console, the console echoes: "starting binaries..." and "starting xodu..."

my SplashScreen.exe (the compiled .au3) looks like this:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

Local $data
While True
    $data &= ConsoleRead ( )
    If @error Then ExitLoop
    Sleep (1000)
$GUI = GUICreate ("Teste", $tamanhox, $tamanhoy, $posicaox, $posicaoy,$WS_POPUP, BitOR ($WS_EX_TRANSPARENT, $WS_EX_LAYERED, $WS_EX_TOPMOST))
$label = GUICtrlCreateLabel($data, 20, $posicaoy, 250, $tamanhoy/4)
WinSetTrans ($GUI, "", 100)
GUISetBkColor(0x4169e1, $GUI)

So when i click my start.bat i see the splash screen with "starting binaries..." after about 2 secs it disapears and then after another second it reapears with the text "starting xodu...". Now how could i make it stay all the time?

Share this post

Link to post
Share on other sites

Each command line is not complete until the process receiving the piped data closes. So the first SplashScreen.exe has to close (closing your GUI in the process) before the batch file moves on to the next line. The solution would be for SplashScreen.exe to pass the data on to another process that will be started if required, or use the existing instance if already available. The other process can be the same script with command line options:


If $CmdLine[0] Then
    ; There was a commandline parameter passed - create gui and wait
    $hGUI = GUICreate("Test Output Console", 400, 500)
    $idEdit = GUICtrlCreateEdit("Started monitor..." & @CRLF, 10, 10, 380, 480)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ; No commandline passed - check for gui and post data
    $hGUI = WinGetHandle("Test Output Console", "")
    If Not IsHWnd($hGUI) Then
        Run(@ScriptFullPath & " -x", @ScriptDir, @SW_MINIMIZE)
        WinWait("Test Output Console", "", 10) ; Wait max 10sec for GUI to appear
        $hGUI = WinGetHandle("Test Output Console", "")
        If Not IsHWnd($hGUI) Then
            MsgBox(16, "Error", "Failed to create output monitor GUI.")

    $sConsoleData = ""
    While 1
        $sConsoleData &= ConsoleRead()
        If @error Then ExitLoop
    $sEditData = ControlGetText("Test Output Console", "", "Edit1")
    ControlSetText("Test Output Console", "", "Edit1", $sEditData & $sConsoleData)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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