static S getBattery_code; sbool getBattery_debug; static int getBattery() ctex { if (getBattery_code == null) getBattery_code = loadSnippet(isWindows() ? "#2000583" : "#1008531"); backtick_uninterruptable.set(true); String s = backtick(getBattery_code); backtick_uninterruptable.set(null); if (getBattery_debug) print("getBattery >> " + quote(s)); String x = find(isWindows() ? "EstimatedChargeRemaining=(\\d+)" : "(\\d+)\\.?\\d*%", s); if (getBattery_debug) print("getBattery >> " + x); int l = x != null ? Integer.parseInt(x) : 0; if (isLinux() && l == 0) l = 100; ret l; }