how can i know that how many Preview App Window be opened ? So I can manipulate the window position base on the opened windows numbers.
Thanks
how many
don't know specific number
do you need to Tile them?
Use the WINDOWCOUNT() function, maybe?
yes,count the preview windows, tile them in different position base on how many counts
is the WINDOWCOUNT() can calculate the specific application ? like Preview App
If you look at the wiki page https://wiki.keyboardmaestro.com/function/WINDOWCOUNT you’ll see it works for whatever app is at the front.
Hey Somyan,
Preview is AppleScriptable, so you can talk to it directly:
tell application "Preview"
set winCount to count of windows
return winCount
end tell
For unscriptable apps you can use System Events UI-Scripting:
tell application "System Events"
tell application process "Preview"
set winCount to count of windows
return winCount
end tell
end tell
Run from an Execute an AppleScript action.
-Chris
As @tiffle said, it works on the FRONT MOST app.
If you do a Forum search on "windows" you will find many examples.
Search in the Macro Library to find macros others have written.
How do you access the result of the AppleScript from keyboard maestro?