You are here

CheckForPlatformSplashDisable NSIS function 1.2 [Updated 2020-03-20]

3 posts / 0 new
Last post
John T. Haller
John T. Haller's picture
Online
Last seen: 58 min 21 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
CheckForPlatformSplashDisable NSIS function 1.2 [Updated 2020-03-20]

The CheckForPlatformSplashDisable function included with multiple custom launchers needs a minor update for NSIS 3.0 due to the fact it being standard NSIS and not NSIS Unicode anymore. The updated function for use with Firefox, Thunderbird, etc is posted here:

; CheckForPlatformSplashDisable 1.2 (2020-03-20)
;
; Checks if the platform wants the splash screen disabled
; Copyright 2008-2020 John T. Haller of PortableApps.com
; Released under the GPL
;
; Usage: ${CheckForPlatformSplashDisable} _v
;
; Example: ${CheckForPlatformSplashDisable} $DisableSplashScreen
;    If the platform wants it disabled, $DisableSplashScreen will be true.
;    Otherwise it will be whatever its previous value was
;
; Requires: ProcFunc.nsh 2.2 or higher from PortableApps.com

!ifndef CheckForPlatformSplashDisable
	!include LogicLib.nsh
	!include ProcFunc.nsh

	!macro CheckForPlatformSplashDisable _v
		${If} ${_v} != true
			;Get parameter and prep stack
			Push $0
			Push $1
			Push $R0
			
			StrCpy $0 ${_v}

			;Read the environment variable
			ReadEnvStr $1 PortableApps.comDisableSplash
			${If} $1 == true
				${GetParent} $EXEDIR $1
				${If} ${FileExists} "$1\PortableApps.com\PortableAppsPlatform.exe"
					MoreInfo::GetProductName `$1\PortableApps.com\PortableAppsPlatform.exe`
					Pop $R0
					${If} $R0 == "PortableApps.com Platform"
						MoreInfo::GetCompanyName `$1\PortableApps.com\PortableAppsPlatform.exe`
						Pop $R0
						${If} $R0 == "PortableApps.com"
							${If} ${ProcessExists} "PortableAppsPlatform.exe"
								StrCpy $0 true
							${EndIf}
						${EndIf}
					${EndIf}
				${EndIf}
			${EndIf}
			
			;Restore the stack and store the variable
			Pop $R0
			Pop $1
			Exch $0
			Pop ${_v}
		${EndIf}
	!macroend
	!define CheckForPlatformSplashDisable '!insertmacro CheckForPlatformSplashDisable'
!endif

Release History
2020-03-20: Version 1.2: Fixed issue with splash not hidden due to processes bug, simplified code with LogicLib
2016-11-19: Version 1.1: Initial public release

John T. Haller
John T. Haller's picture
Online
Last seen: 58 min 21 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Deprecated Version 1.1
; CheckForPlatformSplashDisable 1.1 (2016-11-19)
;
; Checks if the platform wants the splash screen disabled
; Copyright 2008-2016 John T. Haller of PortableApps.com
; Released under the GPL
;
; Usage: ${CheckForPlatformSplashDisable} _v
;
; Example: ${CheckForPlatformSplashDisable} $DisableSplashScreen
;    If the platform wants it disabled, $DisableSplashScreen will be true.
;    Otherwise it will be whatever its previous value was

!macro CheckForPlatformSplashDisable _v
	StrCmp ${_v} true _CFPSDEnd
		;Get the parameter and sort out the stack
		Push $0
		Push $1
		Push $R0
		
		StrCpy $0 ${_v}

		;Read from the INI
		ReadEnvStr $1 PortableApps.comDisableSplash
		StrCmp $1 true "" _CFPSDStackEnd

		${GetParent} $EXEDIR $1
		IfFileExists $1\PortableApps.com\PortableAppsPlatform.exe "" _CFPSDStackEnd

		MoreInfo::GetProductName `$1\PortableApps.com\PortableAppsPlatform.exe`
		Pop $R0
		StrCmp $R0 "PortableApps.com Platform" "" _CFPSDStackEnd

		MoreInfo::GetCompanyName `$1\PortableApps.com\PortableAppsPlatform.exe`
		Pop $R0
		StrCmp $R0 PortableApps.com "" _CFPSDStackEnd

		FindProcDLL::FindProc PortableAppsPlatform.exe ; Onto $R0
		IntCmp $R0 1 "" _CFPSDStackEnd _CFPSDStackEnd

		StrCpy $0 true

		_CFPSDStackEnd:
		; Restore the stack and sort everything out
		Pop $R0
		Pop $1
		Exch $0
		Pop ${_v}

	_CFPSDEnd:
!macroend
!define CheckForPlatformSplashDisable '!insertmacro CheckForPlatformSplashDisable'

Sometimes, the impossible can become possible, if you're awesome!

John T. Haller
John T. Haller's picture
Online
Last seen: 58 min 21 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Updated to 1.2

I've updated this to version 1.2 with today's release of WinSCP Portable to fix a bug where it would not correctly hide the splash when set to in the PortableApps.com Platform due to the NSIS processes bug where it can't detect running processes when 300+ processes are running. I also took the opportunity to improve readability by using LogicLib.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments