Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Not working from script menu' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Not working from script menu
Authored by: ubi on Dec 11, '03 03:26:48AM
I used the script editor to save the generalized version of this, which I called matchall.scpt, and another version that maximizes all windows for my 12-inch powerbook (maxall.scpt; see below). If I click Run in the script editor, it works (only for the script editor windows, of course). But when I select it from the script menu, it doesn't function. Help, please!

-- begin maxall.scpt --
tell application "System Events"
	set theApp to get name of first process whose frontmost is true
end tell
tell application theApp
	set winlist to every window
	repeat with curwin in every item in winlist
		tell curwin
			set bounds of curwin to {0, 20, 1023, 724}
		end tell
	end repeat
end tell
-- end maxall.scpt


[ Reply to This | # ]
Not working from script menu
Authored by: ags on Dec 13, '03 12:50:29PM

I couldn't get the general version of this script to work from the Script Menu either. The variable theApp always contained "System Events". I'm no AppleScript guru, so I borrowed a few lines from an example on Apple's web site called "Add Front App to Menu". There's probably a shorter way to set theApp, but this works for me:


try
 set the front_app to the path to frontmost application
 set the theApp to the displayed name of (info for the front_app)
end try

tell application theApp
 set winrect to bounds of 1st window
 set x to 1st item in winrect
 set y to 2nd item in winrect
 set w to (3rd item in winrect) - x
 set h to (4th item in winrect) - y
 set winlist to every window
	
 repeat with curwin in every item in winlist
  tell curwin
   set currect to bounds of curwin
   set curx to 1st item in currect
   set cury to 2nd item in currect
   set curw to (3rd item in currect) - curx
   set curh to (4th item in currect) - cury
   -- swap the commenting of the next two lines
   -- if you want horizontals to match too
   set bounds of curwin to {curx, y, curx + curw, y + h}
   --set bounds of curwin to {x, y, x + w, y + h}
  end tell
 end repeat
end tell


[ Reply to This | # ]
Fixed!
Authored by: ubi on Dec 14, '03 02:26:14PM

Thanks, ags.

Your solution works. Finally, I can control how my windows get zoomed.



[ Reply to This | # ]