Jump to content

Splash Image?


Recommended Posts

Hi, im working on a simple script and i found the SplashImageOn function. But now i have a problem, the image wont load. There is just an empty sleep until my actual script starts. This is an example of my script, anyone can use if they want, though its just a altered version of the first tutorial.

$destination = "C:\Users\Daniel\Desktop\Test.jpg"

SplashImageOn("Splash Screen", $destination,250,50)
Sleep(3000)
SplashOff()
$answer = InputBox ("Yes or No?", "Would you like to see automated text? Please Either write Yes or No", "Yes")
If $answer = "No" Then 
    ProcessClose ( "AutoIt3_x64.exe" )
EndIf
#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -d

Opt("SendKeyDelay", 75)

ProgressOn("Loading...", "Please wait while it is loading", "0 percent")

For $i = 5 To 100 Step 5

    Sleep(100)

    ProgressSet($i, $i & " percent")
Next

ProgressSet(100, "Done", "Complete")

Sleep(500)

ProgressOff()

Run("Notepad.exe")

WinWaitActive("Untitled - Notepad")

ControlSend("Untitled - Notepad", '', "Edit1", "Hello, thank you for testing my script. This script was made by Daniel Yi. It has no purpose except to be a test for my script. Hallo, danke für den Test mein Skript. Dieses Skript wurde von Daniel Yi gemacht. Es hat keinen Zweck, als eine Prüfung für mein Skript werden")
Link to comment
Share on other sites

This works for me:

(Don't forget to change back your height and width)

#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -d

Global Const $destination = @DesktopDir & "\Test.jpg"
Global Const $width = 500
Global Const $height = 400
Global Const $centerX = (@DesktopWidth - $width) / 2
Global Const $centerY = (@DesktopHeight - $height) / 2

SplashImageOn("Splash Screen", $destination, $width, $height, $centerX, $centerY, 1)

Sleep(3000)

SplashOff()

Global Const $answer = InputBox("Yes or No?", "Would you like to see automated text? Please Either write Yes or No", "Yes")

If $answer = "No" Then
    ProcessClose(@AutoItPID)
EndIf

Opt("SendKeyDelay", 75)

ProgressOn("Loading...", "Please wait while it is loading", "0 percent")

For $i = 5 To 100 Step 5

    Sleep(100)

    ProgressSet($i, $i & " percent")
Next

ProgressSet(100, "Done", "Complete")

Sleep(500)

ProgressOff()

Run("Notepad.exe")

WinWaitActive("Untitled - Notepad")

ControlSend("Untitled - Notepad", '', "Edit1", "Hello, thank you for testing my script. This script was made by Daniel Yi. It has no purpose except to be a test for my script. Hallo, danke für den Test mein Skript. Dieses Skript wurde von Daniel Yi gemacht. Es hat keinen Zweck, als eine Prüfung für mein Skript werden")
Edited by jaberwocky6669
Link to comment
Share on other sites

Is it a real JPG-image? AutoIt can only read bmp, jpg and gif I suppose. png, tiff, ... is not supported

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

You can use GDI+ to simulate the Splash function:

#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $hWnd, $hGraphic, $file, $hImage
Global $iX, $iY

$file = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\torus.png"

If Not FileExists($file) Then Exit MsgBox(16, "Error", $file & " not found!", 10)

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile($file)

$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)

$hWnd = GUICreate("GDI+: Simple Splash Screen by UEZ", $iX, $iY, -1, -1, $WS_BORDER + $WS_SYSMENU + $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($hWnd, "", 0)
GUISetState()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)

GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT = 0x000F
GUIRegisterMsg(0x0014 , "WM_ERASEBKGND") ;WM_ERASEBKGND = 0x0014

GUISetOnEvent(-3, "_Exit")

For $i = 0 To 255 Step 2
    WinSetTrans($hWnd, "", $i)
    Sleep(10)
Next

Sleep(5000)

For $i = 255 To 0 Step -2
    WinSetTrans($hWnd, "", $i)
    Sleep(5)
Next

GUIDelete($hWnd)

_Exit()

Func _Exit()
    GUIRegisterMsg(0x000F, "")
    GUIRegisterMsg(0x0014, "")
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
EndFunc

Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc ;==>WM_PAINT

Func WM_ERASEBKGND()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

ehh, idk why D: Im sure its jpg, on my desktop

Is it definitely on YOUR desktop and not the ALL USERS desktop?

Right click the .jpg on your desktop and click properties and check the 'Location' line.

NiVZ

Link to comment
Share on other sites

Run this, do the MsgBox say True or False?

MsgBox(0, "", FileExists("C:\Users\Daniel\Desktop\Test.jpg") = True)

Also upload the image somewhere so we can look at it to make sure it's actually a jpg, and not something else named that way (wouldn't be the first time).

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...