Zohar

How to Change a Setting in Firefox, Without Using the GUI

15 posts in this topic

#1 ·  Posted (edited)

Hi

 

If you open Firefox, and enter in the URL Field:  about:config

You will see many settings that you can edit.

 

One of them for example is:

gfx.downloadable_fonts.enabled

This is a boolean setting that tells firefox whether to download custom fonts that a website want the browser to download, or not.

 

How can I change this setting programmatically, without automating the GUI?

 

So I can turn this setting On and Off, without seeing the GUI for the settings all the time...

 

I hope it's pssible

 

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites



I do not have FF installed on this computer but the settings are usually in the registry or in a settings file.

I just do a compare before/after the change to see what changed and then script it.

 

https://support.mozilla.org/en-US/questions/965842

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I've found most of the settings I need to change are in the prefs.js file in each Firefox users profile.

I've had great success with this script: https://www.autoitscript.com/forum/topic/169753-firefox-configuration

Hope this helps,

-Mike

Update: Using the above script, this command allowed me to change from true to false...I assume the method to toggle back is obvious. 

_FF_Config("gfx.downloadable_fonts.enabled", false)

Make sure you quit Firefox before attempting to make the change.

Edited by mdwerne
Adding solution...
1 person likes this

Share this post


Link to post
Share on other sites

Hi ViciousXUSMC and mdwerne

 

Thank you both for this solution,

it will indeed work, and it's indeed programmatic and not via GUI,

however since it messes with the config file, it is a disadvantage,

since if the user changes other settings via the GUI, then they will be overridden by the file that we write.

(that's why it's emphasized in the _FF_Config() function to close Firefox first..)

 

Anther disadvantage of messing with the config file, is that the change will only happen after firefox is opened again.

 

For these reasons,I am looking for a programmatic way which uses some Object Model that Firefox provides (hopefully),

and which allows changing a setting..

.

Is there a chance that there is some?

 

Share this post


Link to post
Share on other sites

The pref.js file IS the programmatic way to configure FireFox. You only have to do it once, and before FF is opened. You could do it by including it in the StartUp folder to have it run on log in.

The changes a user makes to FF that shows in about:config should be in one of the prefs.js files and your script can read these files prior to writing to them to make sure you're not changing a user setting.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you BrewManNH,

but as I asked in the last post, If there is an Object Model that we can use,

it will be a better method of achieving it.

 

I do hope Firefox exposed an Object Model..

Share this post


Link to post
Share on other sites

you could set it globally in Mozilla.cfg
which is stored in the same directory as firefox.exe

just add this line, and it's set for all users

pref("gfx.downloadable_fonts.enabled", false);
 

Share this post


Link to post
Share on other sites

Also the link I gave shows how to lock preferences and have user.js set preferences at startup so no need to have issues with closing FF first.  

You really have quite a few options here, all of them quite valid and easy to implement. 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

pcjunki,

but I don't want just to set uit once and for all..

I want to be able to togle it on and off when ever needed.

(usually it's off, and on some occasions I want to temporarily turn it on).

 

BTW,

maybe there's a way to change Firefox's settings via command line?

 

It's amazing how little firefox did, regarding automation for the browser..

 

For example, to automate webpages, one needs to install the MozRepl add-in..

You would expect that such a feature would be available built-in..

I like Firefox, but in terms of automation it's extremely disappointing

Edited by Zohar

Share this post


Link to post
Share on other sites

you can toggle it on off,

pref("gfx.downloadable_fonts.enabled", false);

or

pref("gfx.downloadable_fonts.enabled", true);

Share this post


Link to post
Share on other sites

yes I know

but using what you said (setting it globally in Mozilla.cfg file) still has the disadvantages that I wrote earlier..

Share this post


Link to post
Share on other sites

Have you tried modifying the prefs.js or mozilla.cfg file while FF was running? Does it change anything you're trying to change?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Seems to me like you're not interested in anything anyone has to say, I'm wondering why your question was not just "Does FF expose COM methods?"

It does not, there would be a UDF that uses it easily found if it did.

For example, to automate webpages, one needs to install the MozRepl add-in

So why not just do that?

1 person likes this

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

@Zohar : applying changes in prefs.js or mozilla.cfg seems to be the only way to change the Firefox configuration. You can edit mozilla.cfg even if Firefox is open, but all changes require a restart of the application to be applied.

 

Share this post


Link to post
Share on other sites

Seems to me like you're not interested in anything anyone has to say, I'm wondering why your question was not just "Does FF expose COM methods?"

I am very much interested in what everyone has to say,

but not all solutions will fit..

Not choosing a solution doesn't mean I am not interested in what people have to say..

 

    It does not, there would be a UDF that uses it easily found if it did.

Yeah, I begin to understand there isn't another way..

Sad :)

 

@Zohar : applying changes in prefs.js or mozilla.cfg seems to be the only way to change the Firefox configuration.

You can edit mozilla.cfg even if Firefox is open, but all changes require a restart of the application to be applied.

Thank you jguinch,

Since it's the only way, then I will use it, and close FF before changing anything..

 

Thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now