Page 1 of 1

Looking for a way to show Splash Screen logo

Posted: 27 May 2012 13:58
by MKANET
Im looking for a third party utility that can display a logo image before starting the batch file. ABF Splash Screen does this perfectly however the registered version is impossible to get. Splash Screen Machine is also abandoned by the author. Im hoping for an open source app that does this. Anything thats not completely abandoned would work.

Is there a way to do this in VB script or Powershell? maybe theres a light wieght commanf line app that displays only an image in the center of the screen?

Re: Looking for a way to show Splash Screen logo

Posted: 27 May 2012 16:45
by aGerman
What is it good for :?

You could do that using HTA (something like HTML without browser window). Place an image "test.jpg" in the same folder of that batch:

Code: Select all

@echo off &setlocal

:: these variables will be expanded in the HTA code
set /a sec = 5
set /a width = 200
set /a height = 170
set "fullname=%cd%\test.jpg"


set "splash=%temp%\tmp.hta"
:: all lines beginning with min. 6 spaces are redirected into the HTA file
>"%splash%" (type "%~f0"|findstr /bc:"      ")
mshta "%splash%"
del "%splash%"

echo Done.
pause
goto :eof
:: End Of Batch

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
          <title>SPLASH</title>

          <hta:application
           id="oHTA"
           applicationname="myApp"
           border="thin"
           borderstyle="normal"
           caption="no"
           contextmenu="yes"
           icon=""
           innerborder="no"
           maximizebutton="no"
           minimizebutton="no"
           navigable="no"
           scroll="no"
           scrollflat="no"
           selection="no"
           showintaskbar="no"
           singleinstance="yes"
           sysmenu="no"
           version="1.0"
           windowstate="normal"
          />

          <style type="text/css">
            body      {margin:0px 0px 0px 0px;}
          </style>

          <script type="text/jscript">
            /* <![CDATA[ */
           
            var oWSH=new ActiveXObject("WScript.Shell");
            var i=parseInt(oWSH.ExpandEnvironmentStrings("%sec%"))*1000;
            var w=parseInt(oWSH.ExpandEnvironmentStrings("%width%"));
            var h=parseInt(oWSH.ExpandEnvironmentStrings("%height%"));
            var s=oWSH.ExpandEnvironmentStrings("%fullname%");
            window.resizeTo(w, h);
            window.moveTo(screen.width/2-w/2, screen.height/2-h/2);


            function start() {
              image.src = s;
              image.height = h;
              image.width = w;
              setTimeout('closing()', i);
            }

            function closing() {
              window.close();
            }
            /* ]]> */
          </script>

        </head>
        <body onload="start()">
          <img id="image" src="" alt="" height="0" width="0" />
        </body>
      </html>


Regards
aGerman

Re: Looking for a way to show Splash Screen logo

Posted: 27 May 2012 18:22
by Fawers
The only thing I can do with VBS within a batch is show some text, prompt for input and return some output. Never heard of displaying an image with it, although I think it's not impossible.

Anyway, aGerman's solution should work for you. I don't know HTA, but it just seems legit.

Re: Looking for a way to show Splash Screen logo

Posted: 27 May 2012 22:14
by MKANET
Wow agerman, it works very well. Unfortunately, I ran into a problem which you may not be able to help me.

I convert/package almost all my scripts to EXE's (using bat to exe converters such as QuickBFC). This is to package them into single files for easy portability.

For some odd reason your script doesnt like it when I run it from within an EXE. When I do, I see the below errors in the command window. I'm not sure what goes on in the background, but it behaves the same way no matter what bat2EXE converter I use. These converters like to execute the actual .bat files from the %temp% folder as a random file name such as 356543.cmd. Maybe the new location and filename confuses the batch file?

Anyhow, I don't expect you to be familiar with bat2exe converters. If you do figure it out, would love to know how to get around this. Otherwise, I'll use my successfully-working alternate method...

using an autoit script (which has builtin support for displaying images and packaging to exes.

Your method is surprisingly FAST!


These are the errors I get:
FINDSTR: Line 275 is too long.
FINDSTR: Line 344 is too long.
FINDSTR: Line 344 is too long.
FINDSTR: Line 344 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 586 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.
FINDSTR: Line 1629 is too long.

Re: Looking for a way to show Splash Screen logo

Posted: 28 May 2012 04:18
by aGerman
MKANET wrote:Anyhow, I don't expect you to be familiar with bat2exe converters.

I hate these bat2exe thingies since you always run from one problem to the next. I stopped using such tools a long time ago. Batch is a scripting language and if you need an executable then you should learn a programming language that can be compiled.
You should compress your files into a zip archive or create a self extracting archive.

As to your problem:
I don't find too long lines in my code and I cant see 1629 lines. Open your temporary cmd file to see why you get a peck of trouble. No idea what the bat2exe has done to the code :?

Regards
aGerman

Re: Looking for a way to show Splash Screen logo

Posted: 28 May 2012 04:28
by foxidrive
aGerman wrote:Batch is a scripting language and if you need an executable then you should learn a programming language that can be compiled.


I agree.

Re: Looking for a way to show Splash Screen logo

Posted: 28 May 2012 12:12
by MKANET
I am finding out lately that I using autoit a lot more to supplement what DOS/Batch-->EXE cant handle; such as in this case. For larger programs that need a UI, I would definitely use something like C#