Jump to content
Sign in to follow this  
phaze424

ProcessClose() not working with a PID

Recommended Posts

phaze424

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

Share this post


Link to post
Share on other sites
botanic

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

Share this post


Link to post
Share on other sites
Generator

This works

$PID=Run("notepad.exe")
ProcessClose($PID)

Edit: Try changing the flag parameter.

Edited by Generator

Share this post


Link to post
Share on other sites
botanic

im looking at it the "> aTextFile.txt" could very well be the culprit

Share this post


Link to post
Share on other sites
ResNullius

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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.