static String getBattery_code; static int getBattery() ctex { if (getBattery_code == null) getBattery_code = loadSnippet(isWindows() ? "#2000583" : "#2000582"); String s = backtick(getBattery_code); String x = find(isWindows() ? "EstimatedChargeRemaining=(\\d+)" : "(\\d+)\\.?\\d*%", s); int l = x != null ? Integer.parseInt(x) : 0; if (isLinux() && l == 0) l = 100; ret l; }