如何在從數據庫中提取的表上自動運行附加腳本以下代碼會將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的表腳本,您可以在其中指定運行每個表腳本。