Old 25th May 2002, 15:03   #1
weidhas
Junior Member
 
Join Date: May 2002
Posts: 2
2 Reg Keys, 1 Install Dir

hi!

i want to search for reg key A und reg key B. when the one of these keys is found it should be the install dir.

i tried it with

InstallDirRegKey ...
InstallDirRegKey ...

but it don't work

...
weidhas is offline   Reply With Quote
Old 25th May 2002, 16:16   #2
Smile2Me
Guest
 
Posts: n/a
Do something like this:
code:
function .onInit
ReadRegStr $0 [RegAddress_A]
StrCmp $0 "" 0 Found
ReadRegStr $0 [RegAddress_B]
StrCmp $0 "" NotFound
Found:
StrCpy $INSTDIR $0
...
NotFound:
...
functionend

-Hendri.
  Reply With Quote
Old 26th May 2002, 15:25   #3
weidhas
Junior Member
 
Join Date: May 2002
Posts: 2
mh

it doesn't work

perhaps an example would help ...

- christoph
weidhas is offline   Reply With Quote
Old 26th May 2002, 16:54   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
What error does it give you?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 26th May 2002, 17:22   #5
veekee
Senior Member
 
Join Date: Mar 2002
Location: France / Paris
Posts: 138
I'ld have written ...

function .onInit
ReadRegStr $0 [RegAddress_A]
ReadRegStr $1 [RegAddress_B]
Quote:
; if $0 and $1 are null -> goto notfound else continue
StrCmp $0 $1 NotFound 0
Quote:
; (we dunno which one is the right one)
; so if $0 is empty, copy $1 (which is not) into $0
StrCmp $0 "" 0 Continue
StrCpy $0 $1
Quote:
; now $0 has got the right path
...

NotFound:
...

functionend
veekee is offline   Reply With Quote
Old 26th May 2002, 17:23   #6
veekee
Senior Member
 
Join Date: Mar 2002
Location: France / Paris
Posts: 138
.. sorry, i forgot a label !


StrCmp $0 "" 0 Continue
StrCpy $0 $1
Continue:

veekee is offline   Reply With Quote
Old 26th May 2002, 18:00   #7
Smile2Me
Guest
 
Posts: n/a
veekee, my code works fine.
weidhas, an example? The code supplied already was an example. But ok.
code:
outfile 2regs.exe
name 2regs

function .onInit
; Make sure we have a regentry
WriteRegStr HKLM "Software\2regs" "dir" "c:\My docs"

; Now check the regentries as if
; we don't know the info above
ReadRegStr $0 HKLM "Software\skjgllfsg" "dir"
StrCmp $0 "" 0 Found
ReadRegStr $0 HKLM "Software\2regs" "dir"
StrCmp $0 "" NotFound
Found:
StrCpy $INSTDIR $0 ; So $INSTDIR contains install dir
MessageBox MB_OK $INSTDIR
Goto Continue
NotFound:
MessageBox MB_OK "No regsettings found!"
Continue:
functionend

section
DeleteRegKey HKLM "Software\2regs"
sectionend

-Hendri.
  Reply With Quote
Old 26th May 2002, 18:11   #8
veekee
Senior Member
 
Join Date: Mar 2002
Location: France / Paris
Posts: 138
Apologizes

Sure, your code works ! I didn't understood the first time i read it ! I beg your pardon, dear Smile2Me....

Bad veekee, bad !
veekee is offline   Reply With Quote
Old 27th May 2002, 06:24   #9
Smile2Me
Guest
 
Posts: n/a
Veekee, it's OK.

-Hendri.
  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