Need help with Applescript syntax

Hi all, i am trying to check with an if then method if an App is minimized, i am such far but there is one line which i gure out how to syntax it:

tell application “System Events”
set CurrWin to name of the first process whose frontmost is true
end tell
if window [CurrWin] then
say “true” using “Alex”
end if

The bolded text is the part where it sould be checked if the Window of the App is already minimized or not, how to write it dowwwwworhelp^^

Hi,

… something like this ?

tell application "System Events"
	set proc to name of the first process whose frontmost is true
	tell process proc
		-- add error trapping here
		tell its window 1
			set w to its name
			if get value of attribute "AXMinimized" is true then say "Window " & w & " is minimized"
		end tell
		--
	end tell
end tell

Thats awesome it seems to work but there is one implementation issue, plz take a look at this:

The Goal of it should be to minimize in first try and then check if it worked to decide if it should be tried again or not, that was the main meaning of this Question, so here is the code bu tit doesn’t work just as it is now, so the Window minimizes and than i get a system alert sound because the script tries to minimize the Window once again
even if has worked the first try already, so how to combine this two parts?`

And thx a lot for the first help again^^

Here is the current script:

tell application "System Events"
	
	keystroke "m" using command down
	key down shift
	delay 0.3
	key up shift
end tell

tell application "System Events"
	set proc to name of the first process whose frontmost is true
	tell process proc
		-- add error trapping here
		tell its window 1
			set w to its name
			if get value of attribute "AXMinimized" is true then
				tell application "System Events"
					keystroke "m" using command down
					key down shift
					delay 0.3
					key up shift
				end tell
			end if
		end tell
		--
	end tell
end tell

say "Collapse" using "Alex"

OMG am i dumb sometimes, nevermind it works forgot to change from true to false on the IF Clause ^^

Anyway, thx a lot

try this script out with something like Cornerclick or Quicksilver triggers to get the SLome Version of minimized Windows by default as soon you trigger it^^