Old 9th April 2009, 14:09   #1
odyssey5
Junior Member
 
Join Date: Dec 2002
Posts: 17
Send a message via ICQ to odyssey5 Send a message via AIM to odyssey5 Send a message via Yahoo to odyssey5
WriteIniStr to insert values on a custom page?

I have created a custom page in MUI including a field that should (if it exists) read a value from registry and pre-fill out the field with this value. So far this is somewhat working:

ReadRegStr $1 HKLM "regpath..." ''
WriteIniStr 'custom.ini' 'Field 3' 'State' '$0'

However this does not just fill out the value in the custom page, but also alters my custom page ini-file.

I want this file to be unaltered since I use it for the setup - How do I avoid this?
odyssey5 is offline   Reply With Quote
Old 9th April 2009, 14:19   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Not quite sure what you mean when you say that you want the ini unaltered while you feed the ini field with the value however did you try SendMessage to feed the specific field when the custom page is initialized?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 9th April 2009, 14:37   #3
odyssey5
Junior Member
 
Join Date: Dec 2002
Posts: 17
Send a message via ICQ to odyssey5 Send a message via AIM to odyssey5 Send a message via Yahoo to odyssey5
Well, I created the ini just to create the custom dialog, but I want to feed the text-fields with some values. It's not my intention to write any ini-files as the final values are supposed to be written in registry.

SendMessage may seem to do the job, but I don't understand the usage of it. Tried googling, with no help
odyssey5 is offline   Reply With Quote
Old 9th April 2009, 14:47   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Why googling when you have the NSIS manual, the included examples and firstly this forum?
SendMessage is built-in NSIS instruction and should be what you're looking for.
You'll probably find dozens examples here in forum.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 9th April 2009, 15:35   #5
odyssey5
Junior Member
 
Join Date: Dec 2002
Posts: 17
Send a message via ICQ to odyssey5 Send a message via AIM to odyssey5 Send a message via Yahoo to odyssey5
I think this is the best example I can find, but I'm totally lost at all the addresses

I'm new to this...
odyssey5 is offline   Reply With Quote
Old 9th April 2009, 15:37   #6
odyssey5
Junior Member
 
Join Date: Dec 2002
Posts: 17
Send a message via ICQ to odyssey5 Send a message via AIM to odyssey5 Send a message via Yahoo to odyssey5
So I can't post links? Great...

h t t p://forums.winamp.com/showthread.php?s=&threadid=303378&highlight=SendMessage
odyssey5 is offline   Reply With Quote
Old 9th April 2009, 19:33   #7
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Okay, quick and dirty but you can get an idea:
code:
outfile test.exe

!define my_custom_page '$PLUGINSDIR\custom.ini'

!include mui.nsh
!include winmessages.nsh

page custom cCreate
!insertmacro mui_page_instfiles

!insertmacro mui_language english

section -boo
;
sectionend

Function .onInit
InitPluginsDir
writeinistr '${my_custom_page}' 'settings' 'numfields' '1'
writeinistr '${my_custom_page}' "Field 1" "Type" "Text"
writeinistr '${my_custom_page}' "Field 1" "Flags" ""
writeinistr '${my_custom_page}' "Field 1" "State" "The Quick Brown Fox Jumps Over The Lazy Mad Dog"
writeinistr '${my_custom_page}' "Field 1" "Left" "10"
writeinistr '${my_custom_page}' "Field 1" "Right" "-10"
writeinistr '${my_custom_page}' "Field 1" "Top" "30"
writeinistr '${my_custom_page}' "Field 1" "Bottom" "42"
Functionend

function cCreate
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "custom.ini"

ReadINIStr $1 "${my_custom_page}" "Field 1" "hwnd"
SendMessage $1 ${EM_SETREADONLY} 1 0
SetCtlColors $1 0x000000 0xFFFFFF
ReadRegStr $R0 HKLM "Software\NSIS" ""
SendMessage $1 ${WM_SETTEXT} 0 'STR:$R0'

!insertmacro MUI_INSTALLOPTIONS_SHOW
functionend


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 17th September 2009, 06:54   #8
sprinleo
Junior Member
 
Join Date: May 2009
Posts: 26
does anybody know what's the difference between WriteINIStr and INSTALLOPTIONS_WRITE, how are they different from each other ?

thanks...
sprinleo is offline   Reply With Quote
Old 17th September 2009, 10:05   #9
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
No difference, MUI_INSTALLOPTIONS_WRITE is just a macro using WriteINIStr:
http://forums.winamp.com/showthread.php?postid=1610834
jpderuiter is offline   Reply With Quote
Old 17th September 2009, 10:46   #10
sprinleo
Junior Member
 
Join Date: May 2009
Posts: 26
ok, thanks for your quick reply, i am using this code display a custom page, but for some reason, this page is not being displayed at all, instead shows the subsequent page, thoughts ?

WriteINIStr "winst\DatabaseServer.ini" "Field 4" "State" "0"
!insertmacro INSTALLOPTIONS_DISPLAY "winst\DatabaseServer.ini"
sprinleo is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump