To enable UI scripting go to the Universal Access Preference Pane and enable the checkbox at the bottom of the screen. However good script should check for this and give you a dialog, prompting you to enable it. Here is the code:
(Works with Tiger and up.)
tell application "System Events"
if not UI elements enabled then
display dialog "GUI Scripting is not enabled. This script requires GUI scripting, click \"OK\" to enable."
set UI elements enabled to true
end if
end tell
Note to self: paste this in front of every script that uses UI scripting.
No comments:
Post a Comment