Hi, I've noticed that when triggering a script through MsNet API call, response is not sent back until the whole script is executed. Initially I thought that response was sent at the point of Let>MACRO_RESULT variable. However it seems like this is not the case. I need response to be sent immediately, whereas the whole script can take few mins to finish.
Can this be done?
MsNet send response before end of script
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Re: MsNet send response before end of script
Macro_Result is returned when the script finishes running.
But this got me thinking.
Why not have two scripts? The first one simply returns "Please Wait..", and then redirects to a page which runs the actual script. Here's a video of it working.
//Script1 Saved as "msn1.scp" and called via http://192.168.1.205:2222/msn1 :
//Script2 Saved as "msn2.scp" and called via the first script at http://192.168.1.205:2222/msn1 :
But this got me thinking.
Why not have two scripts? The first one simply returns "Please Wait..", and then redirects to a page which runs the actual script. Here's a video of it working.
//Script1 Saved as "msn1.scp" and called via http://192.168.1.205:2222/msn1 :
Code: Select all
LabelToVar>HTML,TheHTML
let>Macro_result=TheHTML
/*
HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="3; url='http://192.168.1.205:2222/msn2'" />
</head>
<body>
<p>Please wait...processing... </p>
</body>
</html>
*/
//Script2 Saved as "msn2.scp" and called via the first script at http://192.168.1.205:2222/msn1 :
Code: Select all
let>Macro_result=Second Script Completed
Re: MsNet send response before end of script
I found a different solution to the problem. API triggers script built for running the compiled bot. It returns response straight away without blocking calling program and compiled bot is free to take its time to complete the process:
Thanks for your suggestion though, I'll keep in mind if I'll need to return response upon initialisation and end of the process. 
Code: Select all
RunProgram>{%str_path% + %str_file% + " /_test=ABC /_test2=123"}
Let>MACRO_RESULT={"Quick Response"}
