Unwanted delay in clicking multiple buttons

Please be kind I am a beginner.

I am experiencing an unwanted delay (6s) in the following script.

Tried “ignoring application responses” but it didn’t improve it. Hope you can help me.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- Use this script as a wrapper for GUI Scripting statements when you are confident that GUI Scripting is available and enabled or that the user knows how to enable it if necessary

activate application "Friendly Streaming"
tell application "System Events"
	tell process "Friendly Streaming"
		click button 9 of toolbar 1 of front window
		click menu item 1 of menu 1 of button 9 of toolbar 1 of window 1
	end tell
end tell

I have the same problem sometimes with GUI scripting in the menu bar and could solve it with this:
Stack Overflow - Speed up AppleScript UI scripting?
It seems to be a bug in macOS (or AppleScript).

1 Like