首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AE Extendscript文本层光标控制

AE Extendscript文本层光标控制
EN

Stack Overflow用户
提问于 2013-06-30 16:56:19
回答 3查看 841关注 0票数 2

我正在尝试用AE Extendscript将一些文本从AE复制到系统剪贴板。After Effects在Extendscript中不直接提供此功能。

我可以将文本放在textlayer上,然后使用以下命令将其复制到剪贴板:

代码语言:javascript
复制
app.executeCommand(app.findMenuCommandId("Copy"));  

但要做到这一点,必须选择文本。这可以通过以下方式完成:

代码语言:javascript
复制
app.executeCommand(app.findMenuCommandId("Select All"));   

但是,光标必须位于字段中,才能正常工作。

我试图用After Effects中的Extendscript将光标放在文本层文本字段中。我怎么也看不出该怎么做。

我已经设法使用.bat方法将变量的值复制到系统剪贴板,但这并不适用于所有系统。最好的方法是真正留在AE中。

有人知道如何在AE Extendscript中控制文本光标吗?

有什么想法吗?

EN

回答 3

Stack Overflow用户

发布于 2013-07-01 05:24:05

使用vbs脚本和sendkeys怎么样?你可以创建脚本来做sendkey的事情(因为你不能在javascript中做这件事),然后让你的javascript文件在适当的地方调用vbs脚本。

票数 0
EN

Stack Overflow用户

发布于 2013-07-01 06:06:26

下面是Extendscript中的工作原理:

代码语言:javascript
复制
//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();
}

有没有人想出了一款与苹果相当的产品?

票数 0
EN

Stack Overflow用户

发布于 2016-01-10 12:01:31

我已经在mac电脑上用After Effects CC进行了测试,效果很好:

代码语言:javascript
复制
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");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17388763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档