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

Posted on Nov 9, 2022 3:36 AM

Reply

Similar questions

1 reply

Nov 11, 2022 9:00 AM in response to TomFromSwitzerland

Hello TomFromSwitzerland,


Welcome to Apple Support Communities!

If we understand your post correctly, you're trying to use a script and convert it into an app to stop touch bar flickering. We're here to help!


Check out the article below and see if anything in the Apple Script User Guide helps.

Script Editor User Guide for Mac


Also have you talked to Apple Support about the flickering Touch Bar? This doesn't seem to be normal behavior. We'd advise to contact them first, so they can look into the flickering issue itself.

Apple Support


Thank you for using Apple Support Communities.

Take care!



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

SyntaxError Apple Scripts Touch Bar flickering issues

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.