Archive: Is it possible


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?


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


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.


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?


Maybe you could change the colour with GetDlgItem and SendMessage.
I dunno?

-Stu


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


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! :D fixed :p
[/edit]

Use WELCOME instead of FINISH.


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 :cry:


Attach your script. Defined at the right position (see Modern UI Readme)?


ok here it is

Zip File

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

Thanks so much


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


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.


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


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.


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


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

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


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


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.


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


You should add it to your function, not to System.nsh.


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?

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.


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.


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 :)


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:

http://nsis.sourceforge.net/archive/...php?pageid=266


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.

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.


Jezz it was that simple, now i feel stupid :p

Anyhow it works fine thanks :)

Quick question

Can you center MessageBox text?


There is no direct way. You can pad the text with spaces from both sizes, but you can never be sure it will work on all configurations.


You have a multi-line message box and want the text to be centered? I don't think that's a good idea (it doesn't look nice and isn't the Windows style).


Ok just wondered

Anyhow last question, how do I go about changing the text colour of the Finish page link without editing the System.nsh?


Use the TxtColor setting (see InstallOptions Readme).


No I'm using the

!define MUI_FINISHPAGE_LINK
!define MUI_FINISHPAGE_LINK_LOCATION

in my script, and since the colour is defined in the System.nsh file for the link how would I change it for my script to refer to changing the colour, do I have to create a new ini file, if so, how do I tell it to to change the link colour on the Finish page

plus I'm already using the !define MUI_SPECIALINI for ini file for the link on the Welcome page


You should simply write the desired TxtColor value into ioSpecial.ini in the pre function of the finish page. Look for MUI_CUSTOMFUNCTION_FINISH_PRE in the MUI readme for more information about the pre function of the finish page.


I'll add a setting to the Modern UI. That's easier for you :)

Edit: done :) Get the latest development version and use MUI_FINISHPAGE_LINK_COLOR. See Readme for details.


Thanks so much this will help alot


That was so easy, Thanks you :)