Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#415 closed Bug (Fixed)

CUI compiled scripts won't execute batch files properly

Reported by: ResNullius Owned by: Valik
Milestone: 3.2.13.6 Component: AutoIt
Version: 3.2.12.1 Severity: None
Keywords: Cc:

Description

The following script when run uncompiled behaves as expected, you are greeted with the "Press any key to continue" message and the batch file waits for a key press.
But when compiled and run, it displays the message and immediately returns from the batch file without waiting for the key press.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

$tmpBatFile = FileOpen("tmpBatFile.cmd",2)
FileWriteLine($tmpBatFile,"@Pause")
FileClose($tmpBatFile)
ConsoleWrite(@CRLF & "Are you Ready?" & @CRLF & @CRLF)
RunWait("tmpBatFile.cmd")
ConsoleWrite("Done" & @CRLF)

Tested on Win2000/XP 32-bit with all service packs. Also with AutoIt beta 3.2.13.3.
The problem does not exist when compiled under v3.2.10.0 (with a compatible version of AutoIt3Wrapper).

Don't think it's a problem with the keyboard buffer, because on a different script that waits for user input via a batch file, I get an error like there was no input, whereas run on its own (from a cmd prompt) the batch file doesn't error even if you just hit return without any input.

Attachments (0)

Change History (5)

comment:1 in reply to: ↑ description Changed 11 years ago by Valik

Replying to ResNullius:

The following script when run uncompiled behaves as expected, you are greeted with the "Press any key to continue" message and the batch file waits for a key press.

That's because when running non-compiled, you are not running as a console application at all. So, this is irrelevant.

Tested on Win2000/XP 32-bit with all service packs. Also with AutoIt beta 3.2.13.3.
The problem does not exist when compiled under v3.2.10.0 (with a compatible version of AutoIt3Wrapper).

The first version to officially support CUI compilation is 3.2.12.0. Any other version is irrelevant.

That being said, I know what the issue is and how to fix it but I'm debating on whether or not fixing it is right.

comment:2 follow-up: Changed 11 years ago by Valik

  • Owner set to Valik
  • Status changed from new to assigned

comment:3 in reply to: ↑ 2 Changed 11 years ago by ResNullius

Replying to Valik:

That's because when running non-compiled, you are not running as a console application at all. So, this is irrelevant.

Just background info, didn't want to be accused of insufficient testing :-)

That being said, I know what the issue is and how to fix it but I'm debating on whether or not fixing it is right.

Of course, that is up to you.
If you decide not to fix, will you explain why it isn't right to?
Just seems to me that if a compiled GUI script can execute batch files like this OK then a CUI compiled one should be able to also.
Thanks Valik, I'll leave you alone now.

comment:4 Changed 11 years ago by Valik

  • Milestone set to 3.2.13.6
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed in version: 3.2.13.6

comment:5 Changed 11 years ago by Valik

There is a new flag (Inherit Parent Handles) which you must use in order for this to work how you expect.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Valik.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.