Does anyone know how to programatically close/dismiss a Print dialog window? I think I've got it tracked down to the Dialog class doit() method in Controls.sc:
= isClaimed FALSE
(while((not isClaimed))
(self:eachElementDo(#cycle))
= hEvent (Event:new())
GlobalToLocal(hEvent)
= isClaimed (self:handleEvent(hEvent))
(send hEvent:dispose())
(self:check)
(if( (== isClaimed -1) or (not busy) )
= isClaimed FALSE
EditControl(theItem 0)
break
)
Wait(1)
)
If I'm reading this correctly, this code just loops, creating new events & checking to see if they are handled in the handleEvent() method by mouse click or specific keys before it bails out and closes the print window.
I know that I could have the window close after a certain amount of time elapses. I did try to just fake a user input with a keystroke or mouse event, but it isn't consumed (I issued these events from within the main script). Probably because the doit() in the print is issuing it's own event, waiting for it to be claimed and ignoring all other events.
Oh, by the way, I did try this in my room script:
(method (doit)
(super:doit())
DisposePrintDlg()
)
Which conceptually seems like it should work, but it doesn't - probably because we are stuck in the while loop within the controls script.