GalerieBlogUnity3D ExamplesKontaktSitemapFullsitemap

applescript for browser windows resizing

Here is an example apple script which can resize a window to 1024 px wide and use the maximum screen height:

-- script based on:
-- http://stackoverflow.com/questions/273242/is-there-anything-like-winsplit-revolution-for-mac-os-x#2977827

-- hardcoded screen resolution:
property screenWidth : 1280
property screenHeight : 800
-- read screen resolution:
-- comment out next 2 line to speed up the script 
-- if you use always the same screen hight
set screenWidth to (do shell script "system_profiler SPDisplaysDataType | grep Resolution | awk '{print $2}'")
set screenHeight to (do shell script "system_profiler SPDisplaysDataType | grep Resolution | awk '{print $4}'")

tell application "System Events"
	set _everyProcess to every process
	repeat with n from 1 to count of _everyProcess
		set _frontMost to frontmost of item n of _everyProcess
		if _frontMost is true then set _frontMostApp to process n
	end repeat
	
	set _windowOne to window 1 of _frontMostApp
	set position of _windowOne to {0, 0}
	set size of _windowOne to {1024, screenHeight}
end tell

It works from launchbar with "run in Background" or from the AppleScript Menu Bar for the last top most window.

 Permalink

Kommentare

Keine (weiteren) neuen Kommentare erlaubt.