Announcement

Collapse
No announcement yet.

Help to associate extension with exe

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

  • Ulrich
    replied
    Please post your project file here, or attach it when you open a technical support ticket.

    Ulrich

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    When I click on file property - Icon shown, but in Windows explorer not in any mode.

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    Icon not associated

    Icon not associated with my *.GBL extension.

    Leave a comment:


  • Ulrich
    replied
    You can place the function definitions into the "Global Functions". The association would set in the "On Post Install" script, and the association would typically be removed in the "On Pre Uninstall" script.

    Ulrich

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    No icon associated with file.

    Code set value:
    C:\GBLIGH~1\GBLIGH~1.EXE,0
    Is it correct?

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    Ok.
    Where is better to put this functions?
    Where is better to call this functions?

    Please, give me detailed instructions.

    Leave a comment:


  • Ulrich
    replied
    You need to insert the quote on line 2, near "%", as the error message tells you.

    Ulrich

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    Where to insert quote?

    Leave a comment:


  • Ulrich
    replied
    Insert the missing quote. You are welcome.

    Ulrich

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    Code does not work!

    This code does not work in SUF
    Syntax Error, Line=2 unexpected symbol near '%'

    Leave a comment:


  • Ulrich
    replied
    Josh has posted Lua code for registering a file association in these forums. Here is a slightly modified version:

    Code:
    cExt = ".sf8";
    cExe = SessionVar.Expand("%AppFolder%\\application.exe"); -- program to open the file
    cIcon = SessionVar.Expand("%AppFolder%\\application.exe"); -- could also be a path to an icon
    cShort = "MyFile"; -- this will build "MyFile.Document" (cKey), the short description in registry
    cLong = "My Application Document"; -- the long description
    
    
    function File.SetAssociation(cExt, cExe, cIcon, cShort,cLong)
        -- Set the file association for the given file.
        local cKey = cShort..".Document";
    
        Registry.SetValue(HKEY_CLASSES_ROOT, cExt, "", cKey);
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey, "",cLong);
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon","",File.GetShortName(cIcon)..",0");
        Registry.SetValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "", "\""..cExe.."\" \"%1\"");
    end
    
    function File.RemoveAssociation(cExt)
      -- Remove the file association for the given file.
      local cKey = Registry.GetValue(HKEY_CLASSES_ROOT, cExt,"");
        
      if (cExt ~= "") then
        Registry.DeleteValue(HKEY_CLASSES_ROOT, cExt, "");
        if (cKey ~= "") then
          Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon", "");
          Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "");
          Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey, "");
        else
          SetupData.WriteToLogFile("Error\tFile extension '" .. cExt .. "' is unregistered!\r\n", true);
        end
      else
        SetupData.WriteToLogFile("Error\tCannot delete association for empty file extension!\r\n", true);
      end
    end
    Ulrich
    Last edited by Ulrich; 05-27-2014, 09:42 AM.

    Leave a comment:


  • smalkin@gbtriz.com
    replied
    In registry: GBLight/shell/open/command/
    C:\GBLightSP\GBLightSP.exe\"%1"
    To normally associate file it shod be:
    "C:\GBLightSP\GBLightSP.exe" "%1"
    but SUF not give me ability to do that.

    Leave a comment:


  • smalkin@gbtriz.com
    started a topic Help to associate extension with exe

    Help to associate extension with exe

    I use the following in Post install action:
    Registry.SetValue(HKEY_CLASSES_ROOT, ".gbl", "", "GBLight", REG_SZ);
    Registry.SetValue(HKEY_CLASSES_ROOT, "GBLight\\shell\\open\\command", "",SessionVar.Expand("%AppFolder%\\GBLightSP.exe\\ \"%1\""), REG_SZ)
    Registry.SetValue(HKEY_CLASSES_ROOT, "GBLight\\DefaultIcon", "", SessionVar.Expand("%AppFolder%\\LogoLight.ico,0"), REG_SZ);

    EXE not accosiated nad file not associated with Icon.
Working...
X