Date   

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>.

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.



-- 

Bill Cheeseman - wjcheeseman@...


Re: What is "system events" ?

Jean-Christophe Helary <jean.christophe.helary@...>
 



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?

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 "#wiki"), and present the issue/question.

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!

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:
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
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


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?

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:
crosspost

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.

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@...


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. 

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


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 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 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:
crosspost

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.

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@...


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
 


On 21 Oct 2017, at 01:24, Steve Mills <sjmills@...> wrote:

crosspost

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:
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
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.

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.

In one of the references that Bill mentioned (Matt Neuburg's TidBits article), there is a very enlightening explanation:


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.

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
 


On 20 Oct 2017, at 22:50, 2551phil <2551phil@...> wrote:

 it’s whole purpose is to be accessed through Applescript

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.

Jean-Christophe 

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.?


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.

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.?

-- 

Bill Cheeseman - wjcheeseman@...


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

181 - 200 of 275