msNet feed back to originating browser

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Simon_Slater
Newbie
Posts: 7
Joined: Thu Oct 16, 2008 4:43 pm

msNet feed back to originating browser

Post by Simon_Slater » Fri Oct 17, 2008 11:48 am

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.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 17, 2008 11:58 am

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?

Simon_Slater
Newbie
Posts: 7
Joined: Thu Oct 16, 2008 4:43 pm

Post by Simon_Slater » Fri Oct 17, 2008 12:07 pm

That sounds way beyond my skill set and the time I currently have to learn new a skill. I guess if that is the only way, I might have to leave the updating to another time.

Thanks for the prompt response.

Simon.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 17, 2008 12:24 pm

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.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Simon_Slater
Newbie
Posts: 7
Joined: Thu Oct 16, 2008 4:43 pm

Post by Simon_Slater » Fri Oct 17, 2008 1:00 pm

Hey Marcus

Thanks for the html code, I was happy with the rest of it but didn’t know how to do the html stuff.

I’ll give it ago

Thanks again.


Simon.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts