AppleScript to Minimize a Word Document

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

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

The script is as follows:

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.

I would greatly assistance and/ or input on this.

Thanks.

Seems like a Microsoft word bug.

If it helps you could set the window bounds to the minimum

	set its bounds to {0, 25, 400, 425}

Or you could try GUI scripting to execute the minimize command in the menu.

@estockly, thank you for taking the time to respond noting:

  1. GUI Coding: Although a great idea it is beyond my programming skills. I am a real newbie with this.

  2. Minimize Bounds: Another good idea but not needed, see 3. below.

  3. SOLUTION: There is a parameter called COLLAPSE which works identical to minimize. I set collapse to true and it worked. Another user pointed this out to me!

Very frustration when one encounters these bugs! You can spend hours trying to do the impossible, not fun!