Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 31st August 2004, 12:25   #1
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
CreateShortCut to the selected sections

My program have 6 section. How can I CreateShortCut to the sections which have been selected by the users.
If there is and you know it, just let me know.
Thanks.
ppppppp is offline   Reply With Quote
Old 31st August 2004, 12:48   #2
Deliverator
Junior Member
 
Join Date: Jul 2003
Location: NY
Posts: 30
This should get you started.

code:

# Create the directory for the shortcuts.
SetOutPath "$SMPROGRAMS\Your Main Folder Name}"

!insertmacro SectionFlagIsSet Your_Section_Name ${SF_SELECTED} 0 +6
# This will set the "Start In" directory.
SetOutPath "$ApplicationDir\Your_Directory"
CreateShortCut "$SMPROGRAMS\Your Main Folder Name\Your_applciation_Name.lnk" \
"$INSTDIR\Your_Application_directory\Your_EXE"

!insertmacro SectionFlagIsSet Your_Section_Name2 ${SF_SELECTED} 0 +6
# This will set the "Start In" directory.
SetOutPath "$ApplicationDir\Your_Directory2"
CreateShortCut "$SMPROGRAMS\Your Main Folder Name2\Your_applciation_Name2.lnk" \
"$INSTDIR\Your_Application_directory2\Your2_EXE"

Deliverator is offline   Reply With Quote
Old 31st August 2004, 13:08   #3
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
thank you very much!
I will have a try.
ppppppp is offline   Reply With Quote
Old 31st August 2004, 13:55   #4
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
This code do not work well.
The shortcut will allways be created,no matter the section selected or not.
I don't know why, the code seem right. where can I know more about "!insertmacro SectionFlagIsSet"
ppppppp is offline   Reply With Quote
Old 31st August 2004, 14:33   #5
Deliverator
Junior Member
 
Join Date: Jul 2003
Location: NY
Posts: 30
Did you define your sections like this?

Section "My Section Name" SecID1
Deliverator is offline   Reply With Quote
Old 1st September 2004, 03:48   #6
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
I want to CreateShortCut to the sections which have been checked by the users,
but the code does not work well.
The shortcut will allways be created,no matter the section checked or not.

My chortcut.nsi is here
Attached Files
File Type: nsi creat shortcut.nsi (2.4 KB, 76 views)
ppppppp is offline   Reply With Quote
Old 1st September 2004, 13:33   #7
Deliverator
Junior Member
 
Join Date: Jul 2003
Location: NY
Posts: 30
Sorry, I screwed up the example. This works.


code:

section ""
# Create the directory for the shortcuts.
SetOutPath "$SMPROGRAMS\CreateShortCut"

!insertmacro SectionFlagIsSet "${sec1}" "${SF_SELECTED}" 0 skipRed
CreateShortCut "$SMPROGRAMS\CreateShortCut\red.lnk" "$INSTDIR\red.html"
skipRed:
!insertmacro SectionFlagIsSet "${sec2}" "${SF_SELECTED}" 0 skipBlue
CreateShortCut "$SMPROGRAMS\CreateShortCut\blue.lnk" "$INSTDIR\blue.html"
skipBlue:
!insertmacro SectionFlagIsSet "${sec3}" "${SF_SELECTED}" 0 skipGreen
CreateShortCut "$SMPROGRAMS\CreateShortCut\green.lnk" "$INSTDIR\green.html"
skipGreen:
!insertmacro SectionFlagIsSet "${sec4}" "${SF_SELECTED}" 0 skipGray
CreateShortCut "$SMPROGRAMS\CreateShortCut\gray.lnk" "$INSTDIR\gray.html"
skipGray:
SectionEnd

Deliverator is offline   Reply With Quote
Old 1st September 2004, 15:48   #8
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
Don't say sorry, you are so kind! The code really work very well!
Thank you very much!
ppppppp is offline   Reply With Quote
Reply
Go Back   Winamp 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