Sign in to follow this  
Followers 0
mws

RUN and WinClose issues

6 posts in this topic

I am maintaining 2 scripts, one to start applications, and one to stop them. There is one application, a 32 bit VB6 app, which suddenly fails to run (Run returns zero). When I do a WinClose on that same app, WinClose returns 1, but the app doesn't close (it used to close). The funny thing is, there are other VB6 apps which will start and stop with these same scripts, but this one application will not. The stop script used to use Send("!{F4}"), but even that quit working.

Does anyone know of any issues which might affect the success of Run or WinClose in this case?

The OS is Windows 2008 server, 64 bit.

The version of AutoIT is 3.3.0.0, and hasn't changed.

I compiled the AutoIT scripts for 64 bit.

TIA - Mike

Share this post


Link to post
Share on other sites



I am maintaining 2 scripts, one to start applications, and one to stop them. There is one application, a 32 bit VB6 app, which suddenly fails to run (Run returns zero). When I do a WinClose on that same app, WinClose returns 1, but the app doesn't close (it used to close). The funny thing is, there are other VB6 apps which will start and stop with these same scripts, but this one application will not. The stop script used to use Send("!{F4}"), but even that quit working.

Does anyone know of any issues which might affect the success of Run or WinClose in this case?

The OS is Windows 2008 server, 64 bit.

The version of AutoIT is 3.3.0.0, and hasn't changed.

I compiled the AutoIT scripts for 64 bit.

TIA - Mike

AFIAK, none of the info you provided is going to help, the only thing I can think of is spelling errors, etc.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

AFIAK, none of the info you provided is going to help, the only thing I can think of is spelling errors, etc.

The code which does the shutdown of the app is handled in a function, which is passed the application title. Previously in the code, the title matching was set as: AutoItSetOption("WinTitleMatchMode", 2).

The Log record written after the WinClose is:

12/08/2009 14:55 ShutdownOtherApp($pAppTitle): $pAppTitle=AIRES Update Builder - , WinClose($pAppTitle) RC $j=1

The code which does the startup is shown below. The Function StartOtherApp is passed an index, and the program spec is found in the array. I added the $StartInDir logic, thinking that might make a difference, but the result is the same for this one application.

The Log record written after the call of Run is:

12/08/2009 13:41 StartOtherApp($i): $i=1, $OtherAppInfo[$i][2]=D:\PCAUBldr\PCAUBldr.exe, $StartInDir=D:\PCAUBldr, $return=0

I inherited these scripts, and was not the original author. The just quit working with respect to this one application. Anyone have any thoughts?

Func ShutdownOtherApp($pAppTitle)
Dim $j 
    
  if WinExists($pAppTitle) then
    if ($pAppTitle = "ALI Annunciator") then
      ...

    Else
      $j = WinClose($pAppTitle)
      writeToErrorLog("ShutdownOtherApp($pAppTitle): $pAppTitle=" & $pAppTitle &  ", WinClose($pAppTitle) RC $j=" & $j)
    EndIf       
  EndIf 
EndFunc

Func writeToErrorLog($sMsg)
    Dim $s
        $s = @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & " " 
        
        FileWriteLine($LOGFILENAME,$s & $sMsg)
EndFunc

$OtherAppInfo[1][0] = "AIRES Update Builder"
$OtherAppInfo[1][1] = "AIRES Update Builder - "
$OtherAppInfo[1][2] = "D:\PCAUBldr\PCAUBldr.exe"

AutoItSetOption("WinTitleMatchMode", 2)

Func StartOtherApp($i)
Dim $StartInDir
Dim $pos
  ; if application is not running start it
  if not WinExists($OtherAppInfo[$i][1]) then
    if ($OtherAppInfo[$i][2] <> "") then
      ; Get the PATH portion of the Program to run, and use it as the Working Dir Parm to run - 12/4/2009 mws
      $pos = StringInStr($OtherAppInfo[$i][2],"\",0,-1)
      if $pos = 0 Then
        $StartInDir = ""
      Else
        $StartInDir = StringLeft($OtherAppInfo[$i][2], $pos - 1)
      EndIf
      $return = Run($OtherAppInfo[$i][2],$StartInDir)
      if ($return == 0) then
        writeToErrorLog("StartOtherApp($i): $i=" & $i & ", $OtherAppInfo[$i][2]=" & $OtherAppInfo[$i][2] & ", $StartInDir=" & $StartInDir & ", $return=" & $return)
      EndIf
    EndIf
  EndIf
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You could try compiling your script 32 bit - if you get the same behaviour, that would at least

eliminate the possibility of a 64 bit bug ...

whim

[edit: spelilng]

Edited by whim

Share this post


Link to post
Share on other sites

You could try compiling your script 32 bit - if you get the same behaviour, that would at least

eliminate the possibility of a 64 bit bug ...

whim

[edit: spelilng]

I did compile for 32 bit, and it makes no difference. I may try WinKill() or ProcessClose() next. The frustrating thing is that it only happens with this one VB6 app.

Thanks - Mike

Share this post


Link to post
Share on other sites

The funny thing is, there are other VB6 apps which will start and stop with these same scripts, but this one application will not. The stop script used to use Send("!{F4}"), but even that quit working.

Hmm very interest problem.

Try to close your application with:

run("cmd.exe /c tskill yourapplication.exe", "", @sw_hide)

May be it help...


[size="5"] [/size]

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