Blockland Forums > Modification Help
Getting a code and setting it to clipboard
(1/4) > >>
Danny Boy:
How would I go about copying a code to the clipboard with a function?

For example if I typed into the console

getcode("Add-Ons/Server_Whatever/server.cs");

It would take the code from Add-Ons/Server_Whatever/server.cs and set it to my clipboard.
Jardev:
I'm not sure if you can set strings to the clipboard with TS. I only know you can see what is currently stored with a command like getClipboard()
Danny Boy:

--- Quote from: Jardev on March 01, 2012, 01:11:10 PM ---I'm not sure if you can set strings to the clipboard with TS. I only know you can see what is currently stored with a command like getClipboard()

--- End quote ---
setclipboard("Random stuff");

halcynthis:

--- Quote from: Danny Boy on March 01, 2012, 01:31:11 PM ---setclipboard("Random stuff");



--- End quote ---
As long as setClipboard is an actual function, then this will work.

--- Code: ---function copyFileToClipboard(%file)
{

%string = "";
%file = new fileObject();

%file.openForRead(%file);

while(!%file.isEOF())

{

%string = %string SPC %file.readLine();
}

%file.Close();
%file.Delete();
setClipboard(%string);
}


--- End code ---
Treynolds416:
look at setClipboard() and getClipboard() here: http://docs.garagegames.com/tge/official/content/documentation/Reference/Console%20Functions/TorqueScript_Console_Functions_13.html#setClipboard.28_string_.29

It might not work for your purposes, it looks like it operates through a GUI
Navigation
Message Index
Next page

Go to full version