file execushion

BlitzPlus Forums/BlitzPlus Programming/file execushion

Heliotrope(Posted 2010) [#1]
Is there a way to detect if a file is runing?

blackgecko(Posted 2010) [#2]
cmd.exe returns a list of all running tasks after entering the command 'tasklist'.
Using CreateProcess, you should be able to read this list in BlitzPlus.

Heliotrope(Posted 2010) [#3]
What would the code be like?

blackgecko(Posted 2010) [#4]
I admit, I don't know it...
perhaps something like that:
stream = CreateProcess("C:\Windows\System32\cmd.exe")
while not eof(stream)
writeline stream,"tasklist"
while not eof(stream)
  name$ = readline(stream)
  if name$ = name_of_the_file_you_want_to_check$ then

But with this code B+ crashes...

Heliotrope(Posted 2010) [#5]
what is createprocess?

blackgecko(Posted 2010) [#6]
An undocumented command.
I don't know if an english command description for this command exists.
I can give you a german one: Link

Note: As this is an undocumented command, there is no warranty that it works properly or that it will exist for ever.

Sauer(Posted 2010) [#7]

Basically you would use Createprocess to start a console based .exe. Then, with BlitzPlus' stream read/write commands, give the program input and output. Essentially, its a way to have two programs "talk" to each other.

Heliotrope(Posted 2010) [#8]
could I use include

Sauer(Posted 2010) [#9]
Not for detecting if a file is running?

Include basically copies code from one file directly into another wherever you call include. This way you can separate your source codes for better organization.

Heliotrope(Posted 2010) [#10]
What about openfile?

Sauer(Posted 2010) [#11]
Can you give a specific example about what it is you are trying to accomplish?

Heliotrope(Posted 2010) [#12]
I'm not soure, I'm only gessing.