Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Trigger/Alias Editing Font

Trigger/Alias Editing Font

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by VBMeireles   Brazil  (47 posts)  Bio
Date Thu 16 Sep 2010 07:52 PM (UTC)
Message
I'm trying to change the fixed-width font used in trigger/alias/etc editing and I've found the following topics on the subject.

http://www.gammon.com.au/forum/?id=8058
http://www.gammon.com.au/forum/?id=8059

Has any in-program option to change that been implemented since then or is the change to the registry still the only solution?

Thanks!

Vinícius
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 16 Sep 2010 09:50 PM (UTC)

Amended on Thu 16 Sep 2010 11:28 PM (UTC) by Nick Gammon

Message
No, and it doesn't use the Registry any more. It has a "preferences database".

A fairly simple way of editing that, is to download the Sqlite "Browser" program.


  • Download and install:

    http://sourceforge.net/projects/sqlitebrowser/

  • Type Ctrl+I to open the Immediate scripting window and then enter this:

    
    print (GetInfo (82))
    


  • Hit the Run button and you should see the pathname of your preferences database echoed in the output window.

  • Close MUSHclient, otherwise it may put things back again

  • Open the program "SQLite Database Browser", and use File menu -> Open Database to open your preferences database, probably in this location (but whatever was shown in the step above):

    
    C:\Program Files\MUSHclient\mushclient_prefs.sqlite
    


  • Click on the Browse Data tab

  • Click on the Table combo-box and select "prefs" table.

  • Make the columns a bit wider (drag the divider line) and scroll down to "FixedPitchFont"



  • Double-click the font (FixedSys) and then change in the box that pops up to the font you want (eg. Dina)



  • Hit Apply Changes button

  • Click the Save Changes button (floppy disk icon) or use the File menu -> Save Database.

  • Close the SQLite Database Browser so the database is no longer in use.


Now you can re-open MUSHclient and the font should be changed when editing aliases etc.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 16 Sep 2010 10:48 PM (UTC)
Message
To save some of that mucking around, I have written a plugin that lets you change the options totally from within the client.

Template:saveplugin=Global_Option_Updater To save and install the Global_Option_Updater plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Global_Option_Updater.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Global_Option_Updater.xml (which you just saved in step 3) as a plugin
  7. Click "Close"



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Global_Option_Updater"
   author="Nick Gammon"
   id="1204316574ebc1d41d7011b3"
   language="Lua"
   purpose="Shows / changes global options"
   date_written="2010-09-17 08:28:51"
   requires="4.50"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Usage:

list_global_options       --> list all valid option names
show_global_option x      --> displays value of option
change_global_option x y  --> changes value of option x to y


eg.

show_global_option FixedPitchFont

change_global_option FixedPitchFont Dina

After changing an option you should exit the client and re-open it, otherwise
if you use the GUI interface (global preferences) it may put the option back again.

]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   match="change_global_option * *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
  
-- open preferences database
local db = assert (sqlite3.open (GetInfo (82)))
local value = nil

-- see if this key already exists (if not, probably spelling error)
for a in db:nrows "SELECT * FROM prefs WHERE name = '%1'" do
  value = a.value
end  -- for

-- if found, modify it
if value then

  if db:execute ("UPDATE prefs SET value = '%2' WHERE name = '%1'") ~= sqlite3.OK then
    ColourNote ("red", "", "Unable to modify preferences: " .. db:errmsg ())
  else
    if value ~= "%2" then
      ColourNote ("cyan", "", "Item '%1' changed from '" .. value .. "' to '%2'")
    else
      ColourNote ("cyan", "", "No change required, value of '%1' is already '%2'")
    end -- if
  end -- if updated OK

else
  ColourNote ("red", "", "Item '%1' is not in preferences database")
end -- does not exist

db:close()

</send>
  </alias>
  
  <alias
   match="show_global_option *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
  
-- open preferences database
local db = assert (sqlite3.open (GetInfo (82)))
local value = nil

-- find the item
for a in db:nrows "SELECT * FROM prefs WHERE name = '%1'" do
  value = a.value
end  -- for

-- if found, display it
if value then
  ColourNote ("cyan", "", "Item '%1' has value '" .. value .. "'")
else
  ColourNote ("red", "", "Item '%1' is not in preferences database")
end -- does not exist

db:close()

</send>
  </alias>

 <alias
   match="list_global_options"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
  
  -- open preferences database
local db = assert (sqlite3.open (GetInfo (82)))

ColourNote ("cyan", "", "Global Options")
ColourNote ("cyan", "", string.rep ("-", 40))

-- show all
for a in db:nrows "SELECT * FROM prefs ORDER BY name" do
 ColourNote ("cyan", "", a.name)
end  -- for

ColourNote ("cyan", "", string.rep ("-", 40))

db:close()

</send>
  </alias>
    
</aliases>

<script>

-- show help
ColourNote ("cyan", "", GetPluginInfo (GetPluginID (), 3))

</script>

</muclient>


This plugin implements three aliases. First you might type:


list_global_options


You will see something like this:


Global Options
----------------------------------------
ActivityButtonBarStyle
ActivityWindowRefreshInterval
ActivityWindowRefreshType
...
FixedFontForEditing
FixedPitchFont
FixedPitchFontSize
FlatToolbars
...
WordDelimitersDblClick
WorldList
----------------------------------------


That gives you the names of each option (note, they *are* case-sensitive).

Then you can display one:


show_global_option FixedPitchFont


That would show, for example:


Item 'FixedPitchFont' has value 'FixedSys'


Assuming that looks like the one you want to change, you can now change it:


change_global_option FixedPitchFont Dina


And you get confirmation:


Item 'FixedPitchFont' changed from 'FixedSys' to 'Dina'


Then I recommend you close the client and re-open it. Otherwise if you use the GUI "global preferences" it may put the preferences back from what it had stored in memory. Also, this only changes the database, not the in-memory copy. Thus you need to exit the client and restart it, to have it read the database back in.

Note that this makes no validation of the values you supply, so if you put in something ridiculous (eg. a font that doesn't exist, or a value out of range for a numeric option) then the behaviour is not defined.

If you totally stuff up your global preferences, simply delete the global preferences file (file name given in earlier post) and it will recreate it with default values.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by VBMeireles   Brazil  (47 posts)  Bio
Date Reply #3 on Fri 17 Sep 2010 02:50 AM (UTC)
Message
Awesome! Thank you! :)

Vinícius
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,445 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.