Reset original value about:config firefox via javascript or imacros












0















I need to reset value in Firefox about:config with Javascript or imacros.



I found Javascript code that is compatible with imacros to set value in about:config via Javascript.



To set the value in about:config I use this code:



iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1"); 
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("pdfjs.disabled", true);
prefs.setIntPref("browser.download.folderList", 2);
prefs.setCharPref("browser.download.dir", "C:\");


Now I want to know if there exists a similar solution to reset the value to return with original values.



enter image description here



Thanks










share|improve this question





























    0















    I need to reset value in Firefox about:config with Javascript or imacros.



    I found Javascript code that is compatible with imacros to set value in about:config via Javascript.



    To set the value in about:config I use this code:



    iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1"); 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
    prefs.setBoolPref("pdfjs.disabled", true);
    prefs.setIntPref("browser.download.folderList", 2);
    prefs.setCharPref("browser.download.dir", "C:\");


    Now I want to know if there exists a similar solution to reset the value to return with original values.



    enter image description here



    Thanks










    share|improve this question



























      0












      0








      0








      I need to reset value in Firefox about:config with Javascript or imacros.



      I found Javascript code that is compatible with imacros to set value in about:config via Javascript.



      To set the value in about:config I use this code:



      iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1"); 
      var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
      prefs.setBoolPref("pdfjs.disabled", true);
      prefs.setIntPref("browser.download.folderList", 2);
      prefs.setCharPref("browser.download.dir", "C:\");


      Now I want to know if there exists a similar solution to reset the value to return with original values.



      enter image description here



      Thanks










      share|improve this question
















      I need to reset value in Firefox about:config with Javascript or imacros.



      I found Javascript code that is compatible with imacros to set value in about:config via Javascript.



      To set the value in about:config I use this code:



      iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1"); 
      var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
      prefs.setBoolPref("pdfjs.disabled", true);
      prefs.setIntPref("browser.download.folderList", 2);
      prefs.setCharPref("browser.download.dir", "C:\");


      Now I want to know if there exists a similar solution to reset the value to return with original values.



      enter image description here



      Thanks







      javascript firefox reset imacros






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 21:25









      Robert

      2,15062535




      2,15062535










      asked Nov 23 '18 at 16:01









      placidomaioplacidomaio

      447




      447
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Let me describe the idea below:



          // This part is unnecessary
          // iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1");

          var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
          var originalValue = prefs.getCharPref("browser.download.dir");
          prefs.setCharPref("browser.download.dir", "C:\");

          // do something useful here

          prefs.setCharPref("browser.download.dir", originalValue);


          Hope my code is clear enough.






          share|improve this answer
























          • This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

            – placidomaio
            Nov 25 '18 at 20:51











          • I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

            – placidomaio
            Nov 25 '18 at 21:11





















          0














          The solution is this




          var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
          prefs.clearUserPref("layout.css.devPixelsPerPx");




          prefs.clearUserPref is the code to reset firefox about:config value change "layout.css.devPixelsPerPx" with the voice to reset.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449756%2freset-original-value-aboutconfig-firefox-via-javascript-or-imacros%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Let me describe the idea below:



            // This part is unnecessary
            // iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1");

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            var originalValue = prefs.getCharPref("browser.download.dir");
            prefs.setCharPref("browser.download.dir", "C:\");

            // do something useful here

            prefs.setCharPref("browser.download.dir", originalValue);


            Hope my code is clear enough.






            share|improve this answer
























            • This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

              – placidomaio
              Nov 25 '18 at 20:51











            • I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

              – placidomaio
              Nov 25 '18 at 21:11


















            0














            Let me describe the idea below:



            // This part is unnecessary
            // iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1");

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            var originalValue = prefs.getCharPref("browser.download.dir");
            prefs.setCharPref("browser.download.dir", "C:\");

            // do something useful here

            prefs.setCharPref("browser.download.dir", originalValue);


            Hope my code is clear enough.






            share|improve this answer
























            • This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

              – placidomaio
              Nov 25 '18 at 20:51











            • I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

              – placidomaio
              Nov 25 '18 at 21:11
















            0












            0








            0







            Let me describe the idea below:



            // This part is unnecessary
            // iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1");

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            var originalValue = prefs.getCharPref("browser.download.dir");
            prefs.setCharPref("browser.download.dir", "C:\");

            // do something useful here

            prefs.setCharPref("browser.download.dir", originalValue);


            Hope my code is clear enough.






            share|improve this answer













            Let me describe the idea below:



            // This part is unnecessary
            // iimPlayCode("URL GOTO=about:confign WAIT SECONDS=1");

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            var originalValue = prefs.getCharPref("browser.download.dir");
            prefs.setCharPref("browser.download.dir", "C:\");

            // do something useful here

            prefs.setCharPref("browser.download.dir", originalValue);


            Hope my code is clear enough.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 24 '18 at 19:16









            ShugarShugar

            4,904159




            4,904159













            • This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

              – placidomaio
              Nov 25 '18 at 20:51











            • I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

              – placidomaio
              Nov 25 '18 at 21:11





















            • This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

              – placidomaio
              Nov 25 '18 at 20:51











            • I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

              – placidomaio
              Nov 25 '18 at 21:11



















            This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

            – placidomaio
            Nov 25 '18 at 20:51





            This solution don't solve the problem because to set some value in about:config necessary to add a string and to be return to original value need to be reset this value. This is an example: to edit oscpu on firefox must use this command prefs.setCharPref("general.oscpu.override", "Linux"); but to remove this customization is necessary to reset "general.oscpu.override" and after restarting firefox "general.oscpu.override" wll be deleted automatically from firefox and the settings return with original values. With prefs.setCharPref you can add/edit value but not reset value. Thanks for your idea

            – placidomaio
            Nov 25 '18 at 20:51













            I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

            – placidomaio
            Nov 25 '18 at 21:11







            I tryed to edit the value with a blank value example prefs.setCharPref("general.oscpu.override", ""); but this do not reset the value and after restarting firefox do not remove the value "general.oscpu.override" and remain setted cpu without value "" not with original default value extracted from the pc. Some values in about:config will be calculate automatically and can edit adding string like "general.oscpu.override" and to return original value need to reset and the the "override" string added.

            – placidomaio
            Nov 25 '18 at 21:11















            0














            The solution is this




            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            prefs.clearUserPref("layout.css.devPixelsPerPx");




            prefs.clearUserPref is the code to reset firefox about:config value change "layout.css.devPixelsPerPx" with the voice to reset.






            share|improve this answer




























              0














              The solution is this




              var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
              prefs.clearUserPref("layout.css.devPixelsPerPx");




              prefs.clearUserPref is the code to reset firefox about:config value change "layout.css.devPixelsPerPx" with the voice to reset.






              share|improve this answer


























                0












                0








                0







                The solution is this




                var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
                prefs.clearUserPref("layout.css.devPixelsPerPx");




                prefs.clearUserPref is the code to reset firefox about:config value change "layout.css.devPixelsPerPx" with the voice to reset.






                share|improve this answer













                The solution is this




                var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
                prefs.clearUserPref("layout.css.devPixelsPerPx");




                prefs.clearUserPref is the code to reset firefox about:config value change "layout.css.devPixelsPerPx" with the voice to reset.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 28 '18 at 20:01









                placidomaioplacidomaio

                447




                447






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449756%2freset-original-value-aboutconfig-firefox-via-javascript-or-imacros%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Berounka

                    Sphinx de Gizeh

                    Different font size/position of beamer's navigation symbols template's content depending on regular/plain...