ShareShortcuts
Создать форк «BT connect»

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

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

Просмотр

This is one of several Shortcuts that automatically TurnOff Bluetooth after 60seconds iff no device connects. These shortcuts are in pairs. Turning off Bluetooth is not for everyone, but I prefer Bluetooth usually off, not remain on forever. For help contact me at game@telus.net

Что нового

Версия 2.1

Semaphores are now folders not files to circumvent an iOS bug pertaining to disappearing files

История версий
2.1 24 сен 2025 г.

Semaphores are now folders not files to circumvent an iOS bug pertaining to disappearing files

2.0 4 авг 2025 г.

Wrong name uploaded earlier

1.0 4 авг 2025 г.

First release

Что делает

Действий: 22
  1. Comment
    To begin using this shortcut, You MUST manually create a folder on your iPhone named Shortcuts/Semaphore Contact me for more info [email protected]
  2. Comment
    202503Mar03-17:58h Iff the connected device is the first, delete the Bluetooth is Off indicator: BTOff.txt (Hardcoded for now.)
  3. Comment
    Whenever device <named passed in> is connected, create a semaphore file. Return result of Test&Set <device name>
  4. Get Text from Input
  5. If
  6. Stop and Output
  7. Text
  8. Text
  9. Get File
  10. If
  11. Comment
    ^^^^ Above, THIS IS SAFEST IMPLEMENTATION OTHERWISE DURING OVERWRITE WHEN EXISTS IFF FILE MOMENTARILY DELETED LOCKFILE A CONCURRENT DISCONNECT MIGHT FORCE OFF BLUETOOTH iff Device Lock File preexists, skip recreating (though current DateTimeStamp wi…
  12. If
  13. Create Folder
  14. Get Contents of Folder
  15. Count
  16. Comment
    202503Mar03-17:58h Iff the connected device is the first or second, delete the BluetoothOff indicator when a non-keepAlive connects: BTOff.txt (Hardcoded for now.)
  17. If
  18. Get File
  19. If
  20. Delete Files
  21. Show Notification
    BT … devices managed.
  22. Get Variable

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

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

#include 'actions/text'
#define color blue

/*
To begin using this shortcut,

You MUST manually create a folder on your iPhone named Shortcuts/Semaphore

Contact me for more info
[email protected]
*/
/*
202503Mar03-17:58h

Iff the connected device is the first, delete the Bluetooth is Off indicator:
BTOff.txt     (Hardcoded for now.)
*/
/*
Whenever device <named passed in> is connected, create a semaphore file.
Return result of Test&Set <device name>
*/
const INdevice = getText(ShortcutInput)

if !INdevice {
	mustOutput("-2\nExpected text input device name. Found none. Exiting.", "-2\nExpected text input device name. Found none. Exiting.")
}
const LockFileDatTimeStamp = "{CurrentDate}"
const BTfilename = "BT{INdevice}_sema"
const BTlockfile = getFile(BTfilename, false)

if BTlockfile['Name'] {
	/*
	^^^^ Above, THIS IS SAFEST IMPLEMENTATION OTHERWISE DURING OVERWRITE WHEN EXISTS IFF FILE MOMENTARILY DELETED LOCKFILE A CONCURRENT DISCONNECT MIGHT FORCE OFF BLUETOOTH 
	
	iff Device Lock File preexists, skip recreating (though current DateTimeStamp will differ from file.)
	*/
} else {
	createFolder(BTfilename)
}
const DeviceSemaphores = getFolderContents()
const countFolderDevicesAdded = count(DeviceSemaphores['Name'])
/*
202503Mar03-17:58h

Iff the connected device is the first or second, delete the BluetoothOff indicator when a non-keepAlive connects:
BTOff.txt     (Hardcoded for now.)
*/

if countFolderDevicesAdded == 1 {
	const BTOff_flag = getFile("BTOff_flag", false)
	if BTOff_flag['Name'] {
		deleteFiles(BTOff_flag, true)
	}
}
showNotification(" BT {countFolderDevicesAdded} devices managed.", "✅ {INdevice} added.", false, BTlockfile)
// TODO: Get Variable not supported: Assign variable here to 'countFolderDevicesAdded'.
Открыть в Cherri Playground Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.

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

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

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

Реклама

Ещё от weplaydr

См. все

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

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