here's how you conditionally run a block of code in a sahi script (sahi_script2.sah), but only if that script first gets called by another sahi script (sahi_script1.sah).
#############sahi_script1.sah##############
//some sahi code ...
var $write_wd_to_file = true;
_include("sahi_script2.sah"); // RUN sahi_script2.sah
//some sahi code ...
########################################
#############sahi_script2.sah##############
//some sahi code ...
/*
IF YOU CALL sahi_script2.sah DIRECTLY, THEN THIS WONT GET RUN
*/
// $write_wd_to_file gets set in sahi_script1.sah
if($write_wd_to_file) {
var $weeklyDepartureId = $routeplanName + "_WD";
_writeToFile($weeklyDepartureId, "weekly_departure_id.txt", true);
_wait(2000);
}
//some sahi code ...
########################################
sahi_script1.sah runs some code, then runs sahi_script2.sah, which writes a string to a file
if sahi_script2.sah gets runs directly, then that block of code won't get run and nothing will get written to a file.
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment