Page 1 of 1

system.callSystem and clipboard not working

Posted: April 4th, 2014, 3:13 pm
by Edu-im
Hi all

I know this issue has been previously discussed in this forum, but it had no response. So I ask again.

The problem is that the usual Windows "copy to clipboard" command doesn't work via AE.

Code: Select all

echo string | clipboard

does work in command.exe, but if you call the same process via system.callSystem this way

Code: Select all

var myString = "Hello world";
system.callSystem("cmd /k \"echo " + myString + " | clip\"");
it does nothing.

Does anyone know how to make it work?

Thanks

Re: system.callSystem and clipboard not working

Posted: May 19th, 2014, 4:58 pm
by yogert909
I'd be very interested in hearing if you find something that works as I'm working on a script that I need to copy things to the clipboard. Just to be clear, it sounds like you're working on windows, correct?

Re: system.callSystem and clipboard not working

Posted: May 19th, 2014, 9:18 pm
by yogert909
I got it working on mac osx with:

Code: Select all

system.callSystem("echo \"hello world\" | pbcopy")
Here's a thread which covers more complex examples on windows:
http://www.aenhancers.com/viewtopic.php?t=522

I hope this helps

Re: system.callSystem and clipboard not working

Posted: November 23rd, 2016, 1:52 pm
by zlovatt
While this is an ancient post, it's the most recent of various "callSystem copy to clipboard" threads. So -- here's how you can do this on Windows. My guess is that the first instance of `cmd` is closing before the output can be fed to the clipboard, but nesting it like this works just fine.

Broken into stages for legibility.

Copy string from ESTK to Windows clipboard:

Code: Select all

var myString = "Here is a string";
var cmdString = 'cmd.exe /c cmd.exe /c "echo ' + myString + ' | clip"';
system.callSystem(cmdString);