Schlitzgesicht

Don't pause script while running COM object method?

4 posts in this topic

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.

Share this post


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.

Share this post


Link to post
Share on other sites

No.

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

I know, but since ShowPhotoPrintingWizard isn't technically "part of the script", it runs in a seperate thread anyway I assumed, like ShellExecute/ShellExecuteWait.

Share this post


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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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