I want to resize any window on my machine, which I accomplish with AppleScript, using GUI Scripting. The script looks similar to the following:
tell application "System Events"
set appProcess to the first process whose name is "Finder"
set appWindow to the front window of appProcess
set position of appWindow to {100, 100}
set size of appWindow to {10, 10}
end tell
Even though I set the width and height to 10px, the Finder will resize to at least a width of 344px and a height of 236px. I tested this with other applications and all had a minimum width, which differed depending on the application. For example, TextMate windows have a size of at least 213px * 129px.
Since I sometimes need to resize the windows to a smalled width and height, is there a way to override this minimum size, i.e. that my values are used even though they are "too small"?
If not, I need to know the minimum size, so that I know that the window will be bigger than expected. How would I accomplish that?
The concrete problem is the following: I am writing a window tiling manager, therefore I need to be in charge of the size of the windows. The minimum size creates to problems:
- My tiles may be too small for windows of a certain application, therefore the windows may overlap in other tiles.
- The window may be wider / higher than expected and therefore cross the borders of my screen. (For example, the window is near the lower right corner of my screen - I set the width and height accordingly to fit in the corner, but since it has a minimum size it won't fit.)
I am thankful for any recommendations. :)
Best wishes
Florian