ShareShortcuts

Counter

Simple counter for 1 V 1 games like table tennis or tic tac toe

kuba799
Fork “Counter”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so kuba799 gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
66K
Saved
1
Actions
136
Category
Utilities
Version
2.1
Language
EN

Preview

Simple counter for 1 V 1 games like table tennis or tic tac toe...

...and much more!

Just add names and then click on name that win.

Features:

Automaticly save to Files

What's New

Version 2.1

New EDIT option, bug fixes

Version History
2.1 Dec 15, 2020

New EDIT option, bug fixes

2.0 Nov 8, 2020

Re-built

1.2 Sep 2, 2019

Bug fix, shoother running

1.1 Sep 1, 2019

Shortcuts Updater avabile

1.0 Sep 1, 2019

First release

What it does

136 actions
  1. Create Folder
  2. Get File
  3. Set Variable
    Counter
  4. If
  5. Get My Shortcuts
  6. If
  7. Dictionary
  8. Run Shortcut
    Swing Updater
  9. If
  10. Text
  11. Choose from Menu
    …
  12. Choose from Menu
    Continue
  13. Choose from Menu
    New counting
  14. Delete Files
  15. Run Shortcut
    Counter
  16. Stop This Shortcut
  17. Choose from Menu
    Delete
  18. Delete Files
  19. Stop This Shortcut
  20. If
  21. If
  22. Show Alert
    No configuration
  23. Repeat
  24. Set Variable
    Name
  25. Ask for Input
    Please, enter name of person n.…:
  26. Set Variable
    Name
  27. Repeat
  28. Get Dictionary Value
  29. If
  30. Text
  31. Ask for Input
    …
  32. Set Variable
    Name
  33. Set Dictionary Value
  34. Set Variable
    Counter
  35. Save File
  36. If
  37. Text
  38. If
  39. Nothing
  40. Choose from Menu
    … person…
  41. Choose from Menu
    Add person
  42. Choose from Menu
    Done
  43. If
  44. Show Notification
    There will be only one person...
  45. Choose from Menu
  46. Choose from Menu
    Yes, I’m sure
  47. Run Shortcut
    Counter 5
  48. Stop This Shortcut
  49. Choose from Menu
    No, add more
  50. If
  51. Run Shortcut
    Counter 5
  52. Stop This Shortcut
  53. Show Notification
    To start, re-open the shortcut.
  54. Stop This Shortcut
  55. Repeat with Each
  56. Get Dictionary Value
  57. Text
  58. Add to Variable
  59. Get Dictionary from Input
  60. If
  61. Get Dictionary Value
  62. If
  63. Set Variable
    Menu
  64. Text
  65. Add to Variable
  66. Choose from List
  67. Set Variable
    ChoosenMenuItem
  68. If
  69. Text
  70. Set Variable
    EditMenu
  71. Add to Variable
  72. Text
  73. Add to Variable
  74. Choose from List
  75. Set Variable
    ChoosenEditMenuItem
  76. If
  77. Repeat
  78. Set Variable
    Name
  79. Count
  80. Calculate
  81. Ask for Input
    Please, enter name of person n.…:
  82. Set Variable
    Name
  83. Repeat
  84. Get Dictionary Value
  85. If
  86. Text
  87. Ask for Input
    …
  88. Set Variable
    Name
  89. Set Dictionary Value
  90. Set Variable
    Counter
  91. Save File
  92. Choose from Menu
    … persons
  93. Choose from Menu
    Add person
  94. Choose from Menu
    Done and continue
  95. Run Shortcut
    Counter
  96. Stop This Shortcut
  97. Show Notification
    To start, re-open the shortcut.
  98. Stop This Shortcut
  99. If
  100. Run Shortcut
    Counter
  101. Stop This Shortcut
  102. Replace Text
  103. Get Dictionary Value
  104. If
  105. Show Notification
    File doesn't contains selected item.
  106. Stop This Shortcut
  107. Text
  108. If
  109. Show Notification
    Unexpected fault.
  110. Ask for Input
    …:
  111. If
  112. Set Dictionary Value
  113. If
  114. Replace Text
  115. If
  116. Replace Text
  117. If
  118. Replace Text
  119. If
  120. Replace Text
  121. If
  122. Show Notification
    Unexpected fault.
  123. Set Variable
    Counter
  124. Save File
  125. Dictionary
  126. Run Shortcut
    Counter
  127. If
  128. Replace Text
  129. Get Dictionary Value
  130. If
  131. Show Notification
    File doesn't contains selected item.
  132. Stop This Shortcut
  133. Calculate
  134. Set Dictionary Value
  135. Save File
  136. Run Shortcut
    Counter 5

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/text'
#include 'actions/shortcuts'
#include 'actions/documents'
#define color green
#define glyph circledPi

createFolder("counter")
getFile("counter/counter.json", false)
@Counter

if !ShortcutInput {
	const MojeZkratky = getShortcuts()
	if MojeZkratky['Name'] contains "Swing Updater" {
		const Slovnk = {
			"Name": "Counter",
			"RH ID": "7322",
			"Version": "1.1"
		}
		run("Swing Updater", Slovnk)
	}
	if @Counter {
		menu  {
		item "Continue":
		item "New counting":
			deleteFiles(@Counter)
			runSelf()
			stop()
		item "Delete":
			deleteFiles(@Counter)
			stop()
		}
	}
}

if !@Counter {
	if !ShortcutInput {
		alert("Please, set-up names.", "No configuration")
	}
	repeat _ for 20 {
		@Name = nil
		prompt("Please, enter name of person n.{@RepeatIndex}:")
		@Name
		repeat _ for 50 {
			const HodnotaZeSlovnku = getValue(@Counter, @Name)
			if HodnotaZeSlovnku {
				prompt()
				@Name
			}
		}
		setValue(@Counter, @Name, "0")
		@Counter
		saveFile("counter/counter.json", @Counter, true)
		if @RepeatIndex > 1 {
		} else {
		}
		menu "{@RepeatIndex} person{}" {
		item "Add person":
		item "Done":
			if @RepeatIndex <= 1 {
				showNotification("There will be only one person...", "Are you sure?")
				menu "" {
				item "Yes, I’m sure":
					runSelf()
					stop()
				item "No, add more":
				}
			} else {
				runSelf()
				stop()
			}
		}
	}
	showNotification("To start, re-open the shortcut.", "Too much persons")
	stop()
}

for _ in @Counter {
	@RawMenu += "{@RepeatItem}: {}"
}
const Slovnk1 = getDictionary(ShortcutInput)

if Slovnk1['ChoosenMenuItem'] {
	getValue(Slovnk1, "ChoosenMenuItem")
} else {
	@Menu = @RawMenu
	@Menu += "EDIT"
	chooseFromList(@Menu)
}
@ChoosenMenuItem

if @ChoosenMenuItem == "EDIT" {
	@EditMenu = "Add person(s)"
	@EditMenu = @RawMenu
	@EditMenu += "← Back"
	chooseFromList(@EditMenu, "Choose:")
	@ChoosenEditMenuItem
	if @ChoosenEditMenuItem == "Add person(s)" {
		repeat _ for 20 {
			@Name = nil
			const Poet = count(@Counter)
			prompt("Please, enter name of person n.{}:")
			@Name
			repeat _ for 50 {
				const HodnotaZeSlovnku1 = getValue(@Counter, @Name)
				if HodnotaZeSlovnku1 {
					prompt()
					@Name
				}
			}
			setValue(@Counter, @Name, "0")
			@Counter
			saveFile("counter/counter.json", @Counter, true)
			menu "{} persons" {
			item "Add person":
			item "Done and continue":
				runSelf()
				stop()
			}
		}
		showNotification("To start, re-open the shortcut.", "Too much persons")
		stop()
	}
	if @ChoosenEditMenuItem == "← Back" {
		runSelf()
		stop()
	}
	replaceText(": (\d+)$", "", false, true)
	const HodnotaZeSlovnku2 = getValue(@Counter)
	if !HodnotaZeSlovnku2 {
		showNotification("File doesn't contains selected item.", "Error", HodnotaZeSlovnku2)
		stop()
	}
	const Text = "{}: {HodnotaZeSlovnku2}"
	if Text !=  {
		showNotification("Unexpected fault.", "Error")
	}
	const PijatVstup = prompt("{}:", "Number")
	if PijatVstup {
		setValue(@Counter, PijatVstup)
	} else {
		const AktualizovanText = replaceText("\"{}\":{HodnotaZeSlovnku2},", "", @Counter)
		if AktualizovanText == @Counter {
			const AktualizovanText1 = replaceText("\"{}\":{HodnotaZeSlovnku2}", "", @Counter)
			if AktualizovanText1 == @Counter {
				const AktualizovanText2 = replaceText("\"{}\":\"{HodnotaZeSlovnku2}\",", "", @Counter, true)
				if AktualizovanText2 == @Counter {
					const AktualizovanText3 = replaceText("\"{}\":\"{HodnotaZeSlovnku2}\"", "", @Counter, true)
					if AktualizovanText3 == @Counter {
						showNotification("Unexpected fault.", "Error")
					}
				}
			}
		}
	}
	@Counter
	saveFile("counter/counter.json", @Counter, true)
	const Slovnk2 = {
		"ChoosenMenuItem": "EDIT"
	}
	runSelf(Slovnk2)
} else {
	replaceText(": (\d+)$", "", false, true)
	const HodnotaZeSlovnku3 = getValue(@Counter)
	if !HodnotaZeSlovnku3 {
		showNotification("File doesn't contains selected item.", "Error")
		stop()
	}
	const Slovnk3 = setValue(@Counter)
	saveFile("counter/counter.json", Slovnk3, true)
	runSelf()
}
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by kuba799

See All

You Might Also Like

See All
Advertisement