Sign in to follow this  
Followers 0
MesaCorp

OK on Win95 Problems on WinXP

8 posts in this topic

I am using AutoIt to run a client for an old Novell server application to print reports. The client runs in a DOS box. The script was working fine running on a Windows 95 pc. The script has been moved to a virtual windows xp machine and now I have problems.

The script uses Run to start the client application and to redirect stderr and stdout using $STDERR_CHILD + $STDOUT_CHILD. StdoutRead and StderrRead are used to get text from the client application.

On Windows 95 I was able to use the full path to executable in the Run command. The executable is on mapped drive on the Novell server.

On XP I have to use a local batch file which changes directories to the mapped drive then starts the executable.

The batch file works fine from windows. When the batch file is run by the script I get the echo of the batch file commands plus 6 0xFF characters then the client application starts and hangs, the cursor is an arrow and hourglass. The application does not respond to input even after the script ends.

If I use the Run command without redirecting stderr and stdout then the application runs fine with the script. The script can also control the application if I use ShellExecute and WinGetText. But in both of these setups I do not get any text back from the application. Getting the applications responses is critical to the script since it must choose several possible paths based on responses to input.

Any ideas about why the application is hanging would be greatly appreciated.

Share this post


Link to post
Share on other sites



Don't use a batch file to run the program, when the program starts from the batch file, the batch file stops sending anything, and your program hangs until the child process of the batch ends. Anything in the batch file can probably be done in AutoIt, and then you can read the output from the program itself directly.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

When I use the full path to the executable I get "Could not execute LIS" as a response, LIS.exe is the executable and the application does not start. I get the same message if I go to Start -> Run and type in the same full path to the executable.

Share this post


Link to post
Share on other sites

AutoIt version 3.3.8.1

The part of the script that starts the application and then gets input.

;$exePath = "c:mesacitation.bat"

$exePath = "l:lis.exe"

$exeWorkingDir = "c:mesa"

$exeTitle = "C:\Windows\System32\cmd.exe"

dbg("at run : " & $exePath) ;dbg func - outputs text and waits for response

$pid = Run(@ComSpec & " /c " & $exePath, $exeWorkingDir, @SW_MINIMIZE, $STDERR_CHILD + $STDOUT_CHILD)

if $pid == 0 Then

audit("ERROR-Run command failed $pid: " & $pid) ; audit func - writes to audit file

Exit

EndIf

dbg("$pid: " & $pid) ;dbg func - outputs text and waits for response

AutoItSetOption("SendKeyDelay", $sendKeyDelay)

WinActivate($exeTitle)

$text = getwindowtext() ; getwindowtest func - get windows text

dbg("send enter? $pid: " & $pid) ;dbg func - outputs text and waits for response

;Move past splash screen

WinActivate($exeTitle)

Send("{ENTER}")

$text = getwindowtext() ; getwindowtest func - get windows text

Share this post


Link to post
Share on other sites

I had problems when I used full path to EXE in Run() with @compsec /c

so try something like this:

$exePath = "lis.exe"
$exeWorkingDir = "l:"
$pid = Run(@ComSpec & " /c " & $exePath, $exeWorkingDir, @SW_MINIMIZE, $STDERR_CHILD + $STDOUT_CHILD)

Share this post


Link to post
Share on other sites

The path and working directory change did not work. Thanks everyone for your input so far.

If I drop the ", $STDERR_CHILD + $STDOUT_CHILD" from the Run command the application responds to the script. I don't get text from the application since I'm not redirecting its output.

With ", $STDERR_CHILD + $STDOUT_CHILD" in the Run command the application does not respond. It's almost like I'm redirecting stdin.

Any more ideas.

$exePath = "l:lis.exe"
$exeWorkingDir = "l:"
$exeTitle = "C:\Windows\System32\cmd.exe"
dbg("at run : " & $exePath) ;dbg func - outputs text and waits for response
$pid = Run(@ComSpec & " /c " & $exePath, $exeWorkingDir, @SW_MINIMIZE, $STDERR_CHILD + $STDOUT_CHILD)
if $pid == 0 Then
    audit("ERROR-Run command failed $pid: " & $pid) ; audit func - writes to audit file
    Exit
EndIf

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
Sign in to follow this  
Followers 0