Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function File.SetAssociation(cExt, cExe, cIcon, cShort,cLong)
- 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
- --[[ Example:
- File.SetAssociation(".test1234", _SourceFolder.."\\autorun.exe", _SourceFolder.."\\autorun.exe", "test", "test1243");
- TextFile.WriteFromString(_DesktopFolder.."\\test.txt", "Hello, world.", false);
- Crypto.BlowfishEncrypt(_DesktopFolder.."\\test.txt", _DesktopFolder.."\\test.test1234", "test1234");
- File.Delete(_DesktopFolder.."\\test.txt", false, false, false, nil);
- ]]
- function File.RemoveAssociation(cExt, cShort)
- local cKey = cShort..".Document";
- Registry.DeleteKey(HKEY_CLASSES_ROOT, cExt);
- Registry.DeleteKey(HKEY_CLASSES_ROOT, cKey);
- end
- --[[ Example:
- File.RemoveAssociation(".test1234", "test");
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement