parse data into multiple variables
Moderators: JRL, Dorian (MJT support)
Re: parse data into multiple variables
Ok, what if after you grab the values in the text file, I update that text file with new data... will the loop grab the new data next time around? it doesn't seem to do it.....
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: parse data into multiple variables
What text file?
This macro is pulling data from a web page.
And - in this case - the web page is on mjtnet.com and that web page never changes.
So, of course, the data is always the same.
This macro is pulling data from a web page.
And - in this case - the web page is on mjtnet.com and that web page never changes.
So, of course, the data is always the same.
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?
Re: parse data into multiple variables
And IF that file gets updated with new contents? And if that url gets changed dynamically every time it gets hit? Shouldn't the loop pick up new data the 2nd time around as well?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: parse data into multiple variables
Yes. It will.
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?
Re: parse data into multiple variables
I certainly promise you if you do a wait>60 and then go and change things in the text file/url.... on the next loop... it will not parse the new data you've just changed 

- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: parse data into multiple variables
I think perhaps your network/router is caching the request! Also depends on the web server. Our web server (as are many) is set up to cache static content and this is a static file.
Try adding some random parm or timestamp to the URL:
GetTime>theTime
HTTPRequest>http://www.mjtnet.com/demos/vals_exampl ... GET,,sVals
As you have promised me, I promise YOU - there is nothing wrong with the script itself!
Try adding some random parm or timestamp to the URL:
GetTime>theTime
HTTPRequest>http://www.mjtnet.com/demos/vals_exampl ... GET,,sVals
As you have promised me, I promise YOU - there is nothing wrong with the script itself!
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: parse data into multiple variables
Here's a script which requests a page on our server which generates a random number. So it's dynamic. Different every time. I get different data every time. Works perfectly:
As this is dynamic it shouldn't get cached. But if you don't see different data each time then your system/network is caching the request, so try the timestamp thing:
Code: Select all
Let>HTTP_SSL=1
Label>start
HTTPRequest>https://www.mjtnet.com/demos/random.htm,,GET,,data
MessageModal>data
Wait>2
Goto>start
Code: Select all
Let>HTTP_SSL=1
Label>start
GetTime>time
HTTPRequest>https://www.mjtnet.com/demos/random.htm?%time%,,GET,,data
MessageModal>data
Wait>2
Goto>start
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?
Re: parse data into multiple variables
Timestamp does not work... data still the same... but if I stop the loop and restart, then data changes....
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: parse data into multiple variables
My example scripts work for me!
Have you tried my script above?
I've written dozens, no hundreds, of scripts over the years which loop over an http request and never seen it get "stuck". Something tells me there's a missing piece of the puzzle here.
I asked if you could share your script and you showed us a version that uses a static example page on mjtnet.com. That can't really be your script can it? There has to be something different between what I've shown you above and what you doing. Has to be.
Have you tried my script above?
I've written dozens, no hundreds, of scripts over the years which loop over an http request and never seen it get "stuck". Something tells me there's a missing piece of the puzzle here.
I asked if you could share your script and you showed us a version that uses a static example page on mjtnet.com. That can't really be your script can it? There has to be something different between what I've shown you above and what you doing. Has to be.
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?
Re: parse data into multiple variables
I'm sure you've wrote tons of scripts and lines never doubted you, but perhaps something is missing...
My url link has nothing but the following in it:
I recently tried to do this on different machines as well, it does not appear to be my systems... I know the code looks correct and the idea is correct.... but when you're actually testing it... it's not responding properly....
When testing on other development machines, I got hit with license code error, can you please remove my old machines as I am only developing on 1 machine.
Thank you.
My url link has nothing but the following in it:
Code: Select all
<?php
echo "data=".rand(1,999999);
?>
When testing on other development machines, I got hit with license code error, can you please remove my old machines as I am only developing on 1 machine.
Thank you.
Re: parse data into multiple variables
Macroman,
Marcus' scripts are working fine for me also (after I finally got OpenSSL installed). Have you tested these straight off the thread?
HttpRequest> sets a variable each time it is run. If the value of that variable does not change then HttpRequest> has polled the internet and retrieved the same data. As Marcus said, it sounds like there is a cache somewhere that your HttpRequest> call is retrieving. HttpRequest> can't control what happens when it polls the internet, that control is in settings on your computer or on your proxie server or on your DNS server or on your ISP's servers or....
I have a sample of my own for you to try. This takes the time and date from the Macro Scheduler main Forum page. It has a 61 second wait between loops so you will see the time change every 61 seconds.
Marcus' scripts are working fine for me also (after I finally got OpenSSL installed). Have you tested these straight off the thread?
HttpRequest> sets a variable each time it is run. If the value of that variable does not change then HttpRequest> has polled the internet and retrieved the same data. As Marcus said, it sounds like there is a cache somewhere that your HttpRequest> call is retrieving. HttpRequest> can't control what happens when it polls the internet, that control is in settings on your computer or on your proxie server or on your DNS server or on your ISP's servers or....
I have a sample of my own for you to try. This takes the time and date from the Macro Scheduler main Forum page. It has a 61 second wait between loops so you will see the time change every 61 seconds.
Code: Select all
Let>HTTP_SSL=1
Message>Connecting...
Label>start
Let>sVals={""}
HTTPRequest>https://www.mjtnet.com/forum/index.php,,GET,,sVals
Separate>sVals,<p class="right">It is currently ,FD1
Separate>FD1_2,</p>,FoundDate
SetControlText>Macro Scheduler Message,TMemo,1,%FoundDate_1%%crlf%%crlf%%crlf%Seconds until refresh = 0
Let>kk=61
Repeat>kk
Sub>kk,1
SetControlText>Macro Scheduler Message,TMemo,1,%FoundDate_1%%crlf%%crlf%%crlf%Seconds until refresh = %kk%
Wait>1
Until>kk=0
SetControlText>Macro Scheduler Message,TMemo,1,%FoundDate_1%%crlf%%crlf%%crlf%Seconds until refresh = %kk%%crlf%Reconnecting...
Goto>start
Re: parse data into multiple variables
I am not using https, and it is unfortunate that I can't show my url because everything is localhost... but if I were to stop the macro and then re-run it, I get the new DATA just fine.... If I were to open up firefox and keep banging the url the data value would also changed...
I think I'm about to give up on this and find an alternative method
I think I'm about to give up on this and find an alternative method

Re: parse data into multiple variables
Two weeks ago my car quit. Would not start. Tried cleaning battery posts, Checked the connection to the starter. Tried jump starting. Nothing worked. Had the car towed to my local garage. Monday morning the mechanic walked out and the car started right up. They kept it four days trying to figure out what might be wrong but found nothing. Hard to diagnose a problem when its not there.
I'm feeling like my mechanic must have felt. I'd like to be helpful but I don't know how to make this fail.
I did have one thought on re-reading the entire thread. I wonder what would happen if instead of looping in your script you write the script to run straight through one time then end. Then write a second script that runs the Macro> function in a loop. Something like:
In this way you'd be running the script and closing it then running the script and closing it....
I'm feeling like my mechanic must have felt. I'd like to be helpful but I don't know how to make this fail.
I did have one thought on re-reading the entire thread. I wonder what would happen if instead of looping in your script you write the script to run straight through one time then end. Then write a second script that runs the Macro> function in a loop. Something like:
Code: Select all
Label>start
Macro>Path and file name of the httprequest script.
Wait>5
Goto>start
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: parse data into multiple variables
JRL (off topic), sounds like your car has a problem with moisture. When something like that happens, especially in the fall, so moisture tends to be the problem. Does the car rest for a while the water condense and the car is working again.
Re: parse data into multiple variables
Thanks everyone... I pull http all over my script, just this initial one with nested variables from an URL doesn't get updated... I ended up having another macro to check if the first macro is running, if not start it
....
