列出 Java 环境可用的所有字体名称

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.awt.GraphicsEnvironment;
 
public class ListJavaFonts
{
 
  public static void main(String[] args)
  {
    String fonts[] = 
      GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
 
    for ( int i = 0; i < fonts.length; i++ )
    {
      System.out.println(fonts[i]);
    }
  }
 
}

用 Javascript 控制记事本

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.AppActivate("notepad");
WshShell.Run("notepad", 1, false);
WScript.Sleep(500);
WScript.Sleep(300);
WshShell.SendKeys("1{+}");
WScript.Sleep(150);
WshShell.SendKeys("2");
WScript.Sleep(150);
WshShell.SendKeys("~");
WScript.Sleep(150);
WshShell.SendKeys("*3");
WScript.Sleep(150);
WshShell.SendKeys("~");
WScript.Sleep(250);