Minimize Microsoft Word Window Not Working

I have written to a Microsoft Word AppleScript which among other things:

  1. Start Word2
  2. Open a Word file
  3. Positions the Word file / window
  4. Minimizes the Word file / window

The script is as follows:


-- Open Word and Load To Do List File
tell application "Microsoft Word"
	activate
	
	set currentDate to current date
	set currentYear to year of currentDate as text
	set currentMonth to month of currentDate as number as text
	set currentDay to "01"
	
	set filePrefix to currentYear & currentMonth & currentDay
	set fileToOpen to "/Users/JoelC/Documents/Projects On The Go/To Do Lists/" & filePrefix & "_joel cohen outstanding items list.docx"
	set fileWindow to currentYear & currentMonth & currentDay & "_joel cohen outstanding items list.docx"
	
	open fileToOpen
	
	tell its window fileWindow
		set bounds to windowPosition
		set miniaturized to true
	end tell
end tell


The problem that I am having is that the minimize command is not working.

When I dig into the Word Dictionary I see the below which appears – at least to me – as though Word is not reading / responding to the Miniaturized property (i.e. I would have expected a true or false value) which explains why the above code is not minimizing the Word window.

https://www.dropbox.com/s/5ocmkphjz36hwcu/20211210_word_miniaturized_screenshot.png?dl=0

I would greatly assistance and / or input on this.

Thanks.

I am using Office 365 for Mac and running OS X 10.15 (Catalina)

Try ‘collapsed’.

@Mockan, again, a HUGE thank you!

I must have poured through that Dictionary 20+ times and never noticed the collapsed property as I was so focused on the minimize and miniaturized properties from other applications!

I do think it weird that the miniaturized property is not being read but so be it! I ran into a similar problem with iMessages participant property which appears to be macOS version related.

Appreciate it greatly!

It’s definitely a challenge to figure out sometimes and the documentation is generally pretty thin (or worse).

What I did here was ‘properties of window “Document1”’ for a normal window. Then minimize the window and get the properties again and compare. What changed was the ‘collapsed’ property.

@Mockman, great idea, I will remember that trick!

Thank you!