1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AppleScript - Get the Bounds of Every open Window

Discussion in 'Programming/Internet' started by user4539850, Sep 12, 2018.

  1. user4539850

    user4539850 Guest

    I have been playing all day with getting this down. The goal being to generate an AppleScript which generates yet more AppleScript. I'll explain in more detail.

    THE DESIRED END RESULT: After arranging your windows how you like them follow up with launching this script. This will copy to your clipboard the necessary script to automatically launch, position, and resize the application windows to the current configuration. This would be so that I could send the script to other people who could then, upon launching this script, design their own custom layouts which could then be either pasted into Script Editor or possibly made into a service and bound to a hotkey using Automator.

    WHAT I'M CURRENTLY TRYING TO OVERCOME: I can't seem to get it to list the bounds for each window. I am currently running this script.

    tell application "System Events"
    set openApps to name of every process whose background only is false

    repeat with theItem in openApps
    set checkApp to theItem
    tell application checkApp to get the bounds of the front window
    end repeat
    end tell

    This spits out the following error every time without exception:

    error "System Events got an error: Can’t get application \"Finder\"." number -1728 from application "Finder"

    I'm not asking that someone solve the entire problem for me. Though any advice on the matter is always appreciated. The current hurtle is just to get the bounds of each window set to variables for use elsewhere in the script.

    Login To add answer/comment

Share This Page