ShareShortcuts

Log Water

Did you know that approximately 80% of Americans don’t get enough water every day?

gutlessbubble96
Создать форк «Log Water»

Создали что-то новое на основе этой команды? Поделитесь ей как форком: она станет вашей собственной командой, которой вы управляете, а обе страницы будут ссылаться друг на друга, чтобы gutlessbubble96 получил(а) признание.

  1. 1Получите команду и измените её в приложении «Быстрые команды». Дайте ей собственное название.
  2. 2Поделись ею из приложения «Быстрые команды» и скопируй ссылку iCloud.
  3. 3Вернись сюда, вставь ссылку и опиши, что изменилось, например: «Добавлен шаг, который использует Apple Intelligence для персонализации текста».
Загрузки
56K
Сохранено
2
Действия
48
Категория
Productivity
Версия
1.2
Язык
EN

Просмотр

Did you know that approximately 80% of Americans don’t get enough water every day? Time to do something about it! Set a goal and the app will let you know how close you are to smashing it! All entries are saved to your Apple Health app.

Что нового

Версия 1.2

Streamlined file system creation by 2 lines. Also, fixed duplicate / empty data entries in Apple Health

История версий
1.2 17 янв 2021 г.

Streamlined file system creation by 2 lines. Also, fixed duplicate / empty data entries in Apple Health

1.0 3 янв 2021 г.

First release

Что делает

Действий: 48
  1. Comment
    Welcome to water log created by GutlessBubble96 Version log: 1.02 - streamlined file system creation by 2 lines. 1.01 - fixed duplicate / empty data entries 1.0 - original version
  2. Comment
    Creates file system for water goal (leaves it alone if one already exists)
  3. Get File
  4. If
  5. Set Variable
    Water goal
  6. Nothing
  7. If
  8. Create Folder
  9. Ask for Input
    What is your water goal in oz? (Recommended amount is half of body weight in oz)
  10. Set Variable
    Water goal
  11. Save File
  12. List
  13. Choose from List
  14. If
  15. Ask for Input
    What is your water goal in oz? (Recommended amount is half of body weight in oz)
  16. Set Variable
    Water goal
  17. Save File
  18. List
  19. Choose from List
  20. If
  21. Ask for Input
    How many ounces did you drink?
  22. If
  23. Log Health Sample
  24. If
  25. If
  26. Get Numbers from Input
  27. If
  28. Log Health Sample
  29. If
  30. Ask for Input
    How many ounces did you drink?
  31. If
  32. Log Health Sample
  33. Get Numbers from Input
  34. If
  35. Log Health Sample
  36. If
  37. Get File
  38. Set Variable
    Water goal
  39. Find Health Samples
  40. Repeat with Each
  41. Add to Variable
  42. Get Numbers from Input
  43. Calculate Statistics
  44. Calculate
  45. If
  46. Show Alert
  47. If
  48. Show Alert

Посмотреть как код
Бета

Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.

#include 'actions/documents'
#define color blue
#define glyph waterDrop

/*
Welcome to water log created by GutlessBubble96

Version log:
1.02 - streamlined file system creation by 2 lines.
1.01 - fixed duplicate / empty data entries
1.0 - original version

*/
// Creates file system for water goal (leaves it alone if one already exists)

const File = getFileFromFolder(, "Water/watergoal.txt", false)

if File {
	@WaterGoal = File
} else {
	createFolder("Water")
	prompt("What is your water goal in oz? (Recommended amount is half of body weight in oz)", "Number")
	@WaterGoal
	saveFile("Water/watergoal.txt", @WaterGoal, true)
}
const List = list("8", "12", "16", "20", "24", "Other", "Edit Goal")
const OuncesWater = chooseFromList(List, "How many fluid ounces of water did you drink?   Your current goal is: {@WaterGoal} oz ", false)

if OuncesWater == "Edit Goal" {
	prompt("What is your water goal in oz? (Recommended amount is half of body weight in oz)", "Number")
	@WaterGoal
	saveFile("Water/watergoal.txt", @WaterGoal, true)
	const List1 = list("8", "12", "16", "20", "24", "Other")
	const OuncesWater1 = chooseFromList(List1, "How many fluid ounces of water did you drink?   Your current goal is: {@WaterGoal} oz ", false)
	if OuncesWater1 == OuncesWater1 {
		const ProvidedInput = prompt("How many ounces did you drink?", "Number")
		if ProvidedInput {
			rawAction("is.workflow.actions.health.quantity.log", {
				"WFQuantitySampleAdditionalQuantity": "",
				"WFQuantitySampleDate": "{CurrentDate}",
				"WFQuantitySampleQuantity": "",
				"WFQuantitySampleType": "Water"
			})
		} else {
		}
	} else {
		const Numbers = getNumbers(OuncesWater1)
		if Numbers {
			rawAction("is.workflow.actions.health.quantity.log", {
				"WFQuantitySampleAdditionalQuantity": "",
				"WFQuantitySampleDate": "{CurrentDate}",
				"WFQuantitySampleQuantity": "",
				"WFQuantitySampleType": "Water"
			})
		}
	}
}

if OuncesWater == OuncesWater1 {
	const ProvidedInput1 = prompt("How many ounces did you drink?", "Number")
	if ProvidedInput1 {
		rawAction("is.workflow.actions.health.quantity.log", {
			"WFQuantitySampleDate": "{CurrentDate}",
			"WFQuantitySampleQuantity": "",
			"WFQuantitySampleType": "Water"
		})
	}
}
const Numbers1 = getNumbers(OuncesWater)

if Numbers1 > 0 {
	rawAction("is.workflow.actions.health.quantity.log", {
		"WFQuantitySampleAdditionalQuantity": "",
		"WFQuantitySampleDate": "{CurrentDate}",
		"WFQuantitySampleQuantity": "",
		"WFQuantitySampleType": "Water"
	})
} else {
}
getFile("Water/watergoal.txt", false)
@WaterGoal
rawAction("is.workflow.actions.filter.health.quantity", {
	"WFContentItemFilter": "",
	"WFContentItemLimitEnabled": false,
	"WFContentItemSortOrder": "A to Z"
})

for _ in HealthSamples {
	@TotalWater = @RepeatItem
}
getNumbers(@TotalWater)
const Sum = statistic("Sum", nil)
const CalculationResult = @WaterGoal - Sum

if CalculationResult > 0 {
	confirm("{CalculationResult} Oz of water remaining. Keep it up!")
} else {
	confirm("You met your daily water goal!!! 🎉\n\n{Sum}Oz of water today!")
}
Открыть в Cherri Playground Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.

Оценки и отзывы

Написать отзыв
–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Пока нет отзывов. Поделись мнением первым!

Реклама

Ещё от gutlessbubble96

См. все

Вам также может понравиться

См. все
Реклама