Displaying a Splash Screen

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Displaying a Splash Screen

Post by Rain » Thu Jun 05, 2008 11:24 am

Displaying a Splash Screen

Submitted by: Rain

Script Discussion here

Display a splash screen at the beginning of your script.

This example displays a splash screen using a Label in the dialog.

Code: Select all

Let>APP_TITLE=SplashScreen

Dialog>SplashScreen
   Caption=SplashScreen
   Width=270
   Height=50
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=Splash Screen,5,0,true
EndDialog>SplashScreen

SetDialogObjectFont>SplashScreen,msLabel1,Tahoma,28,1,255

//Borderless Dialog
LibFunc>user32,SetWindowLongA,sres,SplashScreen.handle,-16,1073741824

//Make Dialog Transparent
Let>ByteOpacity=0
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_ALPHA=2

//Get Style Attributes of Dialog Window
LibFunc>user32,GetWindowLongA,attribs,SplashScreen.handle,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}

LibFunc>user32,SetWindowLongA,swl,SplashScreen.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen


Let>ByteOpacity=0
let>KK=0
label>splash loop
wait>.02
add>KK,2
//Time to display Splash screen
if>KK>350,splash done
//Increase Dialog Opacity
add>ByteOpacity,2
if>ByteOpacity>254
Let>ByteOpacity=255
endif
//Change Dialog Opacity
LibFunc>user32,SetWindowLongA,swl,SplashScreen.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen.handle,0,ByteOpacity,LWA_ALPHA
goto>splash loop

label>splash done
cdg>SplashScreen

//Main Script Starts Here
mdl>Start of main script
This example uses an imported image.

Code: Select all

Let>APP_TITLE=SplashScreen

Dialog>SplashScreen
   Caption=SplashScreen
   Width=270
   Height=60
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Image=YOURLOGO_DATA,0,0,270,60,msImage1,0
EndDialog>SplashScreen

//Borderless Dialog
LibFunc>user32,SetWindowLongA,sres,SplashScreen.handle,-16,1073741824

//Make Dialog Transparent
Let>ByteOpacity=0
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_ALPHA=2

//Get Style Attributes of Dialog Window
LibFunc>user32,GetWindowLongA,attribs,SplashScreen.handle,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}

LibFunc>user32,SetWindowLongA,swl,SplashScreen.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen


Let>ByteOpacity=0
let>KK=0
label>splash loop
wait>.02
add>KK,2
//Time to display Splash screen
if>KK>350,splash done
//Increase Dialog Opacity
add>ByteOpacity,2
if>ByteOpacity>254
Let>ByteOpacity=255
endif
//Change Dialog Opacity
LibFunc>user32,SetWindowLongA,swl,SplashScreen.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen.handle,0,ByteOpacity,LWA_ALPHA
goto>splash loop

label>splash done
cdg>SplashScreen

//Main Script Starts Here
mdl>Start of main script


YOURLOGO_DATA:
424D56FD000000000000
//Partial Image data because of the forums character limit.
//Download the entire script at the bottom of this post.
Click here to download the entire script


.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts