Post

Replies

Boosts

Views

Activity

Speeding Up Code
I'm made a script that iterates through all windows and restores minimized windows. However, the script is quite slow. I'm wondering how to speed it up. I believe part of why the code is so slow is that it's looking at every process instead of every foreground process. Is it possible to do something like "repeat with p in every foreground process" or speed up this script through other means? on run {input, parameters} set windowNames to {} tell application "System Events" repeat with p in every process repeat with w in every window of p if value of attribute "AXMinimized" of w is true then set value of attribute "AXMinimized" of w to false end if end repeat end repeat end tell end run
2
0
676
Aug ’23
Iterate Window in Specified Application
I get the error code: System Events got an error: Can't get application of "Application Name" during this line repeat with currentWindow in every window of application foregroundApp of this code on run tell application "System Events" set foregroundApps to displayed name of (every process whose background only is false) as list repeat with foregroundApp in foregroundApps set appName to foregroundApp as text if exists (window 1 of process appName) then repeat with currentWindow in every window of application foregroundApp end repeat end if end repeat end tell end run I'm guessing I'm missing something like set x to foregroundApp as y repeat with currentWindow in every window of application x How do I get the windows of the application foreground app?
0
0
660
Sep ’23
Iterate Window instead of Mass Operation
I'm trying to modify this code to work iteratively: on run {input, parameters} tell application id "com.apple.systemevents" to set the value of attribute "AXMinimized" of every window of every process to false end run Something along the lines of : on run {input, parameters} foreach windows of every process tell application id "com.apple.systemevents" to set the value of attribute "AXMinimized" to false end run Is this possible?
2
0
676
Aug ’23