Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How To Use Only A Portion Of Registry Value


5 replies to this topic

IFRobert

IFRobert
  • Members
  • 11 posts

Posted 06 September 2006 - 00:07

Hi all

I would like to install an app to a similar location as another app. I can do a system search for a registry entry to find folder location. I can assign this to a property. But I only want a portion of the folder location. Say I found "C:\Prog Files\Data\MyApp\", but I would like to use only "C:\Prog Files\Data\" to assign to a property. How can I delete the "MyApp\" part from the system search result so that the install directory will only be "C:\Prog Files\Data\"?

thank you,
Robert

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 06 September 2006 - 06:49

I don't know any easy way, but you can certainly do it with a VBScript. If you will know the exact string value you want removed you can use a simple replace, if not you have to either parse the string and get the location of the last slash minus the trailing one and then to a Left(PositionOfSlash, Len(TheString)).
Regards
-Stein Åsmul

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 06 September 2006 - 06:56

Actually an easier way might be to iterate over each character and store the last position of \ as you move towards the end of the string.
Regards
-Stein Åsmul

IFRobert

IFRobert
  • Members
  • 11 posts

Posted 06 September 2006 - 14:16

Glytzhkof

OK, parsing sounds like the way to go. I can write VBScript but am unfamiliar with how this code would be called. What is the mechanism for calling a piece of VBScript? Would this have connection to a custom action?

thank you, Robert

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 07 September 2006 - 22:16

Yes, you would insert the VBScript as a custom action somewhere after the Costing operations in the InstallExecute sequence. There are samples in the MSI SDK.
Regards
-Stein Åsmul

IFRobert

IFRobert
  • Members
  • 11 posts

Posted 18 September 2006 - 14:57

Thank you for your help Glytzhkof. This post goes with another post: "Alternate Paths Not Being Set". This is what I did: Create a CA that calls a VBscript function. The CA is just before the InallWelcome. The function gets a string value representing a path from the registry using RegDBGetKeyValueEx. Then using StrSub the string is striped down to the need part.