Skip to content
⌘ NSIS Forum Archive

Is it possible

39 posts

TonyDS#

Is it possible

To have a link on the Welcome page

like the Finish page

!define MUI_FINISHPAGE_LINK "My Website"
!define MUI_FINISHPAGE_LINK_LOCATION "http://"

Because I have done it but its invisible, but when you click on it it shows.

The background is grey unlike the one on the Finishpage

I've done it by using a ini file, but like I said it's invisible untill pressed

Is there any way to make it visible?
Afrow UK#
You need to move the welcome text label up.
This can be done by writing to the right value on the show function of the page, or by editing IOSpecial.ini

-Stu
pengyou#
In the standard ioSpecial.ini file used by MUI, [Field 3] has Top=50/Bottom=185. Suspect your new field ([Field 4]?) with the link is being "hidden" by [Field 3]. As Afrow UK suggests, you could move the bottom edge of [Field 3] up a bit to let your new field be seen.
TonyDS#
That worked fine,

I changed Field 3 Bottom=185 to 175 but it still has a grey back, is there any wat to change this?
TonyDS#edited
How do I go about doing that?

Do you have an example of script I could learn from

Here's a quick picture of what I wish to change

The problem
Joel#
It's simple, to use in welcome show page function

!define MUI_CUSTOMFUNCTION_WELCOME_SHOW "myfunc"

Function "myfunc"
FindWindow $0 "#32770" "" $MUI_HWND
GetDlgItem $0 $0 1203 ; remember: 1200 + Field_number
SetBkColor $0 0x00FFFFFF ; turn white the block
FunctionEnd
[edit]
Oops! 😁 fixed 😛
[/edit]
TonyDS#
Thanks for the code

but it just doesn't seem to want to work

I've tried it in my script and tried placing it in the System.nsh

so I'm a littl stuck 😢
TonyDS#
ok here it is

Zip File

prehaps you could also have a look through just to check though it

Thanks so much
Afrow UK#
This isn't related to your current problem, but you have a few errors in the script.

"IntCmp $2 +1 +1 +1 +3" is wrong

You are comparing the number (integer) stored in $2 to +1, which is wrong to start with because "+1" isn't an integer (it's a string).
If the value of $2 will be "+1" or similar, use StrCmp.

Also, you've got some $\r$\r, and some $\n in message boxes.
The correct way is $\r$\n for newline breaks.

-Stu
kichik#
As for the problem itself, this line is wrong:

GetDlgItem $0 $0 1204 ; remember: 1200 + Field_number

It should be

GetDlgItem $0 $0 1203

The number should be 1200 + field number - 1.
Afrow UK#
Btw, that backup macro would be useful.
I never thought of using it that way.

Is it from the Archive, or one of the forum topics?

-Stu
kichik#
There is a problem with your backup macro. It assumes that $INSTDIR is $PROGRAMFILES\LucasArts\XwingAlliance. You better use $INSTDIR instead because it could be changed by InstallDirRegKey and any other piece of code you might add in the future that tempers with $INSTDIR.
TonyDS#
Ok I fixed $INSTDIR problem

I'm not sure where I got the Backup Macro, I thought you helped me with that? 🙂 not sure, it might have been from the archive, or I found it in a script somewhere.

If you want to use it go ahead, it works fine 🙂

Fixed GetDlgItem $0 $0 1203, but it din't make any differance still have a grey box, If can't solve it I'll remove it

Afrow, I'm not too clear on

"IntCmp $2 +1 +1 +1 +3" is wrong

You are comparing the number (integer) stored in $2 to +1, which is wrong to start with because "+1" isn't an integer (it's a string).
If the value of $2 will be "+1" or similar, use StrCmp.

THe number thing still confuses me 🙁

Oh and I replaced the IntCmp with StrCmp, didn't channge the numbers, but it wouldn't complie

What should the line look like please?

Are there any other bugs that could be solved
TonyDS#
Another thing I wanted to ask

instead of Checking the Reg for JoystickID with this code which is wrong anyhow

ReadRegStr $2 HKLM "SOFTWARE\LucasArts Entertainment Company LLC\X-Wing Alliance\v1.0" "JoystickID"
IntCmp $2 +1 +1 +1 +3
MessageBox MB_ICONSTOP|MB_OK "Warning: X-Wing: Alliance is not installed."
Abort
How would I do it if I wanted to check for the existance of XwingAlliance.exe

If the file is not there is quits, but if the file is there it continues to this code

sysinfo::GetFileVersion "$INSTDIR\XwingAlliance.exe"
Pop $0
Push $0
Push "."
Push ""
Call StrReplace
Pop $0
IntCmp $0 2002 +3 0 +3
MessageBox MB_ICONSTOP|MB_OK "WARNING:Blah."
Abort
TonyDS#
Finally fixed the Grey block but I didn't use the code Lobo Lunar suppiled, I just couldn't get that to work

Eventually I edited the System.nsh

but a litle help with the above problem would be great

Thanks

-Tony
Joost Verburg#
Editing System.nsh is not a good solution.

$MUI_HWND contains the HWND of the inner IO dialog, so you need something like this:

GetDlgItem $0 $MUI_HWND 1203
SetBkColor $0 0xFFFFFF
kichik#
As for the "+1" thing, NSIS will treat +1 as 0. NSIS's atoi (string to number) function only treats the minus signal, not the plus sign. Therefore when it won't see any digits but only the plus sign it will convert no longer and will remain with the result 0. If you wish to compare to 1 you should do it like this:

IntCmp $2 1 +1 +1 +3

The relative jump numbers do accept the plus sign but it's not mandatory.
TonyDS#
Yeah Joost, thats excatly what I did 🙂

Ans sorry Kichik to waste your time but, I was going to remove the Check reg for JoystikID thing and replace it with something like:-

If file exist = Xwingalliance.exe carry on with the install to check if its the correct version (which I have already done), but if it doesn't detect the existance of XWA.exe it quits

The thing is I can only get as far as If file exists and abort, I'm not sure what the code should be any help would be great or a pointer to an example or prvious forum topic

I have tried searching for something like this but with no result

Thanks
TonyDS#
I tried it again and I couldn't get it to work

I even tried changing all of them to

Function "myfunc"
FindWindow $0 "#32770" "" $MUI_HWND
GetDlgItem $0 $0 1201
SetBkColor $0 0xFFFFFF
GetDlgItem $0 $0 1202
SetBkColor $0 0xFFFFFF
GetDlgItem $0 $0 1200
SetBkColor $0 0xFFFFFF
GetDlgItem $0 $0 1203
SetBkColor $0 0xFFFFFF
FunctionEnd

As it is set up in the System.nsh

It still remained the same a litte gray box around it

Could I ask why I shouldn't change the system.nsh?

Is it to do with copyright and stuff with NSIS?
Joost Verburg#
Copy the code of my post to your function. You should not use the FindWindow stuff.

Changeing System.nsh is not a good idea because you will have to change it again when System.nsh will be updated and it's also not easy to maintain.
kichik#
If you want to cancel the installation if the file doesn't exist you should check for it in the .onInit function. If it doesn't exist call Abort and the installation won't even start. It's recommended that you show a message box stating why the installer didn't start so the user won't get confused.

To check if a file exists you should use IfFileExists.

I hope I understood you right. If not, please say so.
TonyDS#
Sorry I did'nt take push notice of your code thinking it the same as Lobo Lunar's

Thanks it's now fixed.

Plus I apologise again, I never thought about the System.nsh changing when updating

This will teach me to take more notice of things when I ask for help

Sorry I'm not worthy 🙂

Now to my other problem about searching for the XwingAlliance.exe

Please see above post

Thanks Joost for being so patient 🙂
kichik#
Do you to search for it on the entire hard disk or just in $INSTDIR? If just in $INSTDIR then IfFileExists is what you need. If on the entire hard disk use this:

TonyDS#
No I only want it to look for it in $INSTDIR, This bit of code only looks for it then if found shows the message and aborts.

Function .onInit
IfFileExists "$INSTDIR\XwingAlliance.exe" 0 +3
MessageBox MB_ICONSTOP|MB_OK "Warning: X-Wing: Alliance has not yet been installed on your computer."
Abort
Function
Which is not what I would like it to do

What I would like it to do is, if it is found in the $INSTDIR to continue with the setup, but if it's not found then it shows the message and aborts.

I know it will probably have something to do with Goto, but thats where I'm stuck!

The next thing it would do is to check the version ot see if it is the correct version, using this bit of code in the Function .onInit section which works fine.


sysinfo::GetFileVersion "$PROGRAMFILES\LucasArts\XwingAlliance\XwingAlliance.exe"
Pop $0
Push $0
Push "."
Push ""
Call StrReplace
Pop $0
IntCmp $0 2002 +3 0 +3
MessageBox MB_ICONSTOP|MB_OK "WARNING: Incorrect Version blah blah blah."
Abort
Function StrReplace
replace code and stuff blah blah
FunctionEnd

Oh yeah I did look at that code you suggested, but I don't think it would be any good as like you said it searches the whole HD.
kichik#
Nothing with Goto, it's actually very simple. Just remove that 0 that comes before +3. What you've told IfFileExists to do is to jump +3 if it didn't find that file. The first number tells it where to jump if it did find, the second if it didn't. You've mixed them up, that's all.

The second piece of code that checks the version can come right after the first piece. It should work.
TonyDS#
Jezz it was that simple, now i feel stupid 😛

Anyhow it works fine thanks 🙂

Quick question

Can you center MessageBox text?