所以我正在尝试使用app脚本编写一个Ascii动画,但是似乎没有添加帧的方法
const
我尝试了
function Voss () {
var body = DocumentApp.getActiveDocument().getBody()
for ( var x; x<10; x++) {
body.appendParagraph("Below are instructions that will be cleared in some seconds");
body.appendParagraph("On the first line, type from when to when the event is happening");
body.appendParagraph("On the second line, type the location if it has not been programmed yet");
body.appendParagraph("On the third line, type the Attendees");
body.appendParagraph("On the ending lines, type the summary");
Utilities.sleep(1000)
}
但是他们俩都一次完成了任务,根本没有进展
答案 0 :(得分:1)
我认为应用程序脚本不能有效地创建这种动画,因为该脚本在服务器上而不是在浏览器上运行。这就是为什么应用脚本将所有呼叫批量处理为一个呼叫的原因。不过,您可以尝试saveAndClose
循环刷新未完成的更改。
for ( var x; x<10; x++) {
/*=>*/var doc = DocumentApp.getActiveDocument();
/*=>*/var body = doc.getBody();//Moved inside the loop as `doc` needs to be opened again
body.appendParagraph("Below are instructions that will be cleared in some seconds");
body.appendParagraph("On the first line, type from when to when the event is happening");
body.appendParagraph("On the second line, type the location if it has not been programmed yet");
body.appendParagraph("On the third line, type the Attendees");
body.appendParagraph("On the ending lines, type the summary");
/*=>*/doc.saveAndClose();//Added
Utilities.sleep(1000);
}