• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Listing Applications by Index Order - was Frontmost Application...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Listing Applications by Index Order - was Frontmost Application...


  • Subject: Re: Listing Applications by Index Order - was Frontmost Application...
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Thu, 25 Apr 2019 18:18:45 +0900

Beautiful :)

JC

> On Apr 25, 2019, at 10:53, Christopher Stone <email@hidden>
> wrote:
>
> Hey Jean-Christophe,
>
> Yvan has given you a working solution for this, but there is a way to list
> apps by index order.
>
> The caveat is that they MUST be visible – hence the System Events code.
>
> I've massaged the output of `lsappinfo` a trifle, but I've left in the serial
> number – so you can see what they look like.
>
>
> --
> Take Care,
> Chris
>
> ------------------------------------------------------------
> # Auth: Christopher Stone
> # dCre: 2019/04/24 20:29
> # dMod: 2019/04/24 20:29
> # Appl: Miscellaneous, System Events, Shell
> # Task: List Applications by Index order (front-to-back).
> # Libs: None
> # Osax: None
> # Tags: @Applescript, @Script, @System_Events, @List, @Applications, @Index,
> @Order, @Front_to_Back
> ------------------------------------------------------------
>
> tell application "System Events"
>     set invisibleProcesses to processes whose background only is false and
> visible is false
>
>     # Apps MUST be VISIBLE to be seen by `lsappinfo`.
>     repeat with i in invisibleProcesses
>         set visible of i to true
>     end repeat
>
> end tell
>
> set shCMD to "
> lsappinfo visibleProcessList \\
> | awk -v OFS=\"\\n\" '{$1=$1}1'"
> do shell script shCMD
>
> ------------------------------------------------------------
>
> To ditch the serial numbers and underscores change the shell command to:
>
> set shCMD to "
> lsappinfo visibleProcessList \\
> | awk -v OFS=\"\\n\" '{$1=$1}1' \\
> | sed -E '-e s!^.*\"([^\"]+)\".*$!\\1!' -e 's!_! !'
> "
>
> ------------------------------------------------------------
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Listing Applications by Index Order - was Frontmost Application... (From: Christopher Stone <email@hidden>)

  • Prev by Date: Listing Applications by Index Order - was Frontmost Application...
  • Next by Date: Scripting VLC
  • Previous by thread: Listing Applications by Index Order - was Frontmost Application...
  • Next by thread: Scripting VLC
  • Index(es):
    • Date
    • Thread