Old 29th September 2011, 08:48   #1
zackbuffo
Member
 
zackbuffo's Avatar
 
Join Date: Jan 2002
Location: Germany (Old Europe)
Posts: 97
SetShellVarContext with variables

I'm struggling with variables again.

I want to read "all useres" or "current user" out of an ini-file, but it doesn't work this way:
code:
Section "install"
ReadINIStr $0 $INSTDIR/Setup.ini USER AUTOSTART
SetShellVarContext "$0"
CreateShortCut "$SMPROGRAMS\Startup\App.lnk" "$INSTDIR\App.exe"
SectionEnd



I tried $0 with and without double quotes. It doesn't compile.

First I thought SetShellVarContext is just working on compiletime, but as I used "all" or "current" instead of $0 within a Section, there were no problems.

Any ideas?

Ich suche jemand in Deutschland, der seinen TAMA Starclassic Maple Kesselsatz tauschen möchte BD:22, TT:14, 12, 10. Ich bin mit dem Set sehr zufrieden, habe mich aber an meiner Lackierung "Tequila Sunrise" sattgesehen. Das Set ist von 2002, gepflegt und wurde ausschließlich in Cases transportiert. Bei Interesse bitte PM an mich. Immernoch aktuell in 2018!!!
zackbuffo is offline   Reply With Quote
Old 29th September 2011, 09:17   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use an If?

Stu
Afrow UK is offline   Reply With Quote
Old 29th September 2011, 09:27   #3
zackbuffo
Member
 
zackbuffo's Avatar
 
Join Date: Jan 2002
Location: Germany (Old Europe)
Posts: 97
To do what?

Ich suche jemand in Deutschland, der seinen TAMA Starclassic Maple Kesselsatz tauschen möchte BD:22, TT:14, 12, 10. Ich bin mit dem Set sehr zufrieden, habe mich aber an meiner Lackierung "Tequila Sunrise" sattgesehen. Das Set ist von 2002, gepflegt und wurde ausschließlich in Cases transportiert. Bei Interesse bitte PM an mich. Immernoch aktuell in 2018!!!
zackbuffo is offline   Reply With Quote
Old 29th September 2011, 10:07   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
${If} $0 == current
SetShellVarContext current
${Else}
SetShellVarContext all
${EndIf}

Stu
Afrow UK is offline   Reply With Quote
Old 29th September 2011, 11:51   #5
zackbuffo
Member
 
zackbuffo's Avatar
 
Join Date: Jan 2002
Location: Germany (Old Europe)
Posts: 97
Thanks for your help, but unfortunately that doesn't do the job...


The second SetShellVarContext parameter is always used. I checked it both ways.

Ich suche jemand in Deutschland, der seinen TAMA Starclassic Maple Kesselsatz tauschen möchte BD:22, TT:14, 12, 10. Ich bin mit dem Set sehr zufrieden, habe mich aber an meiner Lackierung "Tequila Sunrise" sattgesehen. Das Set ist von 2002, gepflegt und wurde ausschließlich in Cases transportiert. Bei Interesse bitte PM an mich. Immernoch aktuell in 2018!!!
zackbuffo is offline   Reply With Quote
Old 29th September 2011, 13:11   #6
zackbuffo
Member
 
zackbuffo's Avatar
 
Join Date: Jan 2002
Location: Germany (Old Europe)
Posts: 97
Solved!

@Afrow UK: I guess your code didn't work for me, because I don't have LogicLib installed...?

I solved the problem with the StrCmp instruction. That's basically what you suggested:
code:
ReadINIStr $0 $INSTDIR\Setup.ini USER AUTOSTART
StrCmp $0 "current" 0 else
SetShellVarContext current
Goto endStrCmp
else:
SetShellVarContext all
endStrCmp:
CreateShortCut "$SMPROGRAMS\Startup\App.lnk" "$INSTDIR\App.exe"


Thanks for the hint...!

Ich suche jemand in Deutschland, der seinen TAMA Starclassic Maple Kesselsatz tauschen möchte BD:22, TT:14, 12, 10. Ich bin mit dem Set sehr zufrieden, habe mich aber an meiner Lackierung "Tequila Sunrise" sattgesehen. Das Set ist von 2002, gepflegt und wurde ausschließlich in Cases transportiert. Bei Interesse bitte PM an mich. Immernoch aktuell in 2018!!!
zackbuffo is offline   Reply With Quote
Old 29th September 2011, 16:43   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You do have LogicLib; it is included with NSIS. If you aren't using MUI2 (which you should be) then just !include LogicLib.nsh.

Edit: Actually your code wouldn't have compiled if you didn't include LogicLib so not sure what the problem was there.

Stu
Afrow UK 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