Asset - Extension Process Information (for Windows, macOS, and Ubuntu)

Samuel Venable

Time Killer
lol I can't help but notice that this is basically just like my most popular asset on the marketplace, Execute Shell, but on steroids. Execute Shell has thousands of downloads, and a crap ton of 5/5 reviews. I wonder why this asset, which capable of all the same things, and a lot more than that, hasn't really gotten any traction yet? Does anyone actually know what this extension even does? Am I not describing it properly? Or am I just overthinking it with my impatience?
 

Samuel Venable

Time Killer
@Unknown Entity I fixed this extension if you ever happen to need it. It should no longer hang for you. If you are ok with updating and trying it again that would be great so other people will be able to see you verified it works now.
 

IGameArt

Member
This can be used to execute batch files? I'm having a tough time getting it to do what I'm trying. Essentially I'm saving a surface to a png then trying to use this to convert it to another format using a bat file with the proper instructions.

GML:
var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
show_message(dir);
process_execute(dir)
I've placed quotes around the directory but it doesn't launch the bat, even if I use get_open_filename to track down the file I want to launch manually it still fails to do anything.
 

Samuel Venable

Time Killer
var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = "cmd /c " + @'"'+dir+@'"';
show_message(dir);
process_execute(dir)

Should do the trick. :)
 

IGameArt

Member
I'll give that a shot when I get home, thanks!

EDIT: Still getting no results. It's like it can't find the file or something.
 
Last edited:

Samuel Venable

Time Killer
Is anyone else able to reproduce this problem with batch files not working, even when attempted the way I mentioned? I'm still waiting to hear back from @IGameArt with a private conversation we're having regarding the issue, and if I could debug it and find the source of the problem sooner, it would help him and potenially others.

Edit:

Just noticed a problem with the code provided.
var dir = working_directory+"\Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
show_message(dir);
process_execute(dir)
There is an unnecessary backslash that bwoke it. It should be:

var dir = working_directory+"Assets\\Dependencies\\ConvertStepA.bat";
dir = @'"'+dir+@'"';
show_message(dir);
process_execute(dir)
 
Last edited:

Samuel Venable

Time Killer
New function available!
GML:
string cwd_from_pid(process_t pid);
Allows the developer to get the working directory of external running applications based on their associated process id. This was a pain in the neck to add.
 

Samuel Venable

Time Killer
GMS2 - Version 0.9.8. Published August 4, 2020


WARNING: this update has important API changes which will break existing projects! Please update your projects to adapt to these changes:

  • Some functions have a new "process index" argument added to allow getting the output, and process id's, from multiple processes, that have been executed, and that are running simultaneously. The "process index" argument is labeled "ind" in the GML code editor's intellisense. For this argument you must specify a number of your choosing to uniquely identify processes created with process_execute(ind, command) and process_execute_async(ind, command).

  • To delete the recorded output and process id of the given process index, use the functions process_clear_out(ind) and process_clear_pid(ind). This will also free those elements from memory, so do not forget to call these functions whenever you are done getting the output and process id of a given process index. If you are not getting either of those things, be sure to free memory with these functions regardless, and in which case, it would be best to do so for every process index used in all calls to process_execute(ind, command), and process_execute_async(ind, command), immediately after executing each process individually.

  • it is recommended that if you need to know which process index has which process id number or output string, you store the value of the process index in a variable name that easily identifies the executable or command that is associated with each individual process index.
 
Last edited:

Samuel Venable

Time Killer
Hey guys, after a lot of putting off, I'm finally writing some decent documentation for this, diving right in to everything this extension can do and explaining it in depth function-to-function. Here's what I have so far, which covers everything you need to know on how to execute processes and read their output, both synchronously & asynchronously: https://www.dropbox.com/s/ahbhcsum51he7nb/docs.html?dl=0

Up next I will cover how to retrieve a lot of various information from both the processes you execute, as well as external running processes.

Please let me know if it makes sense at all, I hope it does! lol
 
Top