- NSIS Discussion
- Link who opens a text file
Archive: Link who opens a text file
Sp33dy G0nz4l3s
14th January 2007 10:34 UTC
Link who opens a text file
Hi,
I've created a custom page. Now I would add a function:
At the bottom is a link "Hier". Is it possible when the user clicks on "Hier" that a text file e.g. "$INSTDIR\Infos\Textfile.txt" opens?
Thanks for your help.
- Marc
Here is a screenshot:
Red Wine
14th January 2007 11:00 UTC
Type=Link
........
........
Text=Open Read me
State=<full_path_to_file>\file.txt
Sp33dy G0nz4l3s
14th January 2007 12:22 UTC
Oh very easy :)
THANKS
Edit:
One question: When I choose the path: C:\... it works perfect but when I use State=$INSTDIR\Infos\Tasten.txt it doesn't work.
Is there a way that it works?
Red Wine
14th January 2007 12:57 UTC
You may add constants though the directory must exists, you're receiving this error because the $INSTDIR yet is not created since your section would be executed later on InstFiles page :)
Sp33dy G0nz4l3s
14th January 2007 14:35 UTC
I thought this to but this is my sequence:
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Page custom ConfigPage PageLeaveConfig
...
The ConfigPage is the page with the link. So it should work?
Have you an idea what I could trying?
Red Wine
14th January 2007 14:50 UTC
Let's make it clear, if the $INSTDIR is created and all files are in tact, you need to add this line to the custom ini within the ConfigPage function e.g.
Function ConfigPage
WriteINIStr "$PLUGINSDIR\<ini_file_name>" "field #" "State" "$INSTDIR\Infos\Tasten.txt"
..............
..............
..............
FunctioEnd
Sp33dy G0nz4l3s
14th January 2007 17:37 UTC
Thanks Red Wine for your help. I've make it now like you've said.
This is the ConfigPage Function Code:
Function ConfigPage
!insertmacro SectionFlagIsSet ${SectionConfig} ${SF_SELECTED} ShowPage SkipPage
ShowPage:
GetDlgItem $R0 $HWNDPARENT 2
EnableWindow $R0 0|1 # 0=hide, 1=show
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0|1 # 0=hide, 1=show
!insertmacro MUI_HEADER_TEXT "Konfiguration des Erweiterungs System" "Legen Sie die Tasten für die Config fest."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "config.ini"
WriteINIStr "$PLUGINSDIR\config.ini" "field 9" "State" "$INSTDIR\Infos\Tasten.txt"
SkipPage:
FunctionEnd
This is the Code from the link in the config.ini:
[Field 9]
Type=Link
Text=Hier
Left=28
Right=42
Top=118
Bottom=126
TxtColor=0x0080FF
State=$INSTDIR\Infos\Tasten.txt
Is this right so? Unfotunately it doesn't work.
Can you say me what's wrong?
Thank you!!
Red Wine
14th January 2007 17:42 UTC
The wrong is that you first display the page then write to ini.
WriteINIStr "$PLUGINSDIR\config.ini" "field 9" "State" "$INSTDIR\Infos\Tasten.txt"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "config.ini"
Sp33dy G0nz4l3s
14th January 2007 18:55 UTC
COOL THANKS :)
Works perfect now!!