嗨,
我正在嘗試創建一個腳本來生成一些輸出,並根據用戶選擇保存一個powerpoint(或不保存)。 當它嵌套在H List Box結構中時,我無法使“save presentation”命令工作。
第一個腳本工作正常:
Names Default To Here( 1 );
dt1 = open(Pick File("Select the the DATA TABLE to open.")); //open a file
WinHandle2 = new Window("Graphs",Distribution(Column(2))); //generate some output of interest
product_name = dt1:Product[1]; //get the product name from the first cell in the data table
//OUTPUT report to a Powerpoint file (THIS WORKS FINE):
saveFilename=product_name ||"_Distribution_"||char(year(today())) ||"-"||char(month(today()))||".pptx";
WinHandle2 << Save Presentation(saveFilename, Outline Titles("TopLeft")); //save the output to a Powerpoint file.
//prompt user to see if they want to save and close remaining windows.
w1 = New Window("What's Next?", text box("
Save the report and Close the Data Table?
"),
// Get user input,
H List Box(Button Box("Yes",
WinHandle2<<CLOSE window=""></CLOSE>如果我在H列錶框內移動“保存演示文稿”命令,我收到錯誤“寫入演示文稿文件時出錯。無法在ReadWrite模式下打開。該系統找不到指定的文件”。 請參閱下面的非工作代碼:
Names Default To Here( 1 );
dt1 = open(Pick File("Select the the DATA TABLE to open.")); //open a file
WinHandle2 = new Window("Graphs",Distribution(Column(2))); //generate some output of interest
product_name = dt1:Product[1]; //get the product name from the first cell in the data table
//prompt user to see if they want to save and close remaining windows.
w1 = New Window("What's Next?", text box("
Save the report and Close the Data Table?
"),
// Get user input,
H List Box(Button Box("Yes",
//OUTPUT report to a Powerpoint file (THIS WORKS FINE):
saveFilename=product_name ||"_Distribution_"||char(year(today())) ||"-"||char(month(today()))||".pptx";
WinHandle2 << Save Presentation(saveFilename, Outline Titles("TopLeft")); //save the output to a Powerpoint file.
WinHandle2<<CLOSE window=""></CLOSE>基本上,我希望用戶選擇是保存演示文稿,還是退出。 在此先感謝您的幫助
這是一種方法:
Names Default To Here( 1 );
dt1 = Open( path = Pick File( "Select the the DATA TABLE to open." ) );
pathToFolder = Left( path, Contains( path, Word( -1, path, "\/" ) ) - 1 );
謝謝回复。 奇怪的是,第一組代碼(保存演示文稿在H列錶框之外)運行正常。
在上面的代碼中,文件保存到最後一個活動目錄。(運行腳本的位置和輸入數據文件所在的位置)。 如何使用H List Box版本的代碼執行此操作?
問題是您傳遞給Save Presentation的路徑/文件名指向一個不存在或沒有寫入優先權的文件夾。 我在運行代碼時收到了相同的消息,然後我添加了product_name值,一個可寫指令的路徑,然後代碼工作正常。