Advertisement
sarumeister

Untitled

May 28th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.72 KB | None | 0 0
  1. procedure RegisterFirefoxAddon();
  2. var
  3.   Value: String;
  4.   CmdFirefox: String;
  5.   PathXpi: String;
  6.   ResultCode: Integer;
  7.   StrLen, StrPos: Integer;
  8. begin                                  
  9.   if RegValueExists(HKEY_CLASSES_ROOT, 'Applications\firefox.exe\shell\open\command', '') then
  10.   begin
  11.     RegQueryStringValue(HKEY_CLASSES_ROOT, 'Applications\firefox.exe\shell\open\command', '', Value);
  12.     StrLen := Length(Value);
  13.     CmdFirefox := Copy(Value, 2, StrLen - 1);
  14.     StrPos := Pos('"', CmdFirefox);
  15.     CmdFirefox := Copy(CmdFirefox, 1, StrPos - 1);
  16.     PathXpi := '"' + ExpandConstant('{userappdata}\addon-1.0.0.0-fx.xpi') + '"';    
  17.     Exec(CmdFirefox, PathXpi, '', SW_SHOW, ewNoWait, ResultCode);
  18.   end;
  19. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement