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; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
1172 | stefan | Doesn't work for Windows yet... process hangs (?) | 2015-11-16 21:11:48 |
Snippet ID: | #1000735 |
Snippet name: | getBattery (Linux working. Windows not yet) |
Eternal ID of this version: | #1000735/4 |
Text MD5: | c633fd7822d48a9d352ac0f50a724b4c |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-21 14:13:32 |
Source code size: | 615 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 1167 / 1374 |
Version history: | 3 change(s) |
Referenced in: | [show references] |