Asset - Extension File Dropper (for Windows and macOS)

Samuel Venable

Time Killer




[Made for GameMaker Studio 2]

This extension is for Windows and macOS.

Allows you to drag and drop files and folders to your game window.

Returns the full path to every file dropped separated by a new line.

The DLL's full source code included.

Very big thanks to Josh Ventura, for writing the widen() and shorten() scripts, enabling UTF-8 support on Windows.

----------------------------------------------------


Download Free for GameMaker Studio 2


 
Last edited:

Samuel Venable

Time Killer
Nice job with this. My file dropper extension isn't safe to use because of a bug and it's Windows only. You're the king of system-level extensions!
Thank you! Yeah to be honest this might need a few people testing it to make sure it works consistently because there is one specific part of developing this extension I'm still not sure whether I took the best approach on it, so anyway, if it works for everyone and people could verify that as much as they can, that would be greatly appreciated!

P.S. this is the second time you called me a king of something in regards to programming which i may not be the best programmer there is, I have a lot to learn, i still very much appreciate your words.
 
Last edited:

hippyman

Member
P.S. this is the second time you called me a king of something in regards to programming which i may not be the best programmer there is, I have a lot to learn, i still very much appreciate you words.
Good chance I said the same thing then. I tend to do that. lol

The only thing I would say to look out for is this weird bug on Windows, where after using the extension it wigs out the Windows explorer and you can't rename files and some other odd behavior that I can't specifically remember. I have no idea why it happens and I didn't even notice it until somebody emailed me pointing out the issue. My extension was super hacky and basically just enough to "work" so you may or may not run into this issue. Just something to keep your eye on.
 

Samuel Venable

Time Killer
Good chance I said the same thing then. I tend to do that. lol

The only thing I would say to look out for is this weird bug on Windows, where after using the extension it wigs out the Windows explorer and you can't rename files and some other odd behavior that I can't specifically remember. I have no idea why it happens and I didn't even notice it until somebody emailed me pointing out the issue. My extension was super hacky and basically just enough to "work" so you may or may not run into this issue. Just something to keep your eye on.
Thanks for the info! This was made for a client so it's important that it has no such issues before two weeks has elapsed. I'll try renaming and messing around with various files i drag and see whether it's an issue. The problem I was having when making this was trying to figure out how to add code to an existing window procudure's list of messages. I did look at some code online that did this and it helped quite a bit, which i was pretty lucky to find.
 

Samuel Venable

Time Killer
API changes to previous functions listed below:
  • file_dnd_get_enabled() -- return value gets whether file dropping is enabled.
  • file_dnd_set_enabled(enable) -- argument sets whether file/directory dropping is enabled.
  • file_dnd_get_files() -- return value gets the list of files that were previously dropped, separated by a new line. return value is an empty string whenever file/directory dropping is disabled or nothing was dropped.
  • file_dnd_set_files(pattern, allowfiles, allowdirs, allowmulti) -- filters out unwanted items from the list of previously dropped items. pattern is a string in the form of "*.ext1;*.ext2;*.ext3;..." similar to the filter argument of get_open_filename except it excludes the filter description and use of pipe character separators. allowfiles is whether to allow regular files. allowdirs is whether to allow directories, (and on macOS, this includes various bundle formats like *.app, *.bundle, *.framework, etc. even though they have an icon that makes them appear as though they are normal file formats and not folders--just try opening them on Windows--and you will notice they are actually folders with very specifically structured sub-directories and file contents). allowmulti is whether to allow multiple items. For convenience, using this function will also remove duplicates and listed files and directories that no longer exist. Sorts alphabetically.
  • file_dnd_add_files(files) -- adds files and directories to the list, (separated by a new line if multiple), if the files and directories used in the files argument happen to exist, (checked and added to the list individually).
  • file_dnd_remove_files(files) -- same as the previous function except the files argument lists files to be removed from the previously dropped list, as apposed to adding them, regardless of whether they exist.
 
Last edited:

Samuel Venable

Time Killer
Version 0.1.0 Released!
  • [New Platform] Added support for macOS.
  • [All Platforms] Removed functions file_dnd_add_files() and file_dnd_remove_files(). Use a data structure list instead to achieve the same thing.
New screenshot and video captured on macOS coming soon!

Edit:

New macOS screenshot and video added to the OP and MP page!
 
Last edited:

Samuel Venable

Time Killer
Updated the Dropbox link to support drag and drop when running the executable as administrator on Windows:

<link removed>

Also added GameMaker Studio 1.4 support at that link.
 
Last edited:
Top