Archive: variables into file.ini


variables into file.ini
  Hi all,
I don't know if it's possible.. but I need to put variables inside InstallOptions file.
Another question is:
can I read a string of a file and put it into a file.ini during run-time (not compile-time)?
I hope so.
Bye, thanks in advance


Use WriteINIStr and ReadINIStr.


Perhaps I didn't explain well..
I have a custom page with a text field.
I want the state (default value) of text be read from a file during runtime.
Can I put variables (or lines of codes) into installOptions file?
Thanks in advance.


Yes, with WriteINIStr you can write variables too.


Thanks a lot kichik, with WriteINIStr I change the contents of my custompage installOptions .ini file, but I've to recompile to see modification to take effect.
That's what I've understand.. can you explain me better, please?
Thank's in advance.


Ah, so you want the InstallOptions file to contain variables and have those parsed when the page is loaded without changes to the script. That's is not possible with InstallOptions. I think InstallOptionsEx has that option.


Ok, unfortunately I understood well :(
I think this is not possible with InstallOptionsEx too.
Thanks.. bye, dilox


Funny thing, I think this functionality is exactly what I'm looking for, as well...

I need the text of one button to change based off of a registry key value, and a link to either show or not based on a define.

The only way that looks like it may work for me so far is to have a separate page for each possible combination, using !defines and !ifdefs to make sure the correct one displays. I haven't quite gotten this done yet (lots of redundant work), but am I barking up the wrong tree?

This just seems like a wholly inelegant (and bloated) way of going about it...

Suggestions welcome. I think they'd likely help dilox77, as well. :)

--Matt


Yes.. I thought to have a separate page for each possible combinations, but I refuse to have this kind of work..
What we need is a function that let you to parse ini file durin' runtime (this will solve problem of events on the page too) but I don't know if it's possible to realize it in C.
I hope somebody can!
bye, dilox


How about including an external file and reading whatever you need from that?


maybe u're understanding each other wrong?

the text of any label on any installoptions page can be set just before it is shown. see the documentation about "installoptions" and the custom functions "pre", "init" and "show".
if you want to change the text at runtime, use the "sendmessage" command:

SendMessage $HANDLE_OF_YOUR_LABEL${WM_SETTEXT} 0 "STR:YOUR CUSTOM TEXT, even ${Defines}, $(LangStrings) and $Variables are valid" 

get the $HANDLE_OF_YOUR_LABEL with this code in the SHOW function of your custom page:

HWND

>Var HANDLE_OF_YOUR_LABEL
>Function CustomPageShow
FindWindow $HWND"#32770" "" $HWNDPARENT ; get the inner handle
GetDlgItem $HANDLE_OF_YOUR_LABEL $HWND NUMBER_OF_LABEL
>
where the NUMBER_OF_LABEL is calculated this way:
1200 + Field number - 1

Comm@nder: But how do I change both the text of the button as well as what it does? To be more specific, the particular button I am thinking of needs to say "Install Product" if it's not installed and actually launch the appropriate setup file. Then, if the user has already installed the particluar object, it needs to say "Run Product" and launch the program's executable.

Perhaps what I need is already implemented. Perhaps not. I sure haven't figured it out yet. :( I neglected to mention that what the button actually DOES changes, as well. I apologize for that.


Thank's a lot Comm@nder21!
You solved me a big problem
:up:
dilox


@lewellyn:
install it the common way, and include a finishpage on which you can run the product.
therefor you don't need any custom pages, labels, buttons, etc.

read the modern ui readme about the finish-page's features.

but if you really want to do it you way:
1. i think you're using a button inside a custom page`, so it has the notify flag, and everything it does stands inside the LEAVE function.
then just use a variable to store the action:


$action

>Var $adress
>...
>StrCpy $action "install"
>...
Function LEAVE
>...
>buttonaction: ; the button was pressed
GetLabelAddress $adress $action
Call $adress
Abort
install:
;install-code
StrCpy $action run
>Return
>run:
;run-code
StrCpy $action none
>Return
>none:
Return
...
>FunctionEnd
>
(i just had to try out the GetLabelAdress-Call-Return functionality, forgive me :D)

Commander: I'm almost done with a glorious autorun.exe thinger.

Most of the time for our products, I check in .onInit whether a specific registry is set, and run the program's launcher, if so. In this case, the installer takes so long to check the CRC due to the size, that that method is impractical. So, I need a menu to choose whether to install/launch the program depending on whether it is installed.

Look for an archive page with my results soon. It isn't as difficult as first thought. Just need to get it to cooperate fully now... :)