On run {input, parameters} tell application "Finder set screenSize aux limites de la fenêtre du bureau set screenWidth à l'élément 3 de screenSize set screenHeight à l'élément 4 de screenSize fin du message
tell application "System Events"
tell dock preferences
if screen edge is bottom then
tell application "System Events" to tell process "Dock"
set dockSize to size in list 1
set dockHeight to item 2 of dockSize
set screenHeight to (screenHeight - dockHeight)
end tell
else if screen edge is left then
tell application "System Events" to tell process "Dock"
set dockSize to size in list 1
set dockHeight to item 1 of dockSize
set screenWidth to (screenWidth + dockHeight)
end tell
else
tell application "System Events" to tell process "Dock"
set dockSize to size in list 1
set dockHeight to item 1 of dockSize
set screenWidth to (screenWidth - dockHeight)
end tell
end if
end tell
set screenHeight to (screenHeight + 22)
set myFrontMost to name of first item of ¬
(processes whose frontmost is true)
end tell
try
tell application myFrontMost
set windowSize to bounds of window 1
set windowXl to item 1 of windowSize
set windowYt to item 2 of windowSize
set windowXr to item 3 of windowSize
set windowYb to item 4 of windowSize
set windowWidth to windowXr - windowXl
set windowHeight to windowYb - windowYt
if myFrontMost is "Terminal" then
set bounds of window 1 to {¬
round ((screenWidth - windowWidth) / 2) rounding as taught in school, ¬
round ((screenHeight - windowHeight) / 2) rounding as taught in school, ¬
round ((screenWidth + windowWidth) / 2) rounding as taught in school, ¬
round ((screenHeight + windowHeight) / 2) rounding as taught in school}
else
set bounds of window 1 to {¬
round ((screenWidth - windowWidth) / 2) rounding as taught in school, ¬
round ((screenHeight - windowHeight) / 2) rounding as taught in school, ¬
round ((screenWidth + windowWidth) / 2) rounding as taught in school, ¬
round ((screenHeight + windowHeight) / 2) rounding as taught in school}
end if
set the result to bounds of window 1
end tell
end try
return input
fin de course