ShareShortcuts

Time Elapsed Since Last Charge

Simple tool to check your battery performance over time

cdmoro
Bifurcar “Time Elapsed Since Last Charge”

¿Creaste algo nuevo a partir de este atajo? Compártelo como bifurcación: se convierte en un atajo tuyo, que tú administras, y ambas páginas se enlazan entre sí para que cdmoro reciba el crédito.

  1. 1Obtén el atajo y modifícalo en la app Atajos. Ponle un nombre propio.
  2. 2Compártelo desde la app Atajos y copia el enlace de iCloud.
  3. 3Vuelve aquí, pega el enlace y describe qué es diferente, p. ej., “Se añadió un paso que usa Apple Intelligence para personalizar el texto”.
Descargas
28K
Guardado
1
Acciones
22
Categoría
Calculations
Versión
1.1
Idioma
EN

Vista previa

Simple tool to check your battery performance over time.

V1.1

  • Added estimation of remaining battery time

V1.0

Parameters (they have to be added manually from Battery settings as there's no way to get it):

  • Last time charge date
  • Percentage of last charge (by default is 100 but this shortcut works with any percentage :D)

Novedades

Versión 1.1

Added estimation of remaining battery time

Historial de versiones
1.1 18 de sep. de 2024

Added estimation of remaining battery time

1.0 4 de ene. de 2024

First release

Qué hace

22 acciones
  1. Get Battery Level
  2. Get File
  3. If
  4. Get Dictionary Value
  5. Get Time Between Dates
  6. Calculate Expression
  7. Calculate Expression
  8. Format Number
  9. Text
  10. Choose from Menu
    …
  11. Choose from Menu
    🔢 Set new date
  12. Nothing
  13. Choose from Menu
    ⏏️ Quit
  14. Stop This Shortcut
  15. Ask for Input
    Last charge date & time
  16. Get Time Between Dates
  17. Ask for Input
    Percentage
  18. Dictionary
  19. Save File
  20. Calculate Expression
  21. Text
  22. Show Alert
    …

Ver como código
Beta

Todas las acciones de este atajo escritas en Cherri, un lenguaje de programación para Atajos. Ideal para aprender cómo funciona.

#include 'actions/device'
#define color yellow
#define glyph battery

const BatteryLevel = getBatteryLevel()
const SettingsFile = getFileFromFolder(, "TimeElapsed/settings.json", false)

if SettingsFile {
	const date = SettingsFile['date']
	const SavedHoursSinceLastCharge = rawAction("is.workflow.actions.gettimebetweendates")
	const BatteryConsumed = 100 - ((BatteryLevel*100)/SettingsFile['percentage'])
	const PotentialBatteryTimeLeft = ((100 * SavedHoursSinceLastCharge) / BatteryConsumed) - SavedHoursSinceLastCharge
	const BatteryLeftFormatted = formatNumber(PotentialBatteryTimeLeft)
	const LastTimeHeader = "{SavedHoursSinceLastCharge} hours elapsed since {date}.\n\nYou've consumed {BatteryConsumed}% of your battery!\n\nYou have approximately {BatteryLeftFormatted} hour(s) of battery life left, use it wisely!"
	menu LastTimeHeader {
	item "🔢 Set new date":
		nothing()
	item "⏏️ Quit":
		stop()
	}
}
const LastCharge = prompt("Last charge date & time", "Date and Time")
const HoursSinceLastCharge = rawAction("is.workflow.actions.gettimebetweendates")
const Percentage = prompt("Percentage ", "Number")
const Dictionary = {
	"date": "{LastCharge}",
	"percentage": "{Percentage}"
}
saveFile("TimeElapsed/settings.json", Dictionary, true)
const NewBatteryConsumed = 100 - ((BatteryLevel* 100)/Percentage)
const BatteryMessage = "{HoursSinceLastCharge} hours elapsed since {LastCharge}.\n\nYou've cosumed {NewBatteryConsumed}% of your battery!"
alert("", BatteryMessage)
Abrir en Cherri Playground Descompilado con cherri 2.3.0 (GPL-2.0). Puede que necesite pequeños ajustes antes de compilarse.

Valoraciones y reseñas

Escribe una reseña
–
de 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Aún no hay reseñas. ¡Sé el primero en compartir tu opinión!

Publicidad

Más de cdmoro

Ver todo

También te puede gustar

Ver todo
Publicidad