RosettaCodeData/Task/OLE-automation/M2000-Interpreter/ole-automation.m2000
2023-07-01 13:44:08 -04:00

31 lines
732 B
Text

Module CheckAutomation {
ExitNow=false
Declare WithEvents Alfa "WORD.APPLICATION"
\\ minimize console
Title "Minimized- Waiting", 0
Wait 300
Print "ok"
With Alfa, "Visible", True
Function ALFA_QUIT {
Print "Why you close Word?"
ExitNow=True
}
M=0
Every 20 {
If ExitNow then exit
M++
If M>500 then exit
}
Try {
Method Alfa, "QUIT"
}
Declare Alfa Nothing
if ExitNow then {
Print format$("Finish {0:2} sec", M/1000)
} Else {
Print "Close Word manually"
}
\\ show again console
Title "ok"
}
CheckAutomation