Announcement

Collapse
No announcement yet.

Associating File Types with my application

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

  • Associating File Types with my application

    Hello,

    I was wondering how, using SF, I can set the file type extension for files that are opened by my application (e.g. "*.test"). Within the VS 2005 installer, you just select the "File Types" tab and create it directly, setting the icon and extension. How do I do this in SF? Thank you.

    Vijay

  • #2
    Hello,

    there is currently no built-in function for registering file associations, but you can register them manually while installing you application, creating entries in the HKCR hive.

    Ulrich

    Comment


    • #3
      Thanks, Ulrich. I've searched online for examples on how best to do this but have found conflicting information. Is there an example of doing it in Setup Factory that you can show me or point me to? Thank you.

      Vijay

      Comment


      • #4
        Originally posted by vdurbal View Post
        Hello,

        I was wondering how, using SF, I can set the file type extension for files that are opened by my application (e.g. "*.test"). Within the VS 2005 installer, you just select the "File Types" tab and create it directly, setting the icon and extension. How do I do this in SF? Thank you.

        Vijay
        Here's some code from my toolkit:

        Code:
          function File.SetAssocation(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.RemoveAssocation(cExt)
            -- Set the file association for the given file.
          	local cKey = Registry.GetValue(HKEY_CLASSES_ROOT, cExt,"")
          	Registry.DeleteValue(HKEY_CLASSES_ROOT, cExt, "");
          	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey, "");
          	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\DefaultIcon", "");
          	Registry.DeleteValue(HKEY_CLASSES_ROOT, cKey.."\\shell\\open\\command", "");
          end

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎