file execushion
BlitzPlus Forums/BlitzPlus Programming/file execushion
| ||
Is there a way to detect if a file is runing? |
| ||
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. |
| ||
What would the code be like? |
| ||
I admit, I don't know it... perhaps something like that: stream = CreateProcess("C:\Windows\System32\cmd.exe") while not eof(stream) readline(stream) wend writeline stream,"tasklist" while not eof(stream) name$ = readline(stream) if name$ = name_of_the_file_you_want_to_check$ then do_something endif wend But with this code B+ crashes... |
| ||
what is createprocess? |
| ||
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. |
| ||
http://www.blitzbasic.com/bpdocs/command.php?name=CreateProcess&ref=2d_a-z 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. |
| ||
could I use include |
| ||
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. |
| ||
What about openfile? |
| ||
Can you give a specific example about what it is you are trying to accomplish? |
| ||
I'm not soure, I'm only gessing. |