Forhåndsvisning
This is the companion 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
Nyheder
Version 1.1
Semaphores are now folders not files to circumvent an iOS bug pertaining to disappearing files
Hvad den gør
34 handlinger-
CommentTo begin using this shortcut, You MUST manually create a folder on your iPhone named Shortcuts/Semaphore Contact me for more info [email protected]
-
CommentNOTE: To make this shortcut work, YOU MUST MANUALLY create a folder on your iPhone named Shortcuts/Semaphore/Bluetooth Here, this shortcut and a companion shortcut will create & delete LockFiles.
-
Comment202501Jan24-1500h IFF the disconnected device was unmanaged, do not give 1minute grace period; simple check whether or not to auto-off BlueTooth
-
CommentWhenever device <named passed in> is disconnected, delete a BTdevice lockfile. Return result of Test&Clear <device name>
-
Number
-
Comment20250Jan08-2000h PROVIDE [60] SIXTY SECONDS (1min) ALLOWANCE rather than dropping BlueTooth immediately.
-
Set Variableran_time
-
Text
-
Set VariabletLockDate
-
Get Text from Input
-
If
-
Stop and Output
-
Text
-
Get File
-
If
-
Text
-
Set VariabletLockDate
-
Delete Files
-
Comment^^^^ Above, delete Device Lock File ASAP & immediate deletion, to permit same device to re-connect quickly.
-
Wait
-
Comment20250Jan08-2000h 1.KEEP BT ON because a fresh BT DEVICE might CONNECT in the meanwhile. expressly DELAY [60] SECONDS.
-
Text
-
Get Contents of Folder
-
Count
-
If
-
Comment202411Nov26 FOR TODAY OMIT REDUNDANTLY TURNING ON BLUETOOTH, because might cause unbeknownst race condition. ⁉️
-
Show NotificationBT … remain … LockCreated …
-
If
-
Create Folder
-
Set Bluetooth
-
Play Sound
-
Comment#### AUTO-OFF 😁 🟦🦷 #### #### IF NO DEVICE BT LOCK FILES EXIST, 60second delay helps avoid connection RACE CONDITION. AUTO-TURN OFF BLUETOOTH XMIT’R
-
Show NotificationBluetooth is now Off …
-
Get Variable
Vis som kode
Alle genvejens handlinger skrevet ud i Cherri, et programmeringssprog til genveje. Perfekt til at lære, hvordan den virker.
#include 'actions/text'
#define color taupe
/*
To begin using this shortcut,
You MUST manually create a folder on your iPhone named Shortcuts/Semaphore
Contact me for more info
[email protected]
*/
/*
NOTE: To make this shortcut work, YOU MUST MANUALLY create a folder on your iPhone named Shortcuts/Semaphore/Bluetooth
Here, this shortcut and a companion shortcut will create & delete LockFiles.
*/
// 202501Jan24-1500h IFF the disconnected device was unmanaged, do not give 1minute grace period; simple check whether or not to auto-off BlueTooth
/*
Whenever device <named passed in> is disconnected, delete a BTdevice lockfile.
Return result of Test&Clear <device name>
*/
const nSeconds_Wait = 60
// 20250Jan08-2000h PROVIDE [60] SIXTY SECONDS (1min) ALLOWANCE rather than dropping BlueTooth immediately.
@ran_time = CurrentDate
@tLockDate = "{@ran_time}"
const INdevice = getText(ShortcutInput)
if !INdevice {
mustOutput("-2\nExpected name of bluetooth device. Exiting.", "-2\nExpected name of bluetooth device. Exiting.")
}
const BTfilename = "BT{INdevice}_sema"
const BTlockfile = getFile(BTfilename, false)
if BTlockfile['File Path'] {
@tLockDate = "{BTlockfile['Creation Date']}"
deleteFiles(BTlockfile, true)
// ^^^^ Above, delete Device Lock File ASAP & immediate deletion, to permit same device to re-connect quickly.
}
wait(nSeconds_Wait)
/*
20250Jan08-2000h 1.KEEP BT ON because a fresh BT DEVICE might CONNECT in the meanwhile.
expressly DELAY [60] SECONDS.
*/
const Time_Stamp = "{CurrentDate}"
const GetContentsOfFolder = getFolderContents()
const countFolderDevicesRemaining = count(GetContentsOfFolder['File Path'])
if countFolderDevicesRemaining > 0 {
// 202411Nov26 FOR TODAY OMIT REDUNDANTLY TURNING ON BLUETOOTH, because might cause unbeknownst race condition. ⁉️
showNotification(" BT {countFolderDevicesRemaining} remain {Textran_time}\n\nLockCreated {@tLockDate}", "✅ {INdevice} released.", false)
} else {
createFolder("BTOff_flag")
setBluetooth(0)
playSound(nil)
/*
#### AUTO-OFF 😁 🟦🦷 ####
#### IF NO DEVICE BT LOCK FILES EXIST, 60second delay helps avoid connection RACE CONDITION. AUTO-TURN OFF BLUETOOTH XMIT’R
*/
showNotification(" Bluetooth is now Off {Textran_time}", "ℹ️ {INdevice} was last BT device", false)
}
// TODO: Get Variable not supported: Assign variable here to 'countFolderDevicesRemaining'.
Åbn i Cherri Playground
Dekompileret med cherri 2.3.0 (GPL-2.0). Kan kræve små rettelser, før den kan kompileres.
Bedømmelser og anmeldelser
Skriv en anmeldelse–
ud af 5
★★★★★
★★★★
★★★
★★
★
0 ratings
Ingen anmeldelser endnu. Vær den første!
Annonce
Mere fra weplaydr
Du vil måske også kunne lide
Annonce