Jump to content

Recommended Posts

Posted

I have a compiled AutoIt3 script that shall start a Python script. I use Run(...) for this. However, depending on the way the compiled is started, the window does not show if the compiled script itself has no window handle. Why is this the case?

All is fine if I start the compiled script in such a way it has its own window.

My platform is Windows 10.

For reference, a "minimum" sample that shows the problem. (As $PID_Progress is non-zero, it is certain that the process is actually started in both cases.)

#requireadmin
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <WinAPIFiles.au3>
#include <Array.au3>
#include <File.au3>
#include <Date.au3>
#include <WinAPISysWin.au3>
#include <WinAPI.au3>

; logging helper function
Func _Trace(Const $msg)
   Local $logFile = FileOpen(@ScriptDir & "\testpython.log",$FO_APPEND )
   FileWrite($logFile, _Now() & " : " & $msg & @CRLF)
   FileClose($logFile)
EndFunc

; Script Start
ProgressOn("Windows Snapin", "Installation", "Start installing packages", -1, -1, $DLG_MOVEABLE)

_Trace("Before executing Python")

; show progress window
Local $PID_Progress = Run(@ComSpec & " /c " & "InstallerProgress.py", "", @SW_MAXIMIZE, $RUN_CREATE_NEW_CONSOLE)

_Trace("After executing Python" & $PID_Progress)

; Script end

 

Posted
Quote
$RUN_CREATE_NEW_CONSOLE (0x10000) = The child console process should be created with it's own window instead of using the parent's window. This flag is only useful when the parent is compiled as a Console application.

use #AutoIt3Wrapper_Change2CUI=y

  • 4 weeks later...
Posted (edited)

When the #AutoIt3Wrapper_Change2CUI=y directive is used
call your application from the dos console

Edited by ioa747

I know that I know nothing

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...