Quick Apple Script Question

Joined
Jun 10, 2005
Messages
237
Reaction score
7
Points
18
Location
Indiana; there's more than just corn here
Your Mac's Specs
Powerbook G4 1.67 MHz
What is the apple script command to make a window minimize to the dock (like command+m)? (more specifically a window of terminal)
 
Joined
Aug 27, 2005
Messages
2,406
Reaction score
210
Points
63
Location
Fayetteville, AR
Your Mac's Specs
15" Powerbook G4 • 24" iMac • iPhone 3Gs
tell application "System Events"
set theButtons to {}

repeat with theApplication in application processes
repeat with theWindow in windows of theApplication
repeat with theButton in buttons of theWindow
if ((description of theButton) is "minimize button") then
set theButtons to theButtons & {theButton}
end if
end repeat
end repeat
end repeat

repeat with theButton in theButtons
click theButton
end repeat

--do it twice because it usually misses one the first time
repeat with theButton in theButtons
click theButton
end repeat
end tell


I got this from my scripts folder, there's whole bunch of junk in there and this one looks like it minimizes all open windows, but you should be able to figure it out. ;)

Off the top of my head, an easier one might be:

tell app "terminal"
activate
tell app "system events"
type "m" with command down
end tell
end tell

(I'm at work on a windows box and I can't test the syntax, so fool around with that.)
 
OP
ezhangin
Joined
Jun 10, 2005
Messages
237
Reaction score
7
Points
18
Location
Indiana; there's more than just corn here
Your Mac's Specs
Powerbook G4 1.67 MHz
looks like it would work if i could enter the command key, when i press that it minimizes the script editor lol
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top