Re: What is "system events" ?
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>.
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
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.
|
|
Please Contribute to the AppleScript Wiki
#wiki
Greetings to all!
We have drafted the first rough draft of the AppleScript Wiki , a great feature provided by groups.io. The Wiki doesn't even have an outline yet, but I wanted to invite each and every one of you to join in making this a great and useful wiki. We all know of the Apple AppleScript documentation, which is good, but sometimes perhaps it is unclear or misleading. And, like all documentation, even a few errors can creep in here and there. While we can't control, or even influence the Apple documentation, we can provide our own here, that will hopefully improve on and augment it. We are just getting started, and are looking for wiki contributors of all sizes and shapes. You don't have to be an "expert", or a "guru" to contribute, but you do need to be correct. So please double-check ✅✅ your posts to this wiki to make sure they are factual, correct, and clear. One of the great features of wikis is that they can be easily edited by multiple authors. So, if you spot a mistake, an error, or you find the text confusing, please jump in and edit the wiki article to make it better. If you are not sure about what is correct, or you would like confirmation first, then just post a topic here (with a hashtag of " We want everyone to know they can rely on the information they find in this wiki! 😀 One technical note: The Wiki has been setup to use the Markdown format for posting. So before you create or edit a Wiki page, you will need to go to [YourProfile] > Account > Preferences > Post Preference and choose Markdown. If you have any suggestions concerning the wiki, please feel free to post here. So, please join with us in making this the best AppleScript wiki on the web❗️JMichaelTX
|
|
Raising the 'auto open zipped .dmg's' again.
Brian Christmas
G’day scripters.
Several days ago I posted here, and also in the Apple forums, that in High Sierra, and after the second last Sierra Security update, zipped disk image files no longer download and auto open the .dmg. Auto opening of zipped & blessed .dmg files use to be the norm. No longer. I have found others that have asked the same question some time back, in other forums, and not received an answer. In the Apple forum, one member argued that this should be the way security should work, but I pointed out that while zipped dmg's unzip to the .dmg, the blessed .dmg does not auto open, but the user has to open the dmg without possibly knowing the contents anyway, so what’s the point in stopping it opening from a zip to opened dmg in one step? Much, much more user friendly, and removes the necessity to open the downloads folder, and double click the .dmg, which new users would be unfamiliar with. And, you can’t post a folder background, or dialog, to explain what to do, until AFTER the .dmg is manually opened. As this seems to be a recent, unnecessary (in my opinion), development, my question is… Should I file a bug report under ‘usability’? If anyone would like to test the procedure, under either Mavericks, Sierra, or High Sierra, one of my links is….http://meselfsoftware.com/Art%20Archiver%20Secretary/ All thoughts appreciated! Regards Santa
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
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 messageShow quoted text
And, yes, ASObjC. I'll need to bite the bullet eventually... Jean-Christophe
On Oct 21, 2017, at 2:44, 2551phil <2551phil@gmail.com> wrote:On 20 Oct 2017, at 23:10, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:Same author.
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
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 messageShow 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
|
|
Re: What is "system events" ?
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 messageShow quoted text
|
|
Re: What is "system events" ?
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.
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
2551phil
On 20 Oct 2017, at 23:10, Jean-Christophe Helary <jean.christophe.helary@gmail.com> 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
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
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
|
|
Re: What is "system events" ?
Jean-Christophe Helary <jean.christophe.helary@...>
Thank you Bill.
toggle quoted messageShow quoted text
Jean-Christophe
|
|
Re: What is "system events" ?
Bill Cheeseman
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.
|
|
What is "system events" ?
Jean-Christophe Helary <jean.christophe.helary@...>
Is there a place that describes what System Events is, how it works, why it is necessary for some sorts of scripting, etc.?
Jean-Christophe
|
|
Activate Terminal and put it in Fullscreen mode
Jean-Christophe Helary <jean.christophe.helary@...>
Here is what I came up with, after many hours of testing why I had inconsistent behavior. It took me a long while to find the 2 issues I mention in my comments and find workarounds.
on ActivateFullScreenTerminal() (* Creates a fullscreen Terminal new tabbed window in which to launch a command *) tell application "Terminal" try # to see if Terminal is launched and open a new tab tell application "System Events" to tell application process "Terminal" set frontmost to true keystroke "t" using {command down} (* for reasons unkown to me creating a tab *after* putting the window in fullscreen mode requires a "delay" of 2 or more on my machine, but creating the tab *before* is instantaneous.*) end tell try #to see if a window exist, check if it is in fullscreen if number of columns of first window is less than 115 then tell application "System Events" to tell application process "Terminal" # put it in fullscreen keystroke "f" using {command down, control down} (* I found that if a window is not in fullscreen and has a tab created in it and *then* is put to full screen, the front tab size will be the size of a fullscreen window but the other tabs will keep their pre-fullscreen size in their properties, until they are put to the front. That creates all sorts of problems when testing fullscreen size since some tabbed windows are "visually" fullscreen but programatically their properties are not updated yet. *) end tell end if on error # create a window and put it in fullscreen tell application "System Events" to tell application process "Terminal" keystroke "n" using {command down} keystroke "f" using {command down, control down} end tell end try on error # launch Terminal and put the default window in fullscreen tell application "Terminal" to activate tell application "System Events" to tell application process "Terminal" keystroke "f" using {command down, control down} end tell end try end tell end ActivateFullScreenTerminal
|
|