Hi,
I made a script that converts JMP to a csv file and saves it to network PCs using their IP address.
dt = Current Data Table();
ToolID = {"G01", "G02", "G03", "G04"};
IP_add = {"10.87.123.456", "10.87.123.789", "10.87.456.789", "10.87.789.123"};
current_pref = Char( Arg( Parse( Char( Get Preferences( Export settings ) ) ), 1 ) );
Pref( Export Settings( End Of Field( Comma ), Export Table Headers( 1 ) ) );
captxt = "";
For( i = 1, i <= N Items( IP_add ), i++,
dt << save( "\\" || IP_add[i] || "\c$\filedir\file.csv" );
Caption( "Updated " || Tester[i] || " \\" || IP_add[i] );
captxt = captxt || "
Updated " || ToolID[i] || " \\" || IP_add[i];
Wait( 0.2 );
);
Caption( captxt );
Eval( Parse( "pref(" || current_pref || ")" ) );
Now, we noticed that if we forget to put .csv in the save command, the script will still execute to the next lines, and show caption that the saving is successful even if it is not.
The only way we can know that it is not successful is to check the file in the network PC and JMP log file which has this error:
Unable to save file. Unknown data target.
My question is this. If this error happens, how do we stop the script and show an error message? This kind of "silent" error can be misleading to the user.
I tried using Try and Throw, but it did not work.
Try(dt << save( "\\" || IP_add[i] || "\c$\filedir\file.csv" );, Caption("Error! Check log."); Throw());
Thanks,
Shaira