Skip to content

Instantly share code, notes, and snippets.

@hmasato
Created May 10, 2013 06:47
Show Gist options
  • Select an option

  • Save hmasato/5552794 to your computer and use it in GitHub Desktop.

Select an option

Save hmasato/5552794 to your computer and use it in GitHub Desktop.
[Softimage, Win] _sendToClipboard.js
function _sendToClipboardStr(str)
{
var wsh = new ActiveXObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
var fn = wsh.Environment("Process")("TEMP") + "\\_sendToClipboard_.tmp";
var f = fs.CreateTextFile(fn, true, false); f.WriteLine(str); f.Close();
wsh.run("cmd.exe /c clip < " + fn, 0, true);
}
function _sendToClipboardFile(filename)
{
var wsh = new ActiveXObject("WScript.Shell");
wsh.run("cmd.exe /c clip < " + filename, 0, true);
}
{
//var sels = Selection.GetAsText();
//_sendToClipboardStr(sels);
//_sendToClipboardFile("test.txt");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment