• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why is it so?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is it so?


  • Subject: Re: Why is it so?
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 11 Sep 2016 11:54:11 +1000

G’day Shane, & thank you. Haven’t tried it yet, but will. No, I don’t want to know why ‘stop’ fails, thanks. Just that it does.

In the meantime, I’ve got deeper problems. It seems my App is unable to be set for accessibility. This more recent snippet, based on Bill’s advice, simply will not recognize that that darn box has been ticked.

Anyone? This is probably for Bill Cheeseman, or Shane, but anyone’s wecome to pitch in.

Bug in Sierra???

Regards

Santa

on enabledGUIScripting(flag) # Curtesy of Bill Cheeseman
considering numeric strings
set MountainLionOrOlder to system version of (system info) < "10.9"
end considering
if MountainLionOrOlder then


-- In OS X 10.8 Mountain Lion and older, enable GUI Scripting globally by calling this handler and passing 'true' in the flag parameter before your script executes any GUI Scripting commands, or pass 'false' to disable GUI Scripting. Authentication is required only if the value of the 'UI elements enabled' property will be changed. Returns the final setting of 'UI elements enabled' even if unchanged.


tell application "System Events"
activate -- brings System Events authentication dialog to front
set UI elements enabled to flag
return UI elements enabled
end tell
else


-- In OS X 10.9 Mavericks and newer, global access is no longer available and GUI Scripting can only be enabled manually on a per-application basis. Pass true to present an alert with a button to open System Preferences and telling the user to select the current application (the application running the script) in the Accessibility list in the Security & Privacy preference's Privacy pane. Authentication is required to unlock the preference. Returns the current setting of 'UI elements enabled' asynchronously, without waiting for System Preferences to open, and tells the user to run the script again.


tell application "System Events" to set GUIScriptingEnabled to UI elements enabled -- read-only in OS X 10.9 Mavericks and newer
if flag is true then
if not GUIScriptingEnabled then
say "Please tick the privacy accessibility box for Mail Manager Loop Runner"
tell application "System Preferences"
activate
tell pane id "com.apple.preference.security" to reveal anchor "Privacy_Accessibility"
try
set x to 0
repeat
delay 0.1
tell application "System Events" to set GUIScriptingEnabled to UI elements enabled
if GUIScriptingEnabled then exit repeat
set x to x + 1
if x > 600 then exit repeat
end repeat
end try
end tell
say “exiting” # ALWAYS  says after a minute, so obviously accessibilty is NOT set. Box is unticked on subsequent opens.
set thePreface to ""
if my GUcounter > 0 then
set thePreface to "••••• PLEASE NOTE •••••" & return & return & "You MUST set the tick box of 'Mail Manager Loop Runner'." & return & "I cannot proceed until you do!" & return & return & "You've had " & GUcounter & " attempts." & return & return as text
end if
set my GUcounter to (my GUcounter) + 1
(*tell application "Finder"
activate
delay 1
activate
display dialog thePreface & "It seems that the Accessibilty for this Application 'Mail Manager Loop Runner' is not set correctly, even though it might appear ticked." & return & return & "I have opened 'System Preferences'. " & return & return & "Set the  preference of 'Accessibility' in 'Security & Privacy', then click the padlock icon, then please enter your log on password in the dialog box, & tick or re-tick the 'Mail Manager Loop Runner' box. " & return & return & "When it's ticked, click the red round 'close' button on the 'Security & Privacy' window, then click the 'Continue' button below." & return with title "Mail Manager Loop Runner" buttons "Continue" default button "Continue" with icon stop giving up after 180
set my keyReturned to button returned of the result
end tell*)
tell application "System Events" to set GUIScriptingEnabled to UI elements enabled -- read-only in OS X 10.9 Mavericks and newer
end if
end if
return GUIScriptingEnabled
end if
end enabledGUIScripting



And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably

Sri Aurobindo



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why is it so?
      • From: Brian Christmas <email@hidden>
References: 
 >Why is it so? (From: Brian Christmas <email@hidden>)
 >Re: Why is it so? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Why is it so?
  • Next by Date: Re: Why is it so?
  • Previous by thread: Re: Why is it so?
  • Next by thread: Re: Why is it so?
  • Index(es):
    • Date
    • Thread