Okay, some of you may remember my last attempt at a clipboard DLL. It was able to copy images and files, but it couldn't paste anything...which made it essentially useless. The closest I got to pasting images worked 50% of the time, and the other 50% it crashed the game.
Well, I'm here with great news! I randomly decided to try again, and with the help of Google (which seems to have updated its index since last I tried this) I've gotten it working 100%!
What can the IMPClipboard DLL do? Directly from the example's info:
This DLL allows you to copy and paste images (as BMPs, sprites, and backgrounds), as well as copying files and retrieving the filenames of any files on the clipboard. Finally, GM can copy and paste more than text!
FUNCTIONS
Here is a list of all functions and what they do. Read the script comments for arguments, syntax, return information, error codes, and extra notes.
IC_Init() - Call to initialize IMPClipboard. Call it once--and only once--before using any IMPClipboard functions.
IC_CopyImageFile() - Call to copy a given Bitmap file to the clipboard.
IC_CopySprite() - Call to copy a sprite to the clipboard.
IC_CopySpritePart() - Call to copy a given part of a sprite to the clipboard.
IC_CopyScreen() - Call to copy a screenshot of the GM window to the clipboard.
IC_CopyScreenPart() - Call to copy part of a screenshot of the GM window to the clipboard.
IC_CopyBackground() - Call to copy a background to the clipboard.
IC_CopyBackgroundPart() - Call to copy part of a background to the clipboard.
IC_CopyImage() - Call to copy an image file, in any type GM supports, to the clipboard.
IC_PasteImage() - Call to paste an image from the clipboard to a file.
IC_Paste_Sprite() - Call to create a sprite from the image on the clipboard.
IC_Paste_Background() - Call to create a background from the image on the clipboard.
IC_CopyFiles() - Call to copy a file or a ds_list of files to the clipoboard.
IC_GetNumberFiles() - Returns the number of files on the clipboard's file list, if any.
IC_GetFileName() - Returns the name of the specified file on the clipboard's file list, if any.
IC_Free() - Call to cleanup the DLL and any memory it uses.
Amazing, no? The download ZIP comes with the .gml file for you to import into your own games, the .DLL (of course), and an example .GMK to demonstrate the DLL's functionality.
Again, from the example's info:
USING THE EXAMPLE
This example focuses on demonstrating the functionality of the DLL more than UI. Plus, I'm finishing this up at 3:30AM, so I'm trying to make this quick. Read below to learn how to use the example.
COPYING IMAGES: Click and drag anywhere to select part of the screen. Then press CTRL+C to copy that part of the screen to the clipboard. Press S to toggle the displayed shape between a circle and a square. Press SPACE to choose the color of the inner circle or top of the square.
PASTING IMAGES: Press CTRL+V to paste whatever image is on the clipboard (even from another program!) into a sprite. The example will then assign that sprite to an instance so you can see it.
COPYING FILES: Press CTRL+F to add a new file to the list of files to be copied. The title bar shows the number of files on the list. When you're done, press ENTER to copy all the chosen files to the clipboard. Press CTRL+L to get a list of all the files on the clipboard (even if they were copied elsewhere!)
All functions have been tested, but there's always a chance I've missed some things (especially given the current time and my rushed state), so if you find any bugs, please let me know about them.
I'd suggest having MSPaint open while you play with the example; it really lets you see how the copying/pasting between programs can be useful. Also, when testing the file copying/pasting, just open any old folder and use that to test (i.e. copy files from there and get the list in-game, or copy files in-game and paste them into that folder normally).
Important Note: Copying images works only with GM7 and below. All other functions (copying/pasting files and pasting images) work with all versions of GM.
Here's the download link:
mirror link on mediafire
Please leave comments, positive and negative.
-IMP
*EDIT* Fixed a slight bug in the example dealing with the drawing of the crop box. Unimportant to the DLL's functionality, but I fixed it anyway .
Edited by chance, 02 March 2015 - 04:23 PM.