Does anybody know if you can get msNet and the called script to provide regular feedback to a browser that has called the script remotely?
I know that the browser gets the details via the MACRO_RESULT variable when the script has finished running, but I’m trying to provide regular feedback on the progress of the script.
Any help would be greatly appreciated but please try and keep it simple, as I have never done any form of coding before.
Thanks
Simon.
msNet feed back to originating browser
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 7
- Joined: Thu Oct 16, 2008 4:43 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
One method I can think of might be to have a page which has two frames. One frame is the main script and the other frame to another script. The main script writes progress data to a text file. The other script reads this file and displays it. The main frameset page sets the second frame to refresh every few seconds.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 7
- Joined: Thu Oct 16, 2008 4:43 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
All your main macro has to do when it wants to update the progress is:
WriteLn>c:\progress.txt,r,Something new to tell you
Do that each time you want to output a new message, changing the message each time.
And your progress displaying macro would just do this:
ReadFile>c:\progress.txt,MACRO_RESULT
Just one line!
Now we need to make a simple HTML page.
Open notepad and paste the following:
[code]
function refreshProgress()
{
progress.location.href = "http://server:port/progress_macro"
window.setTimeout("refreshProgress()", 5000);
}
[/code]
Replace all occurrences of "http://server:port/progress_macro" with the correct URL and macro name for the macro that will read the text file and display the progress.
Replace all occurrences of http://server:port/main_macro with URL of main macro.
This is set to refresh every 5 seconds (5000 ms). Change the 5000 to some other millisecond value if you want a different refresh (progress) interval.
Save this somewhere on YOUR computer to something like:
RunMacros.html
Now whenever you want to run your macro, instead of typing it in the URL, open RunMacros.html instead.
If you have a web server and want other people to be able to do this then make RunMacros.html available on the web server. Or even just pop it in a network share and they just have to double click on it.
WriteLn>c:\progress.txt,r,Something new to tell you
Do that each time you want to output a new message, changing the message each time.
And your progress displaying macro would just do this:
ReadFile>c:\progress.txt,MACRO_RESULT
Just one line!
Now we need to make a simple HTML page.
Open notepad and paste the following:
[code]
function refreshProgress()
{
progress.location.href = "http://server:port/progress_macro"
window.setTimeout("refreshProgress()", 5000);
}
[/code]
Replace all occurrences of "http://server:port/progress_macro" with the correct URL and macro name for the macro that will read the text file and display the progress.
Replace all occurrences of http://server:port/main_macro with URL of main macro.
This is set to refresh every 5 seconds (5000 ms). Change the 5000 to some other millisecond value if you want a different refresh (progress) interval.
Save this somewhere on YOUR computer to something like:
RunMacros.html
Now whenever you want to run your macro, instead of typing it in the URL, open RunMacros.html instead.
If you have a web server and want other people to be able to do this then make RunMacros.html available on the web server. Or even just pop it in a network share and they just have to double click on it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 7
- Joined: Thu Oct 16, 2008 4:43 pm