主要是使用到了示波器hardcopy这个模块功能,关键点是
- destination设置为file
- print选项action即可
def SaveScreenImage(self,filename): #,ImageFileFormat
# ImageFileFormat range: JPEG,PNG,TIFF,BMP
command = r"""vbs 'app.HardCopy.PreferredFilename= "{}.png"' """.format(filename)
self.res.write(command)
command_print = r"""vbs ' app.HardCopy.Print ' """
self.res.write(command_print )