如何在從資料庫中提取的表上自動執行附加腳本以下程式碼會將 c:\work 目錄中的所有 jsl 腳本附加到表 dt。
你知道有什麼函數/指令也可以讓它在桌上自動運行嗎?
dt = Current Data Table();
dir = "C:\work";
fileNames = Files In Directory( dir );
if (dir!="",
For( iFile = 1, iFile <= N Items( fileNames ), iFile++,
filename = fileNames[iFile];
show(filename);
If( Ends With( filename, ".jsl" ),
file_path = dir || "\" || filename;
show(file_path);
x = Load Text File( file_path );
Eval( Parse( "dt << new script(filename," || x || ")" ) );
);
);
);自動化和腳本編寫回覆:如何在從資料庫中提取的表上自動執行附加腳本這
dt << run scripts( filename );
將在將腳本儲存到資料表後運行該腳本。
dt = Current Data Table();
dir = "C:\work";
fileNames = Files In Directory( dir );
if (dir!="",
For( iFile = 1, iFile <= N Items( fileNames ), iFile++,
filename = fileNames[iFile];
show(filename);
If( Ends With( filename, ".jsl" ),
file_path = dir || "\" || filename;
show(file_path);
x = Load Text File( file_path );
Eval( Parse( "dt << new script(filename," || x || ")" ) );
dt << run scripts( filename );
);
);
);
如果您希望在開啟資料表時執行所有腳本,您可以新增一個名為 OnOpen 的表腳本,您可以在其中指定執行每個表腳本。