Hi All, I don't tend to make changes to my BTT set up now I have it set how I like it however I've noticed after upgrading the OS to Big Sur that the apple script I have associated with toggling on/off the Wifi no longer works.
use framework "CoreWLan"
tell the current application's CWWiFiClient's ¬
sharedWiFiClient()'s interface() to ¬
setPower:((powerOn() = 0)) |error|:(missing value)
(This works in BTT - not in Script Editor. In this works your script )
Hi,
this is not the same. In your script the "not" operator is used. This occurs e.g. in the Script Debugger (not Scriptedior) an error: "1 can not be converted into type boolean". Therefore I have changed this in "(powerOn() = 0)" and it works in this and also in BTT. However, this causes in the Scriptedior the error: "true cannot be converted to type int" occurs. In this your script works fine.
Apparently the funcion "powerOn()" returns depending on the current application sometimes true/false and sometimes 0/1.
Sorry for my bad English.
Maybe this helps to understand. The script works in both:
use framework "CoreWLan"
set theInterface to current application's CWWiFiClient's sharedWiFiClient()'s interface()
set theState to theInterface's powerOn() as text
if theState is "1" or theState is "true" then
theInterface's setPower:false |error|:(missing value)
else
theInterface's setPower:true |error|:(missing value)
end if
However, I don't understand why the behavior is so different and 0/1 can't be converted to true/false.