What is "system events" ?
On Oct 20, 2017, at 4:40 AM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Is there a place that describes what System Events is, how it works, why it is necessary for some sorts of scripting, etc.?
On Oct 20, 2017, at 18:09, Bill Cheeseman <wjcheeseman@...> wrote:There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.On Oct 20, 2017, at 4:40 AM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Is there a place that describes what System Events is, how it works, why it is necessary for some sorts of scripting, etc.?
As to the question, System Events is an app, like any other app (sort of). It lives here:
/System/Library/CoreServices/System Events.app
The thing that makes it different is that it doesn’t have a GUI, and it’s whole purpose is to be accessed through Applescript for scripting (as it’s name implies) system functions such as inspecting running processes, sleeping, restarting and shutting down the computer. It can do quite a few other things, too, which you can explore through its Dictionary.
Best
Phil
@sqwarq
On 20 Oct 2017, at 22:50, 2551phil <2551phil@...> wrote:it’s whole purpose is to be accessed through Applescript
On Oct 21, 2017, at 0:50, 2551phil <2551phil@...> wrote:As to the question, System Events is an app, like any other app (sort of). It lives here:
/System/Library/CoreServices/System Events.app
The thing that makes it different is that it doesn’t have a GUI, and it’s whole purpose is to be accessed through Applescript for scripting (as it’s name implies) system functions such as inspecting running processes, sleeping, restarting and shutting down the computer. It can do quite a few other things, too, which you can explore through its Dictionary.
Blessed (System) Events -- At some point, someone at Apple put two and two together, as follows. "On the one hand, we've got the Accessibility API, which lets any program access the interface elements of any other program. On the other hand, we've got AppleScript, which lets any user write a script to give commands to any scriptable program. So what would happen if we put them together? Any user would be able to write a script to give commands to a scriptable program which would use the Accessibility API to access the interface elements of any program." To see the significance of this, just take out the middle terms, and what have you got? Any user can write a script that can access the interface elements of any program. Any user can script an unscriptable program, using AppleScript! You wouldn't need any special macro program, because AppleScript itself, which is already on your computer, would become a macro language.
Of course, for this to work, there has to be that "middle term" - the go-between, the application that receives AppleScript commands and talks to the Accessibility API. That application is called System Events. It's on your computer right now, in /System/Library/Core Services.
On 20 Oct 2017, at 23:10, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Same author.
Bill mentioned (Matt Neuburg's TidBits article)…And thank you for the book reference. I'll be putting it either on my BD list or on my Xmas list :)nn
What other practical use cases are there for System Events scripting?Again, I can only refer you to the Dictionary and reiterate that, in this regard, it’s like any other app. What practical use is there for scripting the Finder, or Numbers? Doesn’t it depend on what they expose in their Dictionaries? Same is true of System Events.
When you look at the Dictionary, you’ll see a lot of overlap with the Finder, but if given the choice between the two, I’d go with System Events. However, (especially now we have the ASObjC bridge), I’d almost always try to find another way for just about anything if possible cos neither are that quick or that reliable.
Would you have a simple example?Probably the thing I, personally, use System Events the most for is in Script Debugger to see what properties, objects and classes of other apps I can manipulate. Thus
tell application "System Events"
#~-- your code goes here...~#
end tell
is a common go-to I use, where I never fill in the ‘your code goes here’ part or even compile the script. I just leave the cursor on the first line within “System Events” and use SD’s live inspector to browse the goodies.
I think there’s a video on the latenightsw site showing how to do this if you’re not familiar with what I’m talking about.
Best
Phil
@sqwarq
On 21 Oct 2017, at 01:24, Steve Mills <sjmills@...> wrote:crosspost
Date: Friday, October 20, 2017 at 12:44 PM
To: "applescript@apple-dev.groups.io" <applescript@apple-dev.groups.io>, "ASUL (AppleScript)" <applescript-users@...>
Subject: Re: [applescript] What is "system events" ?
On 21 Oct 2017, at 04:18, Steve Mills <sjmills@...> wrote:_______________________________________________On Oct 20, 2017, at 02:11 PM, 2551phil <2551phil@...> wrote:On 21 Oct 2017, at 01:24, Steve Mills <sjmills@...> wrote:crosspostYou’re twisting the concept. Anyone on an AppleScript mailing list should expect to get posts about AppleScript. Being on more than one list of the same subject and getting duplicates of the same message isn’t “crossposting”.Crossposting means sending the same message to several diverse groups. Hence “cross”…both in terms of crossing subject-specific content and in terms of audience reaction…If you object to getting messages about AppleScript in an AppleScript list you’re subscribed to, either complain that the message is off-topic or, if you get no joy, unsubscribe from a list that doesn’t cover your interests.You are wrong. He DID crosspost to both lists from the same original message. He sent one message to both groups. That's crossposting. Two completely different lists run by two completely different entities. That's crossposting. I'm replying to all to show you how annoying it is. I only replied to one because *I* didn't want my reply to be crossposted. But now I'm crossposting to illustrate how annoying it is.Sent from iCloud's ridiculous UI, so, sorry about the formatting
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-users@...)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/2551phil%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to 2551phil@...
On 21 Oct 2017, at 03:58, JMichaelTX <JMichael@...> wrote:Phil,
Thanks for posting this. This is a huge tip!For those that don't have SD6, or, like me, not sure what Phil is referring to, here's a screen shot of the lower Inspector Panel of SD6, after I have entered the simple script below:
<86B7B648-8F29-47A3-B65C-CC510BF7DBD6.png>
Here is another screenshot where I have expanded the "UI elements" list:
<2C57F2BE-98A6-4CB0-8697-D2C9411066FD.png>
Best Regards,
Jim Underwoodaka JMichaelTX
From: AppleScript-Users <applescript-users-bounces+jmichael=apoemail.us@...> on behalf of 2551phil <2551phil@...>
Date: Friday, October 20, 2017 at 12:44 PM
To: "applescript@apple-dev.groups.io" <applescript@apple-dev.groups.io>, "ASUL (AppleScript)" <applescript-users@...>
Subject: Re: [applescript] What is "system events" ?
tell application "System Events"#~-- your code goes here...~#end tell
is a common go-to I use, where I never fill in the ‘your code goes here’ part or even compile the script. I just leave the cursor on the first line within “System Events” and use SD’s live inspector to browse the goodies.
On Oct 20, 2017, at 3:20 PM, 2551phil <2551phil@...> wrote:You’re confusing crossposting with cross-subscribing. In both lists, his posts were on topic. The fact that you got duplicates is your problem.On 21 Oct 2017, at 04:18, Steve Mills <sjmills@...> wrote:_______________________________________________On Oct 20, 2017, at 02:11 PM, 2551phil <2551phil@...> wrote:On 21 Oct 2017, at 01:24, Steve Mills <sjmills@...> wrote:crosspostYou’re twisting the concept. Anyone on an AppleScript mailing list should expect to get posts about AppleScript. Being on more than one list of the same subject and getting duplicates of the same message isn’t “crossposting”.Crossposting means sending the same message to several diverse groups. Hence “cross”…both in terms of crossing subject-specific content and in terms of audience reaction…If you object to getting messages about AppleScript in an AppleScript list you’re subscribed to, either complain that the message is off-topic or, if you get no joy, unsubscribe from a list that doesn’t cover your interests.You are wrong. He DID crosspost to both lists from the same original message. He sent one message to both groups. That's crossposting. Two completely different lists run by two completely different entities. That's crossposting. I'm replying to all to show you how annoying it is. I only replied to one because *I* didn't want my reply to be crossposted. But now I'm crossposting to illustrate how annoying it is.Sent from iCloud's ridiculous UI, so, sorry about the formatting
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-users@...)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/2551phil%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to 2551phil@...
Fort Collins, CO
And, yes, ASObjC. I'll need to bite the bullet eventually...
Jean-Christophe
On Oct 21, 2017, at 2:44, 2551phil <2551phil@...> wrote:On 20 Oct 2017, at 23:10, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Same author.
Bill mentioned (Matt Neuburg's TidBits article)…And thank you for the book reference. I'll be putting it either on my BD list or on my Xmas list :)nnWhat other practical use cases are there for System Events scripting?Again, I can only refer you to the Dictionary and reiterate that, in this regard, it’s like any other app. What practical use is there for scripting the Finder, or Numbers? Doesn’t it depend on what they expose in their Dictionaries? Same is true of System Events.
When you look at the Dictionary, you’ll see a lot of overlap with the Finder, but if given the choice between the two, I’d go with System Events. However, (especially now we have the ASObjC bridge), I’d almost always try to find another way for just about anything if possible cos neither are that quick or that reliable.Would you have a simple example?Probably the thing I, personally, use System Events the most for is in Script Debugger to see what properties, objects and classes of other apps I can manipulate. Thus
tell application "System Events"
#~-- your code goes here...~#
end tell
is a common go-to I use, where I never fill in the ‘your code goes here’ part or even compile the script. I just leave the cursor on the first line within “System Events” and use SD’s live inspector to browse the goodies.
I think there’s a video on the latenightsw site showing how to do this if you’re not familiar with what I’m talking about.
Best
Phil
Date: Friday, October 20, 2017 at 7:05 PM
To: "ASUL (AppleScript)" <applescript-users@...>
Subject: Re: What is "system events" ?
There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.Bill, thanks for the reference, but I was unable to find any references to "System Events" on either of those sections. I did a browser search for "system", and it didn't find anything. Did I miss them?
If you could provide the actual links here, I'd love to include them in the new AppleScript Wiki article we are writing.
On Oct 22, 2017, at 9:04, JMichaelTX <JMichael@...> wrote:On Fri, Oct 20, 2017 at 02:09 am, Bill Cheeseman wrote:
There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.Bill, thanks for the reference, but I was unable to find any references to "System Events" on either of those sections. I did a browser search for "system", and it didn't find anything. Did I miss them?
On Oct 21, 2017, at 8:04 PM, JMichaelTX <JMichael@...> wrote:On Fri, Oct 20, 2017 at 02:09 am, Bill Cheeseman wrote:There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.Bill, thanks for the reference, but I was unable to find any references to "System Events" on either of those sections. I did a browser search for "system", and it didn't find anything. Did I miss them?
If you could provide the actual links here, I'd love to include them in the new AppleScript Wiki article we are writing.
On Oct 21, 2017, at 8:49 PM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.
On Oct 22, 2017, at 16:37, Bill Cheeseman <wjcheeseman@...> wrote:As far as I know, the most thorough writeup of GUI Scripting specifically is chapter 28 of the book I co-wrote with Sal Soghoian, "AppleScript 1-2-3", part of the Apple Training Series, published by Peachpit Press in 2009.On Oct 21, 2017, at 8:49 PM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.
On Oct 22, 2017, at 9:49, Jean-Christophe Helary <jean.christophe.helary@...> wrote:
On Fri, Oct 20, 2017 at 02:09 am, Bill Cheeseman wrote:
There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.Bill, thanks for the reference, but I was unable to find any references to "System Events" on either of those sections. I did a browser search for "system", and it didn't find anything. Did I miss them?The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.