我通过脚本编辑器.app 将以下内容保存为Scanner scan = new Scanner(System.in);
System.out.println("enter");
int x = scan.nextInt();
boolean areConsecutive = false;
while (x != -1) {
int y = x + 1;
System.out.println("enter");
x = scan.nextInt();
if (x == y) {
System.out.println("enter");
int z = x + 1;
x = scan.nextInt();
if (x == z)
areConsecutive = true;
}
}
if (areConsecutive)
System.out.println("Consecutive");
else
System.out.println("None Consecutive");
。
从终端test.scpt
运行脚本后,PowerPoint启动,打开pptx文件,并保存一些东西(我可以说这是因为弹出了进度条)。
但是,我无法在任何地方找到保存的文件。它在哪里?
osascript test.scpt
答案 0 :(得分:0)
您将outputPath设置为“Home”目录,因此它应该在那里但是如果您想要一个可选择的保存位置和文件,则可以使用此脚本:
on run argv
set inputPath to POSIX path of (choose file with prompt "Choose a PPTX File")
set outputPath to POSIX path of (choose file name default name "MyPDF.pdf" with prompt "Choose a Location to save it")
tell application "Microsoft PowerPoint"
activate
open inputPath
save active presentation in outputPath as save as PDF
close active presentation
quit
end tell
return "finished"
end run
答案 1 :(得分:0)
您无法将文件保存到任何文件夹。使用
~/Library/Containers/com.microsoft.Powerpoint/Data/Documents
通过AppleScript从PowerPoint保存文件的文件夹。
例如
set outputPath to "Documents/presentation.pptx"
必须是字符串(不是POSIX路径)