We help IT Professionals succeed at work.

Need to show splash screen before app runs...

I have an application that is badly designed and after double-clicking on it in Windows, it takes up to 20 seconds to show any signs of life.  This causes the users of this application to get frustrated and they double-click on it a second, third fourth and ...x times...   At one point I visited a user that had up to 20 instances of this application running. I would assume that they kept double-clicking on the icon until they saw the main window...

In any case, i would like to have some sort of application launcher that would put up a window saying "Please wait" and have a progres bar (animated gif?) and then would launch the dumb application...   Any ideas how this can be done either in a DOS batch or using an available application?   I would do it in C++ but I haven't touched C++ since last century...
Comment
Watch Question

Steve KnightIT Consultancy
SILVER EXPERT

Commented:
Here is a progress indicator I have got for batch file:

http://scripts.dragon-it.co.uk/links/batch-progress-indicator

A bit crude bit it does the job.

Customise the top line "START" tp run your program and it will start in the background while the progress indicator ticks away.

The number 20 in the middle is the number of seconds it waits.  If you amend then it will show more on the progress entry.

Can amend the characters it shows where it has #- to anything you prefer.




@echo off
START "" "c:\program files\your real app.exe"
mode con: cols=60 lines=10
color 4f
title Please Wait. App is loading
echo.

echo PLEASE WAIT.  App is loading
echo.
 
echo 0                                   100

SET /P var=<NUL

set count=0
:loop
PING -n 2 127.0.0.1 >NUL 2>&1
call :printline #-
set /a count=count+1
if %count%==20 goto finish
goto loop

:printline
REM Print text passed to sub without a carriage return.
REM Sets line variable in case %1 intereferes with redirect
set line=%1
set /p var=%line%<NUL
exit /b

:finish
cls
color 4f
title Finished
echo.
echo.
echo Thankyou, your app should be started now
echo.
echo.
pause
exit /b

Open in new window

progress.cmd
Bill PrewTest your restores, not your backups...
SILVER EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
Interesting Steve, but my concern with this type of approach is that the "please wait" display could persist even after the application is loaded and ready to go.  I thought about maybe we check the process in the loop and exit when it starts, but it will likely be in the process list way before it is ready for user input.  

Perhaps we could look for the actual window that initially gets displayed by the application and loop until it's ready? This would be best handled in VBS I believe, and I will take a shot at that if no one gets to it before me.

~bp
Steve KnightIT Consultancy
SILVER EXPERT

Commented:
Good point Bill, or an autoit script too.

Is there a file it creates once loaded fully, or as Bill says a windows with a certain title etc?
Okay, this is easypeasy....

There are two simple things you can do to prevent what you describe in your question.

   (a) Display a splash screen (dead easy)

   (b) Check if the application is already running and refuse to start another instance of it

Suppose your aplication is Notepad.exe... this is how you might do it.

Here's an over-simplified example:
@echo off

rem Display splash screen
cls
for /l %%a in (1,1,10) do echo.
echo                            Notepad has started
echo.
echo                 Please wait for the main screen to appear

rem Run application if not already running
tasklist | find /i "notepad.exe" >nul || start /wait notepad.exe

exit

Open in new window

Try this batch file to see it's effect...

Commented:
Since AutoIT was mentioned and that script would be short and sweet, I thought I'd go ahead and post it. If you're not familiar with AutoIT, you can download the script compiler here: http://www.autoitscript.com/site/autoit/downloads/

It will display a window like the image below until the first window of the Bad Program appears. Screen ShotUse the code below, and change the 3 variables at top accordingly.
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Change the value of this variable to the title of the first window that appears
$sTitle="Badly Designed Program Window Title"
; Change this variable to the full path and filename of the program's executable
$sExec="C:\Path\SlowProgram.exe"
; Change this to the Name of the program
$sName="Badly Designed Program Name"
Run($sExec)
$hWait=GUICreate("Starting " & $sName & "...",450,300,-1,-1,BitOR($WS_BORDER,$WS_POPUP),$WS_EX_TOPMOST)
GUICtrlCreateLabel("Please wait while " & $sName & " starts up.",85,140)
GUISetState(@SW_SHOW)

WinWait($sTitle)

GUIDelete($hWait)

Open in new window

If you have the source code for the program then you could put

splashsceen.show    

as one of the first commands in the program and it will take care of things until the rest of the processing is done.


Commented:
AutoHotKey would be another way to solve it. Similar to AutoItScript.

It allows you to run something using command keys (and it has very many, very useful other implementation possibilities).

So your users would only have to enter a hot key like command b and it could show a splash screen which waits till your program has started.

I use it mainly to automate dayly tasks, like opening up a series of applications that I use every day and for adding in text that I use often in emails etc.
Steve KnightIT Consultancy
SILVER EXPERT

Commented:
Any feedback bganoush ?
BRONZE EXPERT

Commented:
Hi bganoush
I realise that this might already have been checked out by you, but it's worth mentioning just in case.  Have you checked to see whether the program stores its settings in the registry or a "config" file in the same program folder?

If it is in the registry, eg.
HKEY_CURRENT_USER\Software\Badly Designed Program Name
HKEY_LOCAL_MACHINE\Software\Badly Designed Program Name
then look through all the values in that key and in each of the sub-keys to see if there is one named "ShowSplash" (or something similar).  Depending on what type of value it is (String, Multi-String, DWord, or Binary) the values to enable/disable could be yes/no or a 1/0.
Even if that value doesn't exist, you can sometimes create a new value named "ShowSplash" in the software's registry key and experiment with the value type and its on/off value to see if the program responds to it.

If the program stores settings in a config file in the program folder (eg. ProgName.ini, ProgName.cfg, ProgName.xml, etc), then open it in Notepad and look to see if there is already a "Show Splash Screen" value in it.  If so, try changing it and saving the file.

It's worth looking to see if this is possible because if so it could then be applied to all users quite easily.  If the program doesn't actually have a splash screen to enable or disable, then you will have to use some kind of "starter" program as the others have suggested.

Sometimes a program launches a hidden window as it starts up, or one that it places off-screen.  To know if this is the case involves using a utility that shows where hidden windows are placed.  The reason I mention this is that I have previously tinkered with program executables using a resource viewer that allows modifyig and resaving executables, and have changed the placement and content of the windows, making them visible and useful as splash screens. I can provide links if you want to go down this path, but DenzilSmith probably knows more about programming than I do and might suggest a better method.
BillDL

That's a HUGE write-up. Why not just ask bganoush what the program is? Then we'd be in a better position to advise him on the issues you raised.

bganoush, what IS the program you need a splash screen for?
BRONZE EXPERT

Commented:
Paul, I typed up 5 paragraphs that will allow bganoush to check for himself whether my suggestion is one that might be one to pursue.  It's hardly a "huge write up" and serves my purpose in providing enough information for bganoush to work on himself and come back with some feedback.  You didn't type the comment, so what difference does it make to you if it was a "huge write up" or just two lines?  If you just wanted to know what the program is, then all you needed to do was just ask yourself, which required one single line without being sarcastic about my comment.  I've not been in a very good mood lately, and certainly am not in the mood to be toyed with like some kind of imbecile, OK?
BillDL

There was no sarcasm intended and I do not consider you an imbecile. I'm sorry if that's the impression I gave.

We all have our bad moments so I know how sensitive we can get over even the smallest criticism at times - unfortunately, there's no batch file for that!

Author

Commented:
Hi everyone, been away on medical leave... thanks for your input.. I really like the solution by PaulTomasi about the tasklist check.

This program is not written by me and do not have the source, otherwise there wouldn't be a need for this question. I'd rather not say what the program is to not "insult" the writers, it is a financial application written in a hybrid fat app and web based forms. It's very unwieldy but I'm stuck with it.  I'll try the tasklist idea and get back to you.
Steve KnightIT Consultancy
SILVER EXPERT

Commented:
We'll be needing to widen Paul's front door again... of course silly me for providing what was actually asked for within 17 minutes of being asked, though I do agree it is best to do a check like Paul did :-)