|
|
|
|
#1 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
Help needed
I'm having little trouble with my install script and I'm wishing that maybe some of you guys could help me with this:
Okay, what I'm trying to do here is to detect winamp2 to $1 and Winamp3 to $2 ReadRegStr $1 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \ "UninstallString" ReadRegStr $2 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" \ "UninstallString" These sets wa2 (if exists) to $1 & wa3 (if exists) to $2, right. because we get the path in file format (...\winamp(3)\uninstall.exe) I need to get that file stripped, and here's where I have problems. With what function I could erase the letter from both, $1 & $2, one by one until the last letter would be different ? Or with what function, I could erase letter from both , $1 & $2, one by one until the first ' \ ' mark comes ? |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Use GetFileName here:
http://nsis.sourceforge.net/archive/...ances=0,11,211 That will get the uninstall.exe part, whether it is uninstall.exe or not. -Stu |
|
|
|
|
|
#4 |
|
Debian user
(Forum King) Join Date: Jan 2003
Location: Arch land
Posts: 4,917
|
I'll be cool as feature to create variables to detect Winamp 2
and Winamp 3. For example: $INSTDIR means the installation directory, right? So code: * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE. * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE. |
|
|
|
|
|
#5 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
You can detect it using a function, so that won't be addded (it will increase the overhead).
|
|
|
|
|
|
#6 | |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
Quote:
It's still not clear to me how the stripping does work, with what function I can erase for example 9 last letters from the path ? |
|
|
|
|
|
|
#7 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
StrCpy supports negative values for the lenght (so you can cut off chars).
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
okay let's imagine that $1 would point to C:/something/word.exe
Let's say that I'd like to get the file out and copy it to $2, would this work? StrCpy $2 $1 -8 or is it more complicate than that? |
|
|
|
|
|
#9 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
Use start_offset, not maxlen.
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
um....
/me is confused. me don't understand Please give me example how it works, and maybe I'll figure it out then..
|
|
|
|
|
|
#11 |
|
Major Dude
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
|
What Joost is saying relates to the documentation for StrCpy. The syntax is
so he is saying you need to make use of the start_offset parameter and not the maxlen parameter. This is because in your example rather than getting the file you'd actually get the path, e.g. 'C:/something/' instead of 'word.exe'.code: You need to do :- code: One thing I realised working this out is that you can't do this :- i.e. I was trying to say copy all characters from position 13, bit of a shame that.code: |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
That makes sense, thanks man , I really appreciate
|
|
|
|
|
|
#13 |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
Try this to copy all characters from position 13:
code: |
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
Function stripwa2
StrLen $3 $1 IntOp $4 $3 - 13 StrCpy $2 $1 $3 $4 functionEnd I tried this like you told (used $2 in SetOutPath) but it gave me the file ( uninst.exe\plugins\blahblah ) that's what I wanted to cut off from the path ![]() I'm sure, you can easily change that by changing some positions of $1-$4 but after trying to figure it out long enough, I thought to leave it to you smarter guys
|
|
|
|
|
|
#15 |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
If I understand the problem correctly, the uninstall string from the registry for Winamp2 looks like this:
code: and you want to extract just the part of the string.code: One way to do this is to cut off the last 22 characters and cut off the first character ("), as follows: code: If the Winamp3 uninstall string is "x:\blah blah blah\winamp3.exe" /UNINSTALL then you have to cut off 23 characters instead of 22. Hope this helps. |
|
|
|
|
|
#16 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I see that there are no "\" characters until you reach "x:\blah blah blah\" in the string.
You can therefore use the GetParent function (on the NSIS Archive) and then use my GetFileName function after that. -Stu |
|
|
|
|
|
#17 |
|
Senior Member
Join Date: Dec 2001
Location: .fi
Posts: 155
|
ok, now it works perfect !
Thanks again guys !
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|