Listing Applications by Index Order - was Frontmost Application...
Listing Applications by Index Order - was Frontmost Application...
- Subject: Listing Applications by Index Order - was Frontmost Application...
- From: Christopher Stone <email@hidden>
- Date: Wed, 24 Apr 2019 20:53:32 -0500
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