0

例如,我有这样的动作:

Run external JS => Save file => Run External Bat

问题是,JS中有什么方法可以跳过保存文件活动吗?

我想在 JS 中做的是:

if (some condition) {
     //Skip the save file activity
}

是否有可能或任何解决方法可以达到相同的结果?谢谢

参考: http: //www.adobe.com/devnet/acrobat/javascript.html

4

2 回答 2

1

根据您尝试使用 continue 语句完成的任务的上下文,这里可能会有所帮助。在本例中,您使用它来绕过打印 #24。

Outer:
for (var i = 1; i <= 10; i++) {
    document.write ("<br />");
    document.write ("i: " + i);
    document.write (" j: ");

Inner:
    for (var j = 21; j <= 30; j++) {
        if (j == 24) {
             continue Inner;
        }
        document.write (j + " ");
    }
}

//Output:
//i: 1 j: 21 22 23 25 26 27 28 29 30 
//i: 2 j: 21 22 23 25 26 27 28 29 30 
//i: 3 j: 21 22 23 25 26 27 28 29 30 
//i: 4 j: 21 22 23 25 26 27 28 29 30 
//i: 5 j: 21 22 23 25 26 27 28 29 30 
//i: 6 j: 21 22 23 25 26 27 28 29 30 
//i: 7 j: 21 22 23 25 26 27 28 29 30 
//i: 8 j: 21 22 23 25 26 27 28 29 30 
//i: 9 j: 21 22 23 25 26 27 28 29 30 
//i: 10 j: 21 22 23 25 26 27 28 29 30

http://msdn.microsoft.com/en-us/library/ie/8de3fkc8(v=vs.94).aspx

于 2013-09-16T05:16:40.050 回答
0

添加一个boolean名为的变量isSaved,以便根据您的条件执行。

var isSaved = false;      
if( isSaved ) {
//if true save the file
}
//Run External Bat

希望你有一个想法。

于 2013-09-16T05:09:19.830 回答