Indigo Rose Software
  #1  
Old 10-27-2008
BigGuy BigGuy is offline
Forum Member
 
Join Date: May 2007
Posts: 5
Smile Using Variables to create Registry keys

I am having troubles creating registry keys by using variables. I tried %Var% and the Var = Session.Var %Var% commad to create a var. Nether work They ether make a key as "%VAR% or Var and not the actual componet in the variable. See my Code both ways below. On another note it would have been nice to be able to upload the "*".Lua saved file.

CompanyName2 = SessionVar.Expand("%CompanyName%")
ProductName2 = SessionVar.Expand("%ProductName%")
ProductVer2 = SessionVar.Expand("%ProductVer%")
AppFolder2 = SessionVar.Expand("%AppFolder%")
SerialNumber2 = SessionVar.Expand("%SerialNumber%")
--************************************************** *****
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\CompanyName2");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\CompanyName2\\ProductName2");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\CompanyName2\\ProductName2\\ProductVer2 ");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\CompanyName2\\ProductName2\\ProductVer2 ", "InstallPath", AppFolder2, REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\CompanyName2\\ProductName2\\ProductVer2 ", "Password", SerialNumber2", REG_SZ);
--************************************************** ****
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\%CompanyName%");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\%CompanyName%\\%ProductName%");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\%CompanyName%\\%ProductName%\\%ProductV er%");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\%CompanyName%\\%ProductName%\\%ProductV er%", "InstallPath", AppFolder2, REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\%CompanyName%\\%ProductName%\\%ProductV er%", "Password", SerialNumber2", REG_SZ);
Reply With Quote
  #2  
Old 10-27-2008
Ulrich's Avatar
Ulrich Ulrich is offline
Indigo Rose Staff Member
 
Join Date: Apr 2005
Location: Sao Paulo, Brazil
Posts: 823
This should work:
Code:
CompanyName2 = SessionVar.Expand("%CompanyName%");
ProductName2 = SessionVar.Expand("%ProductName%");
ProductVer2 = SessionVar.Expand("%ProductVer%");
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. CompanyName2);
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. CompanyName2 .. "\\" .. ProductName2);
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. CompanyName2 .. "\\" .. ProductName2 .. "\\" .. ProductVer2);
As should this:

Code:
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. SessionVar.Expand("%CompanyName%"));
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. SessionVar.Expand("%CompanyName%") .. "\\" .. SessionVar.Expand("%ProductName%"));
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\" .. SessionVar.Expand("%CompanyName%") .. "\\" .. SessionVar.Expand("%ProductName%") .. "\\" .. SessionVar.Expand("%ProductVer%"));
Or still:

Code:
Registry.CreateKey(HKEY_LOCAL_MACHINE, SessionVar.Expand("Software\\%CompanyName%"));
Registry.CreateKey(HKEY_LOCAL_MACHINE, SessionVar.Expand("Software\\%CompanyName%\\%ProductName%"));
Registry.CreateKey(HKEY_LOCAL_MACHINE, SessionVar.Expand("Software\\%CompanyName%\\%ProductName%\\%ProductVer%"));
Ulrich

Last edited by Ulrich; 10-27-2008 at 02:31 PM.
Reply With Quote
Reply

Thread Tools
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
set environment variables Adam Setup Factory 8.0 FAQ 0 04-28-2008 12:56 PM
setting variables in registry SF 7.0 dadler1 Setup Factory 7.0 Discussion 3 06-09-2006 03:41 PM
HOWTO: Merge Registry Keys Desmond Setup Factory 6.0 Knowledge Base 0 10-17-2003 10:31 AM
HOWTO: Create a Project Template Support AutoPlay Media Studio 4.0 Examples 0 10-28-2002 02:49 PM
INFO: Setting Environment Variables Support Setup Factory 6.0 Knowledge Base 0 10-10-2002 01:07 PM


All times are GMT -6. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software