Old 22nd March 2012, 18:51   #1
nsismat
Junior Member
 
Join Date: Mar 2012
Posts: 2
Write "$1" as the value of a registry key

Hello,

I've been trying to figure out how to write "$1" to the registry key without luck.

I want the value of my key to be "...QuickShortcut.exe $1", unfortunately the $1 is seen as a variable and it doesn't work.


WriteRegStr HKCR "*\shell\QuickApp\command" "" "$INSTDIR\QuickShortcut.exe $1"



Any suggestions?
nsismat is offline   Reply With Quote
Old 22nd March 2012, 19:30   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
$$1.

Stu
Afrow UK is offline   Reply With Quote
Old 22nd March 2012, 19:43   #3
nsismat
Junior Member
 
Join Date: Mar 2012
Posts: 2
Thank you,
nsismat is offline   Reply With Quote
Old 26th March 2012, 16:02   #4
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
should be
"$INSTDIR\QuickShortcut.exe $\"$1$\""
if $1 contains spaces, eg path
Brummelchen is offline   Reply With Quote
Old 26th March 2012, 20:16   #5
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Shouldn't that be $\"$$1$\"" , then?
MSG is offline   Reply With Quote
Old 26th March 2012, 20:55   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Yes, or how about: `"$INSTDIR\QuickShortcut.exe" "$$1"`?

Stu
Afrow UK is offline   Reply With Quote
Old 31st March 2012, 11:41   #7
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
erm - NO - should not $$1 - cause it already was treated as text in ""

this one puts "blabla"
code:
;--------------------------------
;Configuration
SetCompressor /SOLID LZMA
ShowInstDetails nevershow
AutoCloseWindow true
OutFile "test.exe"
;--------------------------------
Section ""
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
StrCpy $1 "blabla"
WriteRegStr HKCR "*\$1\command" "" "$\"$1\$1$\" $\"$1$\""
Messagebox MB_OK "Keypress"
DeleteRegKey HKCR "*\$1"
Quit
FunctionEnd
;--------------------------------



with $$1 it puts "$1\$1" "$1" which is wrong.

$$ is used if you want to write the number or string of variable

eg messagebox mb_ok "value $$R9: '$R9'"

similar to \\ in dialogs with input boxes.
Brummelchen is offline   Reply With Quote
Old 31st March 2012, 12:23   #8
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by Brummelchen View Post
$$ is used if you want to write the number or string of variable
Yes, and that's exactly what this thread is about...
MSG is offline   Reply With Quote
Old 31st March 2012, 15:21   #9
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
$1 is a nsis variable - i dont thinks this was purpose.
otherwise typo and it should have been %1 as a context variable of windows
$$1 makes neither nor sense.
Brummelchen 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