Ayse Ayse - 1 year ago 130
Python Question

Python version of AddFontResource()

I'm currently trying to install fonts across a bunch of servers. I've been able to use a script to copy the fonts over and "install" them onto the server but I need to be able to access the fonts without having to turn off the server or log off the account.

I found Windows

which is done using C++, but is there an equivalent function in Python or Powershell?

(I've been using Python and Powershell to do checks and installations.)

Answer Source

Have you tried using the win32api library? It has the SendMessage() function which can be used in conjunction with the windll.gdi32.AddFontResource() in ctypes

For example installing a TTF font file:

import win32api
import ctypes
import win32con

win32api.SendMessage(win32con.HWND_BROADCAST, win32con.WM_FONTCHANGE)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download