• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM Tip: Setting up disposable GMS projects

FrostyCat

Redemption Seeker
After GMS 1.x changed to the directory-based file structure, many users missed 8.1's ability to try out small snippets without manually creating a project. It turns out that with a little batch scripting, this can be brought back in 3 easy steps.


Step 1: The Main Scripts
Create a directory named _scratchpad14 and create a file named scratchpad.bat in it. Then paste the following code into scratchpad.bat:
Code:
@echo off

rem Configure the GMS directory and temporary project name here
set gmsdir=%appdata%\GameMaker-Studio
set newname=scratchpad%random%%random%%random%%random%

rem Copy the scratchpad GMZ and open it
copy /y "%~dp0scratchpad.gmz" "%temp%\%newname%.gmz" >NUL 2>NUL
start /max /wait "%gmsdir%\GameMaker-Studio.exe" "%temp%\%newname%.gmz"

rem Wait until GMS closes
:untilcls
timeout /t 1 >NUL 2>NUL
tasklist /fi "imagename eq GameMaker-Studio.exe" 2>NUL | find /i /n "GameMaker-Studio.exe" >NUL 2>NUL
if "%errorlevel%" == "0" (
    goto untilcls
)

rem Remove the copied scratchpad GMZ and the project directory
del "%temp%\%newname%.gmz" >NUL 2>NUL
rmdir /s /q "%temp%\%newname%.gmx" >NUL 2>NUL
This assumes a default installation at %appdata%\GameMaker-Studio. If your installation isn't there for any reason (e.g. Steam or Education versions), change the line starting with set gmsdir= at the top to match.

We will also create a VBS helper next to scratchpad.bat to remove the console window. Create a file named scratchpad.vbs and paste the following code in it:
Code:
Set oShell = CreateObject("Wscript.Shell")
oShell.Run "cmd /c scratchpad.bat", 0, false
Step 2: The Template
Create an empty project (can optionally include resources that you experiment with often) and export it as scratchpad.gmz, right next to scratchpad.bat.

Step 3: The Shortcut
This enables the batch file to execute in the background.
  • Create a shortcut to scratchpad.vbs,
  • Right-click on the shortcut, select "Properties", then select the "Shortcut" tab.
  • Change "Run:" to "Minimized". Optionally you can also change the icon.
  • If your system has disassociated the .vbs extension from Windows Scripting Host for security reasons, prepend cscript.exe followed by a space to "Target: " (e.g. cscript.exe %HOMEPATH%\_scratchpad14\scratchpad.vbs)


This is what your _scratchpad14 directory should look like once you're done:
newgms1scratchpad.png

Then just drag the shortcut to your Start menu, Taskbar or anywhere convenient. Click and experiment away!


Last Updated (2019-03-12): Added ability to hide the console window (Source)
 
Last edited:
Top