Jump to content

Hide script


Recommended Posts

Hi,

I am sure this was covered in some way before, but I cannot find it when I search. This is what I amtrying to do:

I have writen an AutoIT script that splashes a few informational windows up, and shows a progress bar. During the install part of the script and the actual running of the script, I want to load an image to hide every thing going on behind it. I thought I could use the WinApi_LoadImage funtion, but either I am doining everything wrong (probably), I cannot get it to work. The script that I run opens a GUI window with selections. When the selection is chosen, several things happen in the background. I have attached the script(s) I use to install the program files, and the one to run the program.

It may not be the right way to do it either.

Please help...

ECsend.au3

install.au3

"so much work, so little brains..."

Link to comment
Share on other sites

I've been using _SplashScreen to handle this sort of thing.

I'm pretty sure someone else out here created it, or possibly included in initial installation and in the Includes Folder. (???)

(Apologies to the actual creator of this script for changes I've made, and no credit expressed towards you)

Regardless, I've modified this a bit, and include this in all of my installations.

It's very basic, but does the job.

Save this as "SplashScreen.au3", and save it into your Includes Folder.

#include once
;-----------------------------------------------------------------------------------------------
;
; Required Includes in main script...:  GUIConstantsEx.au3
;                        :  WindowsConstants.au3
;-----------------------------------------------------------------------------------------------
Global $SplashGui
Global $Label
Global $GuiSplashText
Global $sFontName = 'Times New Roman'
; #FUNCTION# ======================================================================================
; Name...........:  _SplashScreen
; Description ...:  Display SplashScreen during installations
; Syntax.........:  _SplashScreen($sInstallName,$sInstallMessage,$sBackgroundBMP)
; Parameters.....:  $sInstallName - String for Name of the Package Installed
;                   $sInstallMessage - Any specific message to display
;           $sFontName  - Name of Font to use Default = Times New Roman
;           $sImage - Any picture to place in message
;           $sBackgroundBMP - Color of background to use for entire screen
; Return ........:  Success - 0
;           Failure - 1
;           @Error  - 0 = No error
;           1 = No Installation Name Given
;           2 = No Message Given
;           3 = No Graphics Given
; Related .......:  _SplashUpdate & _SplashClose
; =================================================================================================
Func _SplashScreen($sInstallName,$sInstallMessage,$sBackgroundBMP = 'Path to BMP file')
    Local $WS_POPUP = 0x80000000
    Local $WS_EX_TOPMOST = 0x00000008

    If $sBackgroundBMP = "" Then
        ConsoleWrite("--> Warning from function _SplashScrren, No Background BMP given.")
        Return SetError(3)
    EndIf
    SplashImageOn('',$sBackgroundBMP,@DesktopWidth,@DesktopHeight,'','',1)

    If $sInstallName = "" Then
        ConsoleWrite("--> Warning from function _SplashScreen, No Installation Name given.")
        Return SetError(1)
    EndIf
    If $sInstallMessage = '' Then
        ConsoleWrite("--> Warning from _SplashScreen, No message given")
        Return SetError(2)
    EndIf

    Local $Strlen   = StringLen($sInstallName)
    $SplashGui      = GUICreate('',550,230,20,20,$WS_POPUP,$WS_EX_TOPMOST)
    $Label          = GUICtrlCreateLabel($sInstallName,500 - ($Strlen*10),25,120 + ($Strlen*10),30)
    $GuiSplashText  = GUICtrlCreateLabel($sInstallMessage,20,190,510,-1)
    GUICtrlSetFont($Label,16,600,'',$sFontName)
    GUICtrlSetFont($GuiSplashText,14,400,'',$sFontName)
    GUISetState(@SW_SHOW)
    Return SetError(0)
EndFunc

; #FUNCTION# ======================================================================================
; Name...........:  _SplashUpdate
; Description ...:  Update Message on SplashScreen Message Board
; Syntax.........:  _SplashUpdate($sUpdateName,$sUpdateMessage)
; Parameters.....:  $sUpdateName - String for Updating the Name of the Installation
;                   $sUpdateMessage - Any specific message to display
; Return ........:  Success - 0
;           Failure - 1
;           @Error  - 0 = No error
;           1 = No Update for Installation Name Given
;           2 = No Update for Message Given
; Related .......:  _SplashScreen & _SplashClose
; =================================================================================================
Func _SplashUpdate($sUpdateName,$sUpdateMessage)
    Local $WS_POPUP = 0x80000000
    Local $WS_EX_TOPMOST = 0x00000008

    If $sUpdateName = '' Then
        ConsoleWrite("--> Warning: No 'Update' for new name given")
        Return SetError(1)
    EndIf
    If $sUpdateMessage = '' Then
        ConsoleWrite("--> Warning: No 'Update' for new message given")
        Return SetError(2)
    EndIf
    
    GUICtrlSetData($Label,$sUpdateName)
    GUICtrlSetFont(-1,16,600,'',$sFontName)
    GUICtrlSetData($GuiSplashText,$sUpdateMessage)
    GUICtrlSetFont(-1,14,400,'',$sFontName)
    Return SetError(0)

EndFunc

; #FUNCTION# ======================================================================================
; Name...........:  _SplashClose
; Description ...:  Close SplashScreen and delete it's GUI
; Syntax.........:  _SplashClose()
; Parameters.....:  Empty
; Related .......:  _SplashScreen & _SplashUpdate
; =================================================================================================
Func _SplashClose()
    GUIDelete($SplashGui)
    SplashOff()
EndFunc

In your main script be sure to - "#include <SplashScreen.au3>"

To kick off your SplashScreen:

_SplashScreen("This is Title of Install", "This is brief Message", "This is path to BMP for background")

To Update the message:

_SplashUpdate("Title / same or new","New brief Message")

To Close the SplashScreen:

_SplashClose()

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...