Applescript - the activate command makes application "half-active"
Move the activate command outside the tell application "System Events" block:

tell application "System Events" to tell (process 1 where frontmost is true)
    click (button 1 where subrole is "AXZoomButton") of window 1
end tell
activate application (path to frontmost application as text)


Or you could probably just remove the activate command completely.