Pré-visualização
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
Novidades
Versão 2.1
Semaphores are now folders not files to circumvent an iOS bug pertaining to disappearing files
O que ele faz
22 ações-
CommentTo begin using this shortcut, You MUST manually create a folder on your iPhone named Shortcuts/Semaphore Contact me for more info [email protected]
-
Comment202503Mar03-17:58h Iff the connected device is the first, delete the Bluetooth is Off indicator: BTOff.txt (Hardcoded for now.)
-
CommentWhenever device <named passed in> is connected, create a semaphore file. Return result of Test&Set <device name>
-
Get Text from Input
-
If
-
Stop and Output
-
Text
-
Text
-
Get File
-
If
-
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…
-
If
-
Create Folder
-
Get Contents of Folder
-
Count
-
Comment202503Mar03-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
-
Get File
-
If
-
Delete Files
-
Show NotificationBT … devices managed.
-
Get Variable
Ver como código
Todas as ações deste atalho escritas em Cherri, uma linguagem de programação para o app Atalhos. Ótimo para aprender como ele funciona.
#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'.
Abrir no Cherri Playground
Descompilado com cherri 2.3.0 (GPL-2.0). Pode precisar de pequenos ajustes antes de compilar.
Avaliações e comentários
Escrever uma avaliação–
de 5
★★★★★
★★★★
★★★
★★
★
0 ratings
Ainda não há avaliações. Seja o primeiro a compartilhar o que você pensa!
Publicidade
Mais de weplaydr
Você também pode gostar
Publicidade