Game Maker Web Clipboard Extension

Game Maker Web Clipboard extension allows you to SET and GET the clipboard content. Normally, when you select a text and right click + select Copy (or CTRL + C), the data is copied to your clipboard. You can paste this data again by Right Click + Paste (or CTRL + V). This extension allows you to copy or paste data without pressing right click or CTRL + C.

Natively, Game Maker does not have the ability to write data to clipboard, or get data from it.

DOCUMENTATION

web_clipboard_set(String Text);
Description
: Sets your clipboard data.
Returns : N/A

web_clipboard_set("Hey, you're on GMDevBlog");

web_clipboard_get(String successCallbackFunction, String failedCallbackFunction);
Description
: Gets the content from a clipboard. You can set arguments as “” to not to call them.
Returns : N/A
Callbacks : successCallbackFunction if succeeded, or failedCallbackFunction if failed. These functions are called with argument0, either with the clipboard content, or an error code.

web_clipboard_get(gmcallback_copyClipboard,""); //don't call the failed function.
All callback scripts must start with gmcallback_ to avoid obfuscation.
Due to privacy concerns, modern browsers ask for a permission for clipboard content(only when getting it). If the user permits it, they do not have to be asked again. Your app can freely accept the clipboard content afterwards. If a user denies the permission, failedCallbackFunction will be called.
An example of web_clipboard_get, in Chrome. (It’s essentially Permit or Block question)
GET THE EXTENSION

Open Source

https://github.com/Fritsbie/game-maker-clipboard
Share

Marty

Truely speaking, I don't know what am I doing most of the time.

Leave a Reply