system.callSystem and clipboard not working

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Edu-im
Posts: 5
Joined: September 28th, 2011, 10:59 am

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
yogert909
Posts: 10
Joined: April 10th, 2006, 4:52 pm
Location: los angeles

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?
yogert909
Posts: 10
Joined: April 10th, 2006, 4:52 pm
Location: los angeles

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
User avatar
zlovatt
Posts: 47
Joined: October 31st, 2016, 5:00 pm
Location: Portland
Contact:

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);
Post Reply