Open GoogleCodeExporter opened 9 years ago
I think PHP-Desktop should make use of manifest.json (https://www.w3.org/TR/appmanifest/) for things like splash screen
A splash screen would indeed be a very nice feature. Is there any workarounds at the moment?
@siran I can only suggest googling "javascript loading splash" or similar.
@cztomczak your suggestion might work. Yet I don't know what is happening under the hood while the app is loading... is JS available?
A possible workaround is to create an application launcher in other programming/scripting language which will show a splash screen then calls the main phpdesktop exe. Basically you just place the main folder of phpdesktop in a folder, like in the ff. directory structure.
ApplicationFolder |__AppLauncher.exe |__ phpdesktopfolder |__phpdesktop-chrome.exe |__logo.jpg
For AppLauncher, I use the following autohotkey script
/*initially, run minimized*/
Run, phpdesktop\phpdesktop-chrome.exe,, Min
/*
*wait for 3 seconds for the phpdesktop window to be created
*main_window_title is the same as the window title set in the settings.json
*/
WinWait, main_window_title, , 3
WinHide
SplashImage, phpdesktopfolder\logo.jpg, b fs18, Loading...
Sleep, 4000
SplashImage, Off
WinShow
WinMaximize
WinWaitClose
/* run any other script like,cleanup etc. after phpdesktop-chrome.exe is closed*/
MsgBox Bye
Admittedly, this splashscreen will be basically just eye-candy and will not ensure that your php application has already loaded once it is displayed.
My two cents:
About this issue I 'solved' it using AutoIt tool.
With this tool I can write a script that
1) launches the app 0) shows a splash screen 2) detects when the app writes a control file 3) when the file is detected (the app is running) the splash screen is hidden and the control file deleted
This results in a non-eye-candy splash screen.
Downside: if app fails to start, splash screen is not hidden.
Maybe the splash screen can be also hidden with a timer.
My script is something like:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIFiles.au3>
; Change this variable to the full path and filename of the program's executable
$sExec="myexe.exe"
;this empty filename gets created when the app is running.
$sFilePath="relative\path\to\splash.off"
If _WinAPI_FileExists( $sFilePath ) Then
FileDelete($sFilePath)
EndIf
Run($sExec)
$hWait=GUICreate("Loading ...",450,300,-1,-1,BitOR($WS_BORDER,$WS_POPUP),$WS_EX_TOPMOST)
GUICtrlCreatePic("relative\path\to\splash.jpg", 0, 0, 450, 300)
GUISetState(@SW_SHOW)
While 1
sleep(500);
If _WinAPI_FileExists( $sFilePath ) Then
FileDelete($sFilePath)
ExitLoop
EndIf
WEnd
GUIDelete($hWait)
You can tweak up the solution a little bit. Use this AutoIt Script, the following splash.ini and the attached index.php file. Now you have a dynamic solution for all your applications with a nice fading Splash :)
Autoit:
#include
; Change this variable to the full path and filename of the program's executable $sExec=IniRead("splash.ini","SplashConfig","Filename","file.exe")
;this empty filename gets created when the app is running. $sFilePath=IniRead("splash.ini","SplashConfig","DisableFile","splash.off")
If _WinAPI_FileExists( $sFilePath ) Then FileDelete($sFilePath) EndIf
$Process=Run($sExec, "", @SW_HIDE) $hWait=GUICreate("Loading...",450,300,-1,-1,BitOR($WS_BORDER,$WS_POPUP),$WS_EX_TOPMOST) GUICtrlCreatePic(IniRead("splash.ini","SplashConfig","SplashFilename","splash.jpg"), 0, 0, 450, 300) GUISetState(@SW_HIDE) ;fade-in DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWait, "int", 500, "long", 0x00080000)
While 1 sleep(500); If _WinAPI_FileExists( $sFilePath ) Then FileDelete($sFilePath) ExitLoop EndIf WEnd
;fade-out DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWait, "int", 1000, "long", 0x00090000) GUIDelete($hWait)
;this gets the list of windows to sort through Dim $ProcList = WinList () ;browses through all of the items in the array returned For $i = 1 To $ProcList[0][0] If WinGetProcess ( $ProcList[$i][1] ) = $Process Then WinSetState($ProcList[$i][0],"",@SW_SHOW) EndIf Next
splash.ini:
[SplashConfig]
Filename=phpdesktop-chrome.exe
DisableFile=www/splash.off
SplashFilename=splash.jpg
index.php:
$file = 'splash.off';
file_put_contents($file, "", FILE_APPEND | LOCK_EX);
amazing works guys with Autoit and sharing scripts! hats off!
Hi @zap0xfce2... I did not understand which script goes inside the splash.off file.
@astherweb The splash.off file is just a empty file :) Read the AutoIt Script at line 11 & 12 to understand what is happening there.
You can tweak up the solution a little bit. Use this AutoIt Script, the following splash.ini and the attached index.php file. Now you have a dynamic solution for all your applications with a nice fading Splash :)
Autoit:
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIFiles.au3> #include <Process.au3> ; Change this variable to the full path and filename of the program's executable $sExec=IniRead("splash.ini","SplashConfig","Filename","file.exe") ;this empty filename gets created when the app is running. $sFilePath=IniRead("splash.ini","SplashConfig","DisableFile","splash.off") If _WinAPI_FileExists( $sFilePath ) Then FileDelete($sFilePath) EndIf $Process=Run($sExec, "", @SW_HIDE) $hWait=GUICreate("Loading...",450,300,-1,-1,BitOR($WS_BORDER,$WS_POPUP),$WS_EX_TOPMOST) GUICtrlCreatePic(IniRead("splash.ini","SplashConfig","SplashFilename","splash.jpg"), 0, 0, 450, 300) GUISetState(@SW_HIDE) ;fade-in DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWait, "int", 500, "long", 0x00080000) While 1 sleep(500); If _WinAPI_FileExists( $sFilePath ) Then FileDelete($sFilePath) ExitLoop EndIf WEnd ;fade-out DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWait, "int", 1000, "long", 0x00090000) GUIDelete($hWait) ;this gets the list of windows to sort through Dim $ProcList = WinList () ;browses through all of the items in the array returned For $i = 1 To $ProcList[0][0] If WinGetProcess ( $ProcList[$i][1] ) = $Process Then WinSetState($ProcList[$i][0],"",@SW_SHOW) EndIf Next
splash.ini:
[SplashConfig] Filename=phpdesktop-chrome.exe DisableFile=www/splash.off SplashFilename=splash.jpg
index.php:
$file = 'splash.off'; file_put_contents($file, "", FILE_APPEND | LOCK_EX);
This is actually helpful in 2022
An option in settings.json to set an image for a splash screen. This is to prevent user seeing a blank window with white background during application launch while loading start page. CEF callbacks OnLoadingState/OnLoadEnd should be used to determine when web page loading has completed.
It would be nice to be able to set a default backround color for the window, so that white background flicker does not occur during F5 refresh.
Topic for reference: https://groups.google.com/d/topic/phpdesktop/WfIDVZfNAk0/discussion
Original issue reported on code.google.com by
czarek.t...@gmail.com
on 20 Nov 2014 at 6:06