SyntaxError Apple Scripts Touch Bar flickering issues
Hello guys,
I am trying to use a script and convert it into an app to fix my Touch Bar flickering after 60 seconds. I dunno what I am doing wrong but I get a syntax error message because of my user name and password. what's the right format to write it? I run macOS 13.0 Ventura, Intel Mac. You can find the whole script below. Please contact me if you need any additional information.
13-inch, 2018, Four Thunderbolt 3 Ports
Intel Iris Plus Graphics
655 1536 MB
8 GB 2133 MHz
LPDDR3
thank you very much, every help is much appreciated.
global timeBeforeComputerIsNotInUse, computerIsInUse, previousIdleTime
on run
set timeBeforeComputerIsNotInUse to 60 -- 1 minute
set computerIsInUse to true
set previousIdleTime to 0
end run
on idle
set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'") as number
if not computerIsInUse then
if idleTime is less than previousIdleTime then
set computerIsInUse to true
do shell script "defaults write com.apple.touchbar.agent PresentationModeGlobal -string appWithControlStrip"
do shell script "pkill “Touch Bar Agent”" user name "" password "" with administrator privileges
end if
else if idleTime is greater than or equal to timeBeforeComputerIsNotInUse then
set computerIsInUse to false
do shell script "defaults write com.apple.touchbar.agent PresentationModeGlobal -string app"
do shell script "pkill “Touch Bar Agent”" user name "" password "" with administrator privileges
end if
set previousIdleTime to idleTime
return 1
end idle
MacBook Pro 13″, macOS 13.0