Viewbridgeauxiliary reikey5/20/2023 ![]() ![]() The more I delve into JXA, the more I think I should stick with AppleScript and get more clever about using do shell script with Perl or sed for string processing. The rule for constructing this sort of filter-where a function is applied to the property-is that its key is the property we’re going to filter on, and the value is yet another object whose key is the function to be applied to the property and whose value is the argument to that function.īut wait, there’s more! The name of the function comes from the AppleScript terminology, where multi-word functions are smashed together using camelCase, and the whole thing is preceded by an underscore. I think it’s obvious that we need to add a second piece to the object passed to whose, but that it should be javascript: This returns a long list-over 100 items-which I’m going to condense and format as one item per line: ).name() Tell application "System Events" to get every process ViewBridgeAuxiliary 0 B / 0 B (Apple) Virtual Memory Information: Available RAM 1.90 GB Free RAM 655 MB Used RAM 2.10 GB Cached files 1. Let’s start with something simpler: applescript: I’m writing about it here before I forget. In trying to write the JavaScript for Automation (JXA) equivalent of this, I learned (sort of) how parenthesis work in JXA when dealing with properties and filters by reading this excellent article by Christian Kirsch. It’s compact, easy to understand, and, I would say, the most useful example of AppleScript’s “English-like” syntax. The System Events preamble doesn’t matter. Tell application "System Events" to get the name of every process whose visible is true Because I’m not a computer scientist, I don’t know what to call it, 1 but I can give an example that came up recently: applescript: I don’t like programming in AppleScript in general, but there is one construct that I’ve always liked. Next post Previous post JXA’s parenthesis paradox
0 Comments
Leave a Reply. |