Jump to content

Don't pause script while running COM object method?


Recommended Posts

Hello!

I'm using the Windows Photo Printing Wizard in my script. Simplified example:

#include <ScreenCapture.au3>
#include <File.au3>

Local $sTempFile_1 = _TempFile(@TempDir, "~ISO_", ".bmp")
Local $sTempFile_2 = _TempFile(@TempDir, "~ISO_", ".bmp")

local $GUI = GUICreate("Example", 200, 200)
GUISetState(@SW_SHOW)
Sleep(250)

_ScreenCapture_CaptureWnd($sTempFile_1, $GUI)
Sleep(500)
_ScreenCapture_CaptureWnd($sTempFile_2, $GUI)

If Not @error Then
    Local $CommDlg = ObjCreate('WIA.CommonDialog')
    Local $Files = ObjCreate('WIA.Vector')
    If IsObj($CommDlg) And IsObj($Files) Then
        $Files.Add($sTempFile_1)
        $Files.Add($sTempFile_2)
        $CommDlg.ShowPhotoPrintingWizard($Files)
        FileDelete($sTempFile_1)
        FileDelete($sTempFile_2)
    EndIf
EndIf

The script runs fine, but unfortunately Microsoft decided to enable "Fit to Frame" by default and there's apparently no way to turn it off, so it has to be manually disabled each time I start the wizard.

The script pauses while the Wizard is showing, so I can't uncheck the checkbox within my script. Is there any way to run $CommDlg.ShowPhotoPrintingWizard($Files) in the background without using a second script? I tried adlibbing, but the script still pauses.

Link to post
Share on other sites

Is there any way to run $CommDlg.ShowPhotoPrintingWizard($Files) in the background without using a second script? I tried adlibbing, but the script still pauses.

No.

AutoIt scripts run in a single thread, if it is blocked then another script is needed to automate whatever is blocking it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to post
Share on other sites

It is technically "part of the script" because the method is called by the AutoIt script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...