我正在尝试用AE Extendscript将一些文本从AE复制到系统剪贴板。After Effects在Extendscript中不直接提供此功能。
我可以将文本放在textlayer上,然后使用以下命令将其复制到剪贴板:
app.executeCommand(app.findMenuCommandId("Copy")); 但要做到这一点,必须选择文本。这可以通过以下方式完成:
app.executeCommand(app.findMenuCommandId("Select All")); 但是,光标必须位于字段中,才能正常工作。
我试图用After Effects中的Extendscript将光标放在文本层文本字段中。我怎么也看不出该怎么做。
我已经设法使用.bat方法将变量的值复制到系统剪贴板,但这并不适用于所有系统。最好的方法是真正留在AE中。
有人知道如何在AE Extendscript中控制文本光标吗?
有什么想法吗?
发布于 2013-07-01 05:24:05
使用vbs脚本和sendkeys怎么样?你可以创建脚本来做sendkey的事情(因为你不能在javascript中做这件事),然后让你的javascript文件在适当的地方调用vbs脚本。
发布于 2013-07-01 06:06:26
下面是Extendscript中的工作原理:
//This works on Vista and Win 7, XP requires the user to copy 'clip.exe' to the 'sys32' folder.
function copyTextToClipboard2(text)
{
var folderForTempFiles = Folder.temp.fsName;
//alert(folderForTempFiles)
// create a new textfile and put the text into it
var clipTxtFile =new File(folderForTempFiles + "/ClipBoard.txt");
clipTxtFile.open('w');
clipTxtFile.write(text);
clipTxtFile.close();
// use the clip.exe to copy the contents of the textfile to the windows clipboard
var clipBatFile =new File(folderForTempFiles + "/ClipBoard.bat");
clipBatFile.open('w');
clipBatFile.writeln("clip < " + folderForTempFiles + "/ClipBoard.txt");
clipBatFile.close();
clipBatFile.execute();
}有没有人想出了一款与苹果相当的产品?
发布于 2016-01-10 12:01:31
我已经在mac电脑上用After Effects CC进行了测试,效果很好:
text = 'Lets copy some text'
var folderForTempFiles = Folder.temp.fsName;
// create a new textfile and put the text into it
var clipTxtFile =new File(folderForTempFiles + "/ClipBoard.txt");
clipTxtFile.open('w');
clipTxtFile.write(text);
clipTxtFile.close();
system.callSystem("cat " + folderForTempFiles + "/ClipBoard.txt" + " | pbcopy");https://stackoverflow.com/questions/17388763
复制相似问题