HTTPRequest quirk I'm experiencing: HTMLResponse Variable

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

HTTPRequest quirk I'm experiencing: HTMLResponse Variable

Post by JRS » Fri Nov 25, 2005 9:59 pm

Hello All,

I'm experiencing a quirk (at least for me) using HTTPRequest
with respect to the variable containing the HTML code the the
web page. Something strange seems to be with respect to it.

I've stayed with HTTPRequest per the example in the Macro
Scheduler Help

Perhaps I'm overlooking something obvious(?)

OK, Here is my code segment:

.
.
.

MessageModal>%HoldURL%
DeleteFile>c:\flight\Flight_Http_dump.txt
HTTPRequest>HoldURL,c:\flight\Flight_Http_dump.txt,GET,,HTMLResponse
MessageModal>HTMLResponse
Let>at={Pos("it.aspx",%HTMLResponse%)}

I can tell I have a correct URL "packed" in HoldURL from two respects:
The MessageModal>%HoldURL% results in a Macro Scheduler dialog
showing my valid URL:

http://www.fboweb.com/cob/google.asp?ai ... htnum=1198

and more importantly Flight_Http_dump.txt nicely contains the HTML
of the URL. So by default HTMLResponse within the HTTPRequest
command must be "working". In other words its contents wind
up in Flight_Http_dump.txt

The next command: MessageModal>HTMLResponse results in a
Macro Sceduler dialog: HTMLResponse and if I change the
MessageModal> to MessageModal>%HTMLResponse% I get
%HTMLResponse% in the dialog.

The only thing I can come up with is the contents of HTMLResponse
are deleted or nulled out after creating and "packing"
Flight_Http_dump.txt. Is this correct? Is this what is supposed
to occur or should HTTPResponse still contain the HTML text?

Also, it follows I will have Macro Scheduler syntax errors with the
following Let>at={Pos("it.aspx",%HTMLResponse%)} command

Thanks all for any insight.

Regards,

Joel S.



[img]

[/img]

[img]

[/img]



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 Nov 25, 2005 11:17 pm

Perhaps you have a trailing space at the end of the HTTPRequest line? This would set the result in a variable called "HTTPResult " rather than "HTTPResult" which you are using subsequently ....
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Nov 26, 2005 6:31 am

Thanks for getting back me so fast on my HTTPRequest / HTTPResponse
issue!

Ahhh ... I see it may be yet another case of "the extra space" that
I found in my own programming and is the culprit for other problems
that can be found on this forum.

I'm not my computer that has Macro Scheduler but it will, of course,
be the first thing I investigate and will report back.

I'm just thinking as a suggestion seeing that programming VBScript or
VBScript with respect to Macro Scheduler 'trailing spaces" are an
important issue if the editor could perhaps be tweaked to show
maybe a light grayscale or a light shade of another color to represent
the presence of 'trailing spaces" on all the command lines where they
are present to remind the programmer they're there.

Just a thought ...

Again, thanks for gettting back so fast.

Joel S.

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

Post by Marcus Tettmar » Sat Nov 26, 2005 9:35 am

JRS wrote: if the editor could perhaps be tweaked to show
maybe a light grayscale or a light shade of another color to represent
the presence of 'trailing spaces" on all the command lines where they
are present to remind the programmer they're there.
Haha - we're one step ahead of you. Version 8.0 Beta already does that :-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Nov 26, 2005 7:41 pm

Re: Enhanced editor showing trailing spaces: Excellent! This is really
going to be a nice feature.

Re: Potential HTTPResponse solution that perhaps is solved by a
fixing the presence of a trailing space ... (I hate to be the bearer
of bad news it is) but that doesn't seem to be the issue. I did
and "end line" from the keyboard on the HTTPRequest command
line and went up and down above and below the HTTPRequest
command line (and of course including it) and found no indication
of a trailing space on the HTTPRequest command line.

Can it be possibly my machine or have another ideas. I was
also wondering if I gave enough information so you could reproduce
the code segment in isolation on your side?

Thanks,

Joel.

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

Post by Marcus Tettmar » Sat Nov 26, 2005 7:58 pm

Wait a minute! It's because you have specified a file name. The result gets put in that file instead of the result variable. If you want both you could do:

HTTPRequest>HoldURL,,GET,,HTMLResponse
WriteLn>c:\flight\Flight_Http_dump.txt,r,HTMLResponse
MessageModal>HTMLResponse
Let>at={Pos("it.aspx",%HTMLResponse%)}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Nov 26, 2005 8:12 pm

I hope this extra information you may find useful ...

You'll notice I've Remarked out the original HTTPRequest line
replacing it with not exporting the contents of the HTTPResponse
variable to a file. The subsequent MessageModal command
now shows the HTML! The subsequent Let command now has
the following result(s):

I get a Macro Scheduler error dialog:

opDivide not allowed here.
[OK]

On clicking the OK I get another Macro Scheduler error dialog:

Error Parsing Expresssion
[OK]

On clicking the OK I get another another instance of the same
Error Parsing Expression dialog and on clicking OK on this second
instance the Macro Scheduler script "drops out" as I expect it
would or as intended.

Hope this helps and I've described what I'm experiencing OK,

Thanks,

Joel S.


MessageModal>%HoldURL%
DeleteFile>c:\flight\Flight_Http_dump.txt
Remark>HTTPRequest>HoldURL,c:\flight\Flight_Http_dump.txt,GET,,HTTPResponse
HTTPRequest>HoldURL,,GET,,HTTPResponse
MessageModal>%HTTPResponse%
Let>at={Pos("it.aspx",%HTTPResponse%)}

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Nov 26, 2005 8:47 pm

I just wanted to report in my Firefox broswer doesn't seem to
handle all posts on this forum very well. I couldn't read the
solution post for the file getting the HTML ... the post appears
outside the message field and the whole message doesn't show.

I posted my findings anyway.

I'm now using Microsoft IE reading this forum and the post
is showing perfectly.

So with the HTTPResponse variable issue resolved, again the current
new issue is why or what's happening when I'm trying to do the
string search on the HTTPResponse that is now "packed" with the
HTML code.

Again, and as always thanks for the help on this great app.

Joel S.

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

Post by Marcus Tettmar » Sat Nov 26, 2005 9:15 pm

Thanks for the heads up on the Firefox issue. I've just fired up Firefox and verify what you are seeing. We'll get that sorted next week.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
Monkster
Junior Coder
Posts: 42
Joined: Fri Oct 04, 2002 9:37 pm
Location: On an Island with Wilson

Post by Monkster » Sat Nov 26, 2005 11:04 pm

The new format of the board looks really nice. I have the same issue in Firefox but (along with IE) the page looks perfect in the (now Freeware) Opera browser.

http://www.opera.com/
Best Wishes,
Monkster

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sun Nov 27, 2005 11:58 am

All ...

I'm just thinking a little out loud before getting other reasons, ideas
and/or fixes for my opDivde and subsequent Error Parsing Expression
(both Macro Scheduler) errors (Error dialogs) from other Macro
Scheduler Users.

Perhaps (?) in the HTTP (what should be ASCII text I'm surmising)
contents of the HTTPRequest dump to HTTPResponse, HTTPResponse
contain multiple CR/LF's or perhaps other binary characters that's
making the POS function choke up big time.


This isn't "pretty" but what I'm thinking is use the HTTPRequest
and make a file thus I can get a byte count. I use the WriteLn>
suggestion and "repack" HTTPResponse with the HTTP data.

I then make a loop filter out each byte "lower ASCII" below ASC(32)
-a space- and above ASC(127) -a tilde- "~". Each byte between
ASC(32) and ASC(127) is concatenated byte by byte into a new
or "fresh" variable (e.g. HTTPResponse_2) within the loop.

After the loop my "fresh" variable: HTTPResponse_2 would
have the string search done on it featuring the POS function
which hypothetically should have "clear string search
sailing" with only "pure" ASCII text characters.

I'm not at my computer right now. I guess if there's no response
with perhaps a more elegant or better solution/fix I'll bite the
bullet and do the programming and report back.

I guess I could also do a byte count on the HTTPReponse after
the HTTPRequest (sans writing a file). If the byte count doesn't
come back from the first CR and/or LF recognized I'll be in
business because writing a file would not be needed for the
given objective.

Thanks,

Joel S.

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sun Nov 27, 2005 1:28 pm

Still not at my computer but following is the Macro Scheduler
code segment I was referring to programming for my
hypothetical opDivide and Error Parsing Expression issue
I previously described. This code segment I plan to implement to get around my opDivide - Error Parsing Expression issue I'm
encountering which I previously described. I think the %'s and
"no %'s' are correct but I won't know until I implement the segment.

Note: The Let>HoldHTMLResponse= and Let>somevalue= commands
I'm especially making sure have no trailing spaces. I believe each variable will be effectively NULLed before being packed with a value.

Like I said it's not elegant but if it works I'll take ugly any day ...

Joel S.

.
.
.
Length>%HTMLResponse%,Lgth
MessageModal>%HTMLResponse%
MessageModal>%Lgth%
Let>HoldHTMLResponse=
Let>Ctr1=0
Repeat>Lgth
Let>Ctr1=Ctr1+1
Let>somevalue=
MidStr>%HTMLResponse%,%Ctr1%,1,somevalue
IF>{(%somevalue% >= 32) AND (%somevalue% HoldHTMLResponse,somevalue
EndIf
Until>Ctr1,Lgth
MessageModal>%HoldHTMLResponse%
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}
.
.
.

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sun Nov 27, 2005 3:41 pm

I've gotten to my computer and to make some changes to my
code segment:

HTTPRequest>HoldURL,,GET,,HTMLResponse
Length>%HTMLResponse%,Lgth
MessageModal>%HTMLResponse%
MessageModal>%Lgth%
Let>HoldHTMLResponse=
Let>Ctr1=0
Repeat>Ctr1
Let>Ctr1=Ctr1+1
Let>somevalue=
MidStr>%HTMLResponse%,%Ctr1%,1,somevalue
If>{(%somevalue% >= 32) AND (%somevalue% HoldHTMLResponse,somevalue
EndIf
Until>Ctr1,Lgth
MessageModal>%HoldHTMLResponse%
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}
MessageModal>%at%
Remark>MessageModal>%HTMLResponse%
Remark>Let>at={Pos("it.aspx",%HTMLResponse%)}
Remark>MessageModal>%at%

For the MessageModal>%Lgth% command I got a "return" of
something like 10280 so the HTMLResponse is accurately
being determined or represented from what I can see.

I'm getting a Macro Scheduler Syntax error and then an
Error Parsing Expression Error at
MessageModal>%HoldHTMLResponse% or within the loop.

My solution does not appear to work. While I could load
up the exported text file if I wanted to use the export
to file variation of the HTTPRequest command and load it
up into Excel all under Macro Scheduler oversight, the question
still begs why I'm consistently getting the same genre of errors
where it seems the string search should be able to be realized
entirely within the Macro Scheduler script.

Thanks,

Joel S.

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

Post by Marcus Tettmar » Sun Nov 27, 2005 3:49 pm

It would help if we knew which line the error occured on. Please step through with the debugger to determine the exact line that is throwing the error.

On guess is this line:

If>{(%somevalue% >= 32) AND (%somevalue% <= 127)}

Here you are using complex expressions and in this format it expects a numeric value for somevalue. How are you ensuring this is always numeric?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Mon Nov 28, 2005 1:04 am

In retrospect I really think the loop puts in an added
consideration that really doesn't have to be there. I think
the following variation of my Macro Scheduler code segment
really puts my syntax error - Error Parsing Expression issue/
problem into succinct terms:

.
.
.
MessageModal>%HoldURL%
DeleteFile>c:\flight\Flight_Http_dump.txt
HTTPRequest>HoldURL,c:\flight\Flight_Http_dump.txt,GET,,HTMLResponse
HTTPRequest>HoldURL,,GET,,HTMLResponse
MessageModal>%HTMLResponse%
Length>%HTMLResponse%,Lgth
MessageModal>%Lgth%
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}
MessageModal>Got To Here.

1.) Going into the segment HoldURL contains the valid
http://www.fboweb.com URL in this thread. The first command
MessageModal>%HoldURL% shows the URL.

2.) From:
HTTPRequest>HoldURL,c:\flight\Flight_Http_dump.txt,GET,,HTMLResponse
I realize the ASCII text file: c:\flight\Flight_Http_dump.txt
in my flight folder/subdirectory. The file shows a byte count of
11K using my Windows Explorer and 10281 the old fashioned way
going to a DOS window and doing a dir of C:\flight

3.) From:
HTTPRequest>HoldURL,,GET,,HTMLResponse
MessageModal>%HTMLResponse%

I realize a Macro Scheduler dialog (correctly) showing the contents of
Flight_Http_dump.txt ... the HTML of my web page. (No problem)

4.) From:
Length>%HTMLResponse%,Lgth
MessageModal>%Lgth%

I realize a Macro Scheduler dialog (correctly) showing just: 10281

5.) My syntax/Error Parsing errors occur on the:
Let>at={Pos("it.aspx",%HoldHTMLResponse%)} command
I never reach the MessageModal>Got To Here. command

I hope this puts the problem into succinct perspective. Perhaps
is there a limit on the string length the Pos function will accept?

Again, I can see where I can load up the Flight_Http_dump.txt
into Excel and do a string search in a cell block range for my
it.aspx string but obviously one command within Macro Scheduler
is much more elegant and preferable if there is a way I could use
Let>at={Pos("it.aspx",%HoldHTMLResponse%)} or know the
limits(?) of the Pos function (if this indeed is the issue) when it
can be implemented.

Thanks Again,

Joel S.

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