What is "system events" ?
Jean-Christophe Helary <jean.christophe.helary@...>
On Oct 20, 2017, at 17:40, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Thanks everybody for all the replies. I've made a summary of everything I gathered here: https://mac4translators.blogspot.jp/2017/10/what-is-system-events.html It's my beginner's take on the question so there really is nothing technical there. If you have comments or suggestions though, don't hesitate. Jean-Christophe |
|
Hey guys,
Here is a great, short video showing how to use SD6 to explore System Events, and then to drag/drop to create a big tell block:
Best Regards,
Jim Underwood
aka JMichaelTX
From: AppleScript-Users <applescript-users-bounces+jmichael=apoemail.us@...> on behalf of 2551phil <2551phil@...>
Date: Friday, October 20, 2017 at 4:21 PM To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>, "ASUL (AppleScript)" <applescript-users@...> Subject: Re: [applescript] What is "system events" ? Note that you can do the same trick with any other app, too, not just System Events; i.e., see a live view of whatever app’s properties, classes, etc. |
|
Jean-Christophe Helary <jean.christophe.helary@...>
The tidbits article was super well hidden in the pages: http://pfiddlesoft.com → [UI Browser] → (above the screenshot) [Reading] → [PreFab UI Browser 2.0 Better Than Ever] Et voilà ! Bill, maybe you should make it a way that the [Reading] section is easier to see. Jean-Christophe |
|
Jean-Christophe Helary <jean.christophe.helary@...>
Thank you.
toggle quoted message
Show quoted text
I mentioned the article because it was available online form your site. Jean-Christophe
|
|
Bill Cheeseman
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.
|
|
Bill Cheeseman
My website, and my UI Browser product, are all about GUI Scripting. Which, as you now know, uses the Processes Suite of System Events. You'll find the most detail here: <http://pfiddlesoft.com/uibrowser/support.html>.
|
|
Jean-Christophe Helary <jean.christophe.helary@...>
The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is. Jean-Christophe |
|
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. |
|
Jean-Christophe,
You have made some good points about the "System Events" app (which it really is not). 😉
I have come to think of SE as the AppleScript Swiss Army Knife -- it is a great utility for doing many, often unrelated, things.
I suspect that the AppleScript "old timers" know it like the back of their hand, and don't give much thought to it.
But to those of us still learning AppleScript (which I still am), it has not been clear. Like the Swiss Army Knife, some of the tools are fairly obvious, while others are not. And like any tool, understanding a tool's features, and knowing how to use
it, and what use cases it is good/best for, are two very different things.
Thanks for asking this question.
And thanks to everyone who has replied with a helpful answer. I've learned a lot from you today. 😄
Best Regards,
Jim Underwood
aka JMichaelTX
P.S. So as to not upset the sensitive among you, I am bcc this to the apple-dev.groups.io/g/applescript
From: Jean-Christophe Helary <jean.christophe.helary@...>
Date: Friday, October 20, 2017 at 7:05 PM To: "ASUL (AppleScript)" <applescript-users@...> Subject: Re: What is "system events" ?
Ok, I had the idea that it was mostly UI scripting, but sometimes it would do something else. Indeed, the dictionary covers a huge lot of totally unrelated areas of specialization.
So I guess I just need to remind myself that "System Events" is a misnomer and call that "Headless Applications Bundle", which is much less sexy, but more indicative of what the thing really does.
Thank you again all who have replied.
Jean-Christophe
|
|
Jean-Christophe Helary <jean.christophe.helary@...>
Thank you all for the replies. I have a much cleared idea of what the thing is intended for!
toggle quoted message
Show quoted text
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. |
|
Robert Poland
If my receiving duplicate messages is my fault, How do I avoid them?
Also how do we eliminate duplicate and triplicate footers?
Robert Poland
Fort Collins, CO |
|
2551phil
Note that you can do the same trick with any other app, too, not just System Events; i.e., see a live view of whatever app’s properties, classes, etc.
toggle quoted message
Show quoted text
The live inspector view, along with the variables view and SD’s dictionary viewer, are really what make SD worthwhile for me. I rarely have need to actually step into the debugger itself thanks to these. Best Phil @sqwarq
|
|
2551phil
You’re confusing crossposting with cross-subscribing. In both lists, his posts were on topic. The fact that you got duplicates is your problem.
toggle quoted message
Show quoted text
|
|
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:
Here is another screenshot where I have expanded the "UI elements" list:
Best Regards,
Jim Underwood
aka 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.
|
|
2551phil
You’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. Best Phil @sqwarq |
|
2551phil
On 20 Oct 2017, at 23:10, Jean-Christophe Helary <jean.christophe.helary@...> wrote:Same author. 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 |
|
Jean-Christophe Helary <jean.christophe.helary@...>
Thank you Phil.
In one of the references that Bill mentioned (Matt Neuburg's TidBits article), there is a very enlightening explanation:
But here, he mentions only the accessibility API, which gives "GUI scripting", right? What other practical use cases are there for System Events scripting? Would you have a simple example? And thank you for the book reference. I'll be putting it either on my BD list or on my Xmas list :) Jean-Christophe |
|
2551phil
Before I get spanked for that, I should say “through any OSA-compliant language" (but the only one worth knowing is, of course, AS). It’s oft-mentioned around here, but haven’t seen it mentioned for a while, but if you’re looking to really understand the innards of AppleScript, you need to start (and for most questions you’ll end) here: Don’t be put of by the date. Most of what it contains is still relevant, and more importantly is the only source you’ll find for quite a lot of essential info. I’ve read it at least 3 times, and I probably need to re-read it again. Too much juicy stuff to be taken in with only a couple of readings. Best Phil @sqwarq |
|
2551phil
Cross-posting isn’t an issue here since these are all AppleScript groups, and may not have the same members.
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 |
|
Jean-Christophe Helary <jean.christophe.helary@...>
Thank you Bill.
toggle quoted message
Show quoted text
Jean-Christophe
|
|