1. Making Font
1. Capturing the desired picture
2. This captures the "Firefox home" four characters, then the color of the text
3. The color consists of three parts, i.e. R G B wherein the r is represented by 00-FF (16 binary) or 0-255 numerical value. The same GB is the same thing. In this case there is a problem of deviation, which requires a deviation to cover all the colors within the deviation.
4. After the deviation will find the font becomes clear, click to extract the lattice, and then define the text name, you can add to the font
2. Use Python to identify text with the font
1. Load Dm.dll
$regsvr the DLL file path
2. Writing a Python script to recognize text using the font
#CODING:GBKImportWIN32COM.CLIENTDM= Win32com.client.Dispatch ('Dm.dmsoft') dm.setdict (0,'C:\dm_soft.txt') dm.usedict (0)"""function Prototype: string Findstrex (X1,y1,x2,y2,string,color_format,sim) parameter definition: X1 Number: The upper-left x-coordinate of the region Y1 shaping number: The upper-left y-coordinate of the region X2 shaping number: The right bottom x-coordinate of the area y2 Number of shapes: the right bottom y-coordinate of the region string string: The string to be found, which can be a combination of strings, such as "Changan | luoyang | Dayan Pagoda", Middle with "|" To split a string Color_format string: A color format string that can contain a newline delimiter, with the syntax "," followed by a split string. You can view the following example. Note that both RGB and HSV formats are supported. SIM Double-precision floating-point number: Similarity, range of 0.1-1.0"""ret= DM. Findstrfaste (0, 0, getsystemmetrics (0), GetSystemMetrics (1),"Firefox homepage","000000-909090", 1.0) ret= Ret.split ("|")ifRet[0] = = U"-1" : Print "Find the word"
3. In addition, you can use the desert to achieve mouse movement, click and so on.
Dm.moveto (x, y) DM. RightClick ()
Make the desert font and use Python to call the Desert Tools method to identify the text