It’s been a long time. The driver of a printer always jumps out of a window and tells you what’s wrong. Because my program comes out automatically and belongs to a machine that has not been supervised for a long time, when this information jumps out, it will stop the program. At this point, think of pressing the ESC key, and then you can continue. To solve this problem in the future, I used VBScript to write a few lines of file instead of pressing this esc.
Core code
'Test function
PressESC "Windows Internet Explorer", "{ESCAPE}"
'The function we're going to deal with ___________
Function PressESC(WindowTitle, KeyCommand)
Set objShell = CreateObject ("WScript. Shell")'Defines a WHS object
If objShell. AppActivate (Windows Title)'Then'Check if there is any Windows we want to check out'___________
ObjShell. AppActivate Windows Title'Focus the Window
ObjShell. SendKeys KeyCommand'Send an ESC key
End If
End Function
Save the above code as a VBS file, and then set the VBS as a Scheduler for Windows, you can press ESC automatically.