Comments

Log in with itch.io to leave a comment.

(1 edit)

Hi YAL! 

I added this extension to a new project, and now everything is crashing at startup. 

I didn't actually use the extension or add its script anywhere yet, I just launched the unchanged project with the extension imported. It's worth noting that deleting the extension (from the extensions folder) makes the project launch again without issue.

Do you have an idea if there's any chance the extension is outdated / incompatible, or might it be something on my end?

Edit: I also have GMLive working in the project. I'm not sure if that might be related, but I used this extension as a shortcut to run GMLive's server a few months ago for a previous project.

I'll add the crash log below:


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'path1')

   at System.IO.Path.Combine(String path1, String path2)

   at GMAssetCompiler.WADSaver`1.WriteExtensions(IList`1 _data, Stream _s, IFF _iff)

   at GMAssetCompiler.IFFChunkHandler`1.Save(Stream _stream, IFF _iff)

   at GMAssetCompiler.IFF.WriteChunks(Stream _stream, TextWriter _out)

   at GMAssetCompiler.WADSaver`1.Save(GMAssets _assets, Stream _stream, List`1 _extraFilenames, Dictionary`2 _extraAttributes)

   at GMAssetCompiler.IFFSaver.Save(GMAssets _assets, String _name)

   at GMAssetCompiler.Program.CompileProject(GMAssets _file)

   at GMAssetCompiler.Program.Reentry(String[] _args)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

   at Igor.Program.ExecuteAssetCompiler(String _args)

   at Igor.WindowsBuilder.Compile(Boolean _exe)

   at Igor.WindowsBuilder.Deploy(Boolean _exe)

   at Igor.WindowsBuilder.Run()

Igor complete.

elapsed time 00:00:03.7888261s for command

(+1)

It’s easy, don’t use 2023.11 IDE (or fix the file names in the extension by hand)

If it wouldn't be too much trouble, could you tell me how to fix the extension's file names? I'm not completely sure of how that works.

(+1)

If you download the test project from GitHub and open it in GMEdit instead of GM, you can see that the extension contains three files - execute_shell_simple_ext.dll, execute_shell_simple_ext.gml, and autogen.gml. Right-clicking the extension and picking “Show API” will show you which functions go in which

If you double-click the extension in 2023.11 IDE, however, you can see that the file names got eaten - you’ll need to double-click on each “mystery file” in the list and assign it the correct name-extension.

This is a great little extension. I'm building myself a small front end to launch pinball software for me vpin cab. I have a question though if you could help?

I can launch various games thrugh steam or epic launcher and that's fine but when launching this minimises the gm front end, and when I close the game the front end is still minimised. So I then need to go and click on the gm exe to get that back to full screen to launch another game.

Does this log in anyway what launched so you can maximise the gm window if the thing you launched closes? 

If you get what I mean :D

The easiest way to avoid this problem is to use borderless fullscreen instead of exclusive fullscreen - then your window will not minimize when it loses focus.

Thanks. That worked perfectly! 

The extension doesn't work when you execute a gamemaker game that was compiled in V2023.8.0.98 and after, but if you use any gamemaker game that was compiled in the past, will work with the extension.

Given the symptoms, I guess GameMaker games now require a more convoluted way to launch them, for some reason.

This is a known issue on Gamemaker's end.
https://github.com/YoYoGames/GameMaker-Bugs/issues/1673


There are currently two work arounds for this. The first is to use TabularElf's MultiClient.
https://github.com/tabularelf/MultiClient
The second is to compile the game you wish to launch on 2023.6 and execute it in your program.

Apart from that even calling a batch file which launches the game will also produce the same results.

Unfortunately I think a recent gamemaker update might have broke this...  It's ceased working for me as of IDE v2023.8.0.98, Runtime 2023.8.0.145

Tried my test project from GitHub and seems to work fine

¯\_(ツ)_/¯ I reverted the version back to 2023.6.0.92 and it's working just fine again.   Couldn't say what's happening exactly.

For reference, I'm using the extention to open multiple windows of my game similar to a tutorial I found somewhere:

if( global.multiStart ){
    var i;
    for(i=3; i<=global.multiStartInstances+3; i++){
        if (parameter_count() == i) {
            if( i < global.multiStartInstances+2 ){
                var k;
                var paramStr = parameter_string(1)+" ";
                for(k=2; k<=i; k++){
                    paramStr += parameter_string(k)+" ";
                }
                paramStr += "-secondary";
                execute_shell_simple(parameter_string(0),paramStr);
            }
            var pNum = i-3;
            var xPos = pNum%2;
            var yPos = floor(pNum/2);
            window_set_position(
                    100 + (global.resolutionX + 40)*xPos,
                    60 + (global.resolutionY + 60)*yPos);
            window_set_caption("P"+string(i-2))
            global.onlinePortNumber = 32770+i;//different ports for each game
            global.connectIp = "127.0.0.1";
            global.connectPort = 32790;
        }
    }
}

Basically just restarting the game with more and more parameters and opening windows based on how many parameters there are.

Could this be used to open GM Live? When I put the full path to the .exe, nothing happened. 

I also tried looking at xProcess but there wasn't any documentation and I couldn't really understand the example project from a glance. 

(+1)

When using a full path with backslashes, make sure to put it inside a @"strings" string since backslashes have a different meaning in regular "strings". This worked for me

execute_shell_simple(@"C:\test\live23\datafiles\GMLive\gmlive-server.exe");

Thank you, that worked perfectly!

This is pretty great. But is there a way to execute the command in background, without opening the prompt?

You’ll probably want Samuel’s xProcess for that

Hello! Sorry this just might be me being new and not understanding this, but how would i go about having game maker use this to open vbs files? (The vbs file in question is just to have a custom windows error message popup. telling you incase this type of file affects how you code it in B) Thanks in advance!!!

IIRC you’re supposed to feed them to ...\System32\WScript.exe. Or maybe CScript.exe.

Does this not allow for BAT files to be called?

Per description, it’s a very literal wrapper around a WinAPI function. You might have to feed the .bat file to cmd.exe, or use a different action - chances are that you are not the first person on the internet to try running a .bat file through ShellExecute.

Oh man, I feel silly haha.  Thanks!

Hello. Can opening a URL be perceived by antiviruses as a virus? In the manual, the command "url_open" may be perceived as a virus

(+1)

It’s probably the act of asking the browser to open a URL that might get blocked by an antivirus.

Thank you for making this extension. I was wondering why the URL started with %22 and I'm glad that this was the first page I came across to fix the problem.

I've been making a game for 9.5 years with game Game Maker 1.4999 now, and I'm almost ready to upload a demo. I realized the URL thing stopped working. I was going to use it to refer people to my Patreon page.

For future reference, I would recommend that you give an example on how to use the function after installing. I had to scroll through the comments and found someone said:

execute_shell_simple("https://yourwebsitehere.com");

I am happy that I fixed the problem, but now I am even more happy that people like you are still keeping Game Maker 1.4 still relevant.

(1 edit)

Thank you. There’s an Examples section in the itch description.

Worked like a charm!  Thanks so much for making this! :)

I downloaded the x64 version from the link above, but it doesn't work. It says "Variable <unknown_object>.execute_shell_simple_ext(102244, -2147483648) not set before reading it". Do I miss something? Thank you.

(The 32bit version worked fine for an year).

(1 edit)

You are using the extension name instead of the function name. As to how this worked before, is beyond me.

Oh sorry, my fault. now it works fine. Thank you for the help, and thank you for the work you do!

(+1)

you saved my life with this extension man, I'm paying for it, thank you for sharing it for free!

(1 edit)

Hello. This works great in Windows, but less so in HTML5. Is it not HTML5 compatible, perhaps?

I copy and pasted your example for opening a webpage directly for testing. No matter what I do, I get this error:

Uncaught ReferenceError: execute_shell_simple_raw is not defined


I downloaded your GMS2.3+ version yesterday, so it's definitely not outdated.

(1 edit)

You’ll want either url_open[_ext] or clickable_* on HTML5 - an extension can’t do much more than the runtime already does.

Thanks for the response. I got it working with what you suggested.

(+1)

Thank you, this helped to solve a problem I was having with opening URLs. For anyone here to be able to crack open a web link, just do;

execute_shell_simple("https://yourwebsitehere.com");

It would be amazing if there was execute shell for android. Would definitely pay in the marketplace for an android execute shell like function.

Is your intention to open a file or launch another application?

I was thinking about launching an apk file or opening another file as well with a function (script) similar to execute shell.

Could you explain to me how to simply open a webpage with this? in GM 1.4

See the “Create an internet shortcut and open it in default browser:” right in the itch.io page description

Do I have to create the shortcut first? Or can i just run a command to open a webpage?

The snippet creates a shortcut and then opens it, as the title says. Paste it into some keyboard press event and see what happens

(1 edit)

I found if i just used execute_shell_simple("url") it worked :)

Can you make it work for Android?

That requires a complete rewrite and investigating how and whether that could be done on Android, so probably not.

Thanks for this! Really comes in handy. I have however noticed that it doesn't seem to work on some computers.

When I launch my game I'm checking for an update, if there is one I download the updated version to the working_directory. When the .exe is downloaded I run it with your script. Work flawlessly on two of my computers, but for some reason it doesn't on the last one I tried it on 🤔

I don't know if you have any idea why?

Anyways, thanks for making this! 😀

It is possible that your executable gets confiscated by an antivirus program for the duration of scan - try with something simpler like a .txt file first.

i get the execute_shell_simple_raw thing and not the original function, for some reason the examples dont work

I don’t know how you have accomplished this since I checked and both the extension and the sample project have the DLL + GML files.

I'm having the same issue. Downloaded the YYMP, then imported it into my project as a local package. execute_shell shows up as a constant and execute_shell_simple_raw shows up as a function. Nothing happens when running execute_shell_simple_raw

(+1)

I released a new version that renames the extension to not be the same name as its main function

(+1)

Thank you for this! :D

(1 edit)

Hey YAL, love your stuff. (question about transition to Windows 64)

If you are using the new 64-bit Windows runtime, you should be aware that it breaks every single existing DLL. I wouldn’t recommend using it unless you are confident that every extension you use can be updated.

As for my extensions in particular, a quick search shows that I have dozens of ones that use DLLs, and many of them have not been migrated to GMS2 (instead relying on compatibility scripts), so it will take a while to update all of them.

If it is extremely urgent, you may attempt to compile extensions yourself using the source code that is either included with the extension (for paid extensions) or linked on the extension page (for free extensions), though code changes may be required for - argument and return types vary 32-bit to 64-bit for many system functions.

(2 edits)

I'm kind of in a bind. Releasing a large update for my project on the 25th, and the 64x stops some memory allocation issues people were having, but I also don't want to lose your mouse_lock stuff :L

How would I go about compiling it myself, I don't know what the heck I'm doing with extensions?

If this is not something I could realistically do quickly on my own, no worries.

Good stuff

Thank you!