Jump to content

ProcessClose() not working with a PID


Recommended Posts

I considered putting this on the bug reports board, but it's more likely that I'm doing something wrong, so here goes. I'm trying to write a seemingly simple wrapper program for a command-line program, but for some reason this doesn't work:

Global $PID = Run(@ScriptDir & "\someDirectory\someApp.exe > aTextFile.txt", @ScriptDir, @SW_HIDE)
; Do some stuff
ProcessClose($PID)

The process simply isn't killed. Of course, ProcessClose() has no return value (1 every time) and doesn't set @Error, so I don't really know what's going on. Any insights?

Edited by phaze424
Link to comment
Share on other sites

i dunno ive never done it that way I guess there are issues :)

EDIT:

Global $PID 
$PID = Run(@ScriptDir & "\someDirectory\someApp.exe > aTextFile.txt", @ScriptDir, @SW_HIDE)
; Do some stuff
ProcessClose($PID)

Prolly cant be used in a Global? Maby?

EDIT2:

NOTE: I personally don't like to declare stuff on the same line as it is set to a global, if that is the issue then you'll see my reasoning for that practice :(

Edited by botanic
Link to comment
Share on other sites

I considered putting this on the bug reports board, but it's more likely that I'm doing something wrong, so here goes. I'm trying to write a seemingly simple wrapper program for a command-line program, but for some reason this doesn't work:

Global $PID = Run(@ScriptDir & "\someDirectory\someApp.exe > aTextFile.txt", @ScriptDir, @SW_HIDE)
; Do some stuff
ProcessClose($PID)oÝ÷ Ù8^¦ºzË,jeÊ+'ßÛdY^tçÜ¢êìxúèqë,
Z,z¬Þ¶ê罩n{W¯z¼­g×hzÉ÷öÛ´J뢻(!Ú'ßÛky©eÊIèÃZ·l§À(§²(!¶Ïêº^"ËayÊ&©Ý)ÞjZrÛ¢)àÝý²:N¨+h®Ø^²Ö­zâ¶Úòjëh×6Run(@COMPSPEC & " /k " & @ScriptDir & "\someDirectory\someApp.exe > aTextFile.txt", @ScriptDir, @SW_SHOW)

This will leave the command prompt open until you explicitly exit it.

Also, you have the working dir set to @Scriptdir, but the command line executable is located in a subdirectory of that. Some command line programs need the working dir to be the same as their location.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...