Skip to content
⌘ NSIS Forum Archive

MSIBanner Woes

6 posts

grahama#

MSIBanner Woes

I keep getting intermittent compile erors with the new version of MSIBanne 🙁
I changed the MSI nsi to the below to produce the error...sometimes it compiles...sometimes it doesn't

!define PRODUCT "MSIBanner"
Name ${PRODUCT}
OutFile ${PRODUCT}.exe
ShowInstDetails show
XPStyle on

Var bannerText
Var theFile
Var destDir
Var user
Var isAdmin
Var accountType

Function .onInit
strcpy $bannerText "I am having errors 🙁"
MSIBanner::Show /NOUNLOAD "NSIS Installer - $bannerText}"
call isAdmin
call first
;call second
FunctionEnd

function first

; Call MSIBanner Update function so, the text & the progress bar will be...mmm, updated 😛
MSIBanner::Update /NOUNLOAD "${PRODUCT} is blash"
; Sleep a while, since we don't real reading let's see for a sec. the text 😉

; Call update, to add more text, and the progress bar sould increase more:
MSIBanner::Update /NOUNLOAD "Reading unknown stuff from your PC"

Sleep 1000

; Update more...
MSIBanner::Update /NOUNLOAD "${PRODUCT} is blash bloop"
; more pretty text:
Sleep 1000

Functionend

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function Second
; Let's reset the progress bar...
MSIBanner::Reset /NOUNLOAD "Reseting values..."
; Now.. we can add our values to move the progress bar as we wish 😉
Sleep 1000
MSIBanner::Move /NOUNLOAD 20 "Countdown to ${PRODUCT} is blash"
Sleep 1000
MSIBanner::Move /NOUNLOAD 20 "Countdown to destruction 4"
Sleep 1000
MSIBanner::Move /NOUNLOAD 20 "Countdown to destruction 3"
Sleep 1000
MSIBanner::Move /NOUNLOAD 10 "Countdown to destruction 2"
Sleep 1000
MSIBanner::Move /NOUNLOAD 30 "Countdown to ${PRODUCT} is blash"
Sleep 1000
MSIBanner::Reset /NOUNLOAD "Re-counting again.... ${PRODUCT} is blash"
; And... let's move the progress bar manually 🙂
Sleep 1000
MSIBanner::Pos /NOUNLOAD 10 "Reading hardaware"
Sleep 1000
MSIBanner::Pos /NOUNLOAD 25 "Reading memory"
Sleep 1000
MSIBanner::Pos /NOUNLOAD 45 "Reading mouse"
Sleep 1000
MSIBanner::Pos /NOUNLOAD 60 "Reading software"
Sleep 1000
MSIBanner::Pos /NOUNLOAD 40 "wait... forgot keyboard"
Sleep 1500
MSIBanner::Pos /NOUNLOAD 70 "Reading CPU"
Sleep 1000
MSIBanner::Pos /NOUNLOAD 90 "Finishing global scoops..."
Sleep 1000
; last call and the progress bar will increase more:
MSIBanner::Pos /NOUNLOAD 100 "Cleaning...."
; look, more pretty text:
Sleep 1000
MSIBANNER:😁Estroy

FunctionEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function isAdmin
Call isUserAdmin
POP $R0
strcmp $R0 "true" isAdmin notAdmin
;
isAdmin:
;messageBox MB_OK "we are admin"
;strcmp $QT "current" +1 done
;messageBox MB_OK "QT is current"
MSIBanner::Pos /NOUNLOAD 10 "We are admin"
sleep 1000
; Call firstInstall
;Call UpdateCheck
goto done
;
notAdmin:
;strcmp $QT "current" +1 getAdmin
MSIBanner::Pos /NOUNLOAD 10 "We are NOT admin"
;call firstInstall
;Call UpdateCheck
goto done
;
getAdmin:

;call getAdmin
;MessageBox MB_ICONSTOP "This application must be installed by an administrator.$\nClick 'OK' to terminate the installation."
Abort
;
done:
;on to installation section
;MSIBANNER:😁ESTROY
FunctionEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function IsUserAdmin
Push $R0
Push $R1
Push $R2

ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop $R1
UserInfo::GetAccountType
Pop $R2

StrCmp $R2 "Admin" 0 Continue
; Observation: I get here when running Win98SE. (Lilla)
; The functions UserInfo.dll looks for are there on Win98 too,
; but just don't work. So UserInfo.dll, knowing that admin isn't required
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
StrCpy $R0 "true"
Goto Done

Continue:
; You should still check for an empty string because the functions
; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
StrCmp $R2 "" Win9x
StrCpy $R0 "false"
;MessageBox MB_OK 'User "$R1" is in the "$R2" group'
Goto Done

Win9x:
; comment/message below is by UserInfo.nsi author:
; This one means you don't need to care about admin or
; not admin because Windows 9x doesn't either
;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
StrCpy $R0 "true"

Done:
strcpy $user "$R1"
strcpy $isAdmin "$R0"
strcpy $accountType "$R2"
strcpy $bannerText "User= $R1, AccountType= $R2, IsUserAdmin= $R0"

MSIBanner::UPDATE /NOUNLOAD "$bannerText"
sleep 1000
Pop $R2
Pop $R1
Exch $R0

FunctionEnd



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Section -default
; Destroy the banner here, where we have a valid HWND
; if the progress bar isn't full, this fuction will make it:
; Note:
; the minimum value is 0 and the maximum is 100.
; Everytime the function "Update" is called, the progress bar moves "5" units (global increment).
; Everytime the function "Move" is called, the progress bar adds the inputed value to the global increment.
; Everytime the function "Pos" is called, the progress bar moves into position inputed, becoming the current global increment.
MSIBanner:😁estroy
DetailPrint "Works great!"
SectionEnd
Afrow UK#
It would be better to post the compile errors rather than your source code.
Also, not that you need to now, but please attach your source code as a file attachment (so you don't get smilies and it is easier to read the topic).

-Stu
grahama#
Good Idea...

here's the script....


where are the compiling errors stored ?
Joel#
ok.... One think that I haven't tested with the plugin was multiple function calling...as you using....

Basically, as the example that I attached, the plugin is used in one function only.... not multiple....

Right know, can't test...I'm not at home...this weekend I'll work it 🙂
Comperio#
PS: According to the help files, you can call MakeNSIS.EXE with the switch '/o' followed by the filename to have the compiler output messages to a file instead of on screen.

You can also copy and paste the errors from the compiler interface (MakeNSISW.EXE)
grahama#
no worries Lobo 🙂
going to be taking the weekend off....
will take my g/f to the ocean and enjoy a couple days without a computer
have a great weekend
g