Announcement

Collapse
No announcement yet.

Get Appfolder from INI or Registry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get Appfolder from INI or Registry

    Hi there, i try to get and set Appfolder for Setup - but it didn't work if i want

    On Startup it should get a Path from INI File. If INI is not available try it from Registry and if Reg is also not available then use current dir.

    This is what i've tryed...

    Code:
    local mypath = INIFile.GetValue(_WindowsFolder .. "\\myprog.ini", "testpath", "path");
    
         if (error ~=0) or (mypath == "") then
              local mypath = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\MyProg", "path");
    
                   if (error ~=0) or (mypath == "") then
                       local mypath = Folder.GetCurrent( );
                       SessionVar.Set("%Appfolder%", mypath);
                   else
                       SessionVar.Set("%Appfolder%", mypath);
                   end
         else
              SessionVar.Set("%Appfolder%", mypath);
         end

  • #2
    You are not defining the variable error at any point, so you cannot use it in your if statements. Check your logic...

    Ulrich

    Comment


    • #3
      Originally posted by Ulrich View Post
      Check your logic...
      Thx 4 reply Ulrich! A better answer would been "read help carefully" Now i know that return a blank string "" if the value doesn't exist or the action fails...

      Comment

      Working...
      X