HTTPRequest quirk I'm experiencing: HTMLResponse Variable

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Nov 28, 2005 1:31 am

1. Have you tried using full path for it.aspx ?
Let>at={Pos("c:\path\folder\it.aspx",%HoldHTMLResponse%)}

2. Is a four character extension causing a problem? aspx. vs. asp?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by JRS » Mon Nov 28, 2005 6:15 am

Hello Bob,

With regard to your reply (thank you for it!) a full path
or whether there I have it.aspx or it.asp is irrelevant ...
whatever is in the quotes is what I'm searching in
the "packed" HoldHTMLReponse variable ... which should
be "HTMLReponse" not "HoldHTMLReponse" for my
revised segment to be logically valid.

1. Have you tried using full path for it.aspx ?
Let>at={Pos("c:\path\folder\it.aspx",%HoldHTMLResponse%)}

2. Is a four character extension causing a problem? aspx. vs. asp?

Of course I'm not at my computer that has Macro Scheduler installed.
My revised segment should be:

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",%HTMLResponse%)}
MessageModal>Got To Here.

The incorrect "HoldHTMLResponse" in my

Let>at={Pos("it.aspx",%HoldHTMLResponse%)}

command is a carry-over from my loop solution
and I realize in hindsight now I forgot to change the
"HoldHTMLResponse" to "HTMLResponse" to make
the segment logically valid.

Now that said two things: from previous experience
changing the "HoldHTMLResponse" to "HTMLResponse"
will still result in the syntax and parsing errors and
even if HoldHTMLResponse is a NULL variable I contend
"at" should merely have a result of zero (0) after the
the command: Is the string: "it.aspx" contained in
HoldHTMLResponse? ... No, it is a NULL thus "at" should = 0.
If I run the corrected segment somewhere in
the 10,000+ bytes of HTMLResponse will be a substring
"it.aspx" and "at" will/should contain the position of the
first occurrence.

I think the intent of the POS command is to never have the
syntax and parsing errors.

To duplicate I wanted to remind the precise fboweb URL is:
http://www.fboweb.com/cob/google.asp?ai ... htnum=1198

I also just wanted to say my "harping" on the POS which PERHAPS doesn't work as expected in this particular situation is far
overshadowed by what DOES work and that is the successful
export of the HTML to an ASCII text file. I'm just being my
anal self trying to make this wonderful Macro Scheduler more
wonderfuller.

Thanks,

Joel S.

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

Post by Marcus Tettmar » Mon Nov 28, 2005 8:44 am

JRS wrote: 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
Joel S.
I expect the problem is that HoldHTMLResponse has quote marks (") in it. In Complex Expressions (and, in VBScript) these are string delimiters. So you will get syntax errors if there is a quote in a string as it thinks the string ends there and then the rest will be garbage. To avoid this you need to double quote. So simply replace all occurences of the quote character with two quote characters:

StringReplace>HoldHTMLResponse,","",HoldHTMLResponse
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}

This is the case for Complex Expressions AND VBScript.

To prove this works:

Let>HoldHTMLResponse=Look for "it.aspx" with quotes
StringReplace>HoldHTMLResponse,","",HoldHTMLResponse
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}

Try it first with the second line and then without the second line. Without it will throw a syntax error ... for IMO obvious reasons.
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 9:20 am

Again, Thanks for getting back to me so fast on what is in my humble
opinion (IMHO) an interesting challenge/issue. Yes, indeed there
are " in the HoldHTMLResponse (or HTMLResponse as explained)
and in fact there are a couple instances of "" coming from the
web page.

ASAP when I get to my "Macro Scheduler computer" I'm going
to go one "one better" than replace all " 's with "" 's ... I'm
going to replace all " 's with any arbitrary relatively obscure
character such as: ^

With respect to my HTML web page source there are no carets
in the 10,000+ bytes I get returned. That is not to say there
won't be in the future but for my purposes it will be in my
opinion a better substitution than all " 's to "" 's

I will post my results ASAP. But that said is the Syntax error
still expected on a "NULL" HoldHTMLResponse (or for that
matter any other) variable? - one that by definition does not
contain a: " (?)

Thanks,

Joel S.

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

Post by Marcus Tettmar » Mon Nov 28, 2005 9:42 am

There's really no need to replace quotes with another character. Replacing quotes with double quotes is fine.
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 10:11 am

Ah, thanks for the clarification:

There's really no need to replace quotes with another character. Replacing quotes with double quotes is fine.

My game plan once I get to my Macro Scheduler computer is:

1.) to perform the StringReplace as you designated:

Let>HoldHTMLResponse=Look for "it.aspx" with quotes
StringReplace>HoldHTMLResponse,","",HoldHTMLResponse
Let>at={Pos("it.aspx",%HoldHTMLResponse%)}

and see if I'm still experiencing the syntax problem ...

2.) If I do I'm going to try this:

Let>HoldHTMLResponse=Look for "it.aspx" with quotes
StringReplace>HoldHTMLResponse,","",HoldHTMLResponse
Let>HoldStr=it.aspx

Let>at={Pos(%HoldStr%,%HoldHTMLResponse%)}

-and/or-

Let>at={Pos(HoldStr,%HoldHTMLResponse%)}

and report immediately back.

For Let>HoldStr=it.aspx making absolutely, positively sure no trailing spaces and for that matter all applicable command lines (there
are some command lines in other parts of my script outside this
topic where I purposely have put in trailing spaces.)

Looking forward to 1.) doing the trick.

Thanks,

Joel S.

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

Post by JRS » Mon Nov 28, 2005 10:18 am

Clarification ....

Am going to keep HoldHTMLResponse packed with the HTML from
the web page instead ofthe Let>HoldHTMLResponse=Look for "it.aspx" with quotes command as indicated. Everything else verbatim.

Joel S.

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

Post by JRS » Mon Nov 28, 2005 3:58 pm

Re: Syntax error issue ... making progress

Performed the StringReplace per suggestion.
At the MessageModal> command after the
StringReplace>HTMLResponse,",^,HTMLResponse command
the " 's are replaced by ^ 's.

However, at the Let>at={Pos("it.aspx",%HTMLResponse%)}
I get a Macro Scheduler "String Too Long" [OK] error dialog
... that just won't quit. Had to go to Windows Program Manager
[Ctrl][Alt][Delete] and stop macro Scheduler and then ultimately
reboot my computer. I know HTMLResponse is a little
over 10,000 bytes so I can keep dividing 10,000 by 2
so I will get a segment size that won't result in a String
Too Long issue. My question is is there anyone who has
used HTTPRequest and what's the greatest byte count
for HTMLResponse (or whatever variable you're using)
from your web page. Is it per chance I've just coincedentally
hit a web page that overwhelms the Pos Function counters ...
or is it designed for any byte size and there's something
still inherently wrong? Is there some kind of Macro
Scheduler set that will override or not make the error
occur?

Again thanks,

Joel S.

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

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

Post by Marcus Tettmar » Mon Nov 28, 2005 4:04 pm

Use the native Position command instead of the Complex Expression Pos command as it can cope with longer strings.
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 8:55 pm

Re: Syntax and Parsing Error issue/problem ....

======= SUCCESS !!!!! =======

MessageModal>%HoldURL%
DeleteFile>c:\flight\Flight_Http_dump.txt
HTTPRequest>HoldURL,c:\flight\Flight_Http_dump.txt,GET,,HTMLResponse
HTTPRequest>HoldURL,,GET,,HTMLResponse
StringReplace>HTMLResponse,",^,HTMLResponse
MessageModal>%HTMLResponse%
Length>%HTMLResponse%,Lgth
MessageModal>%Lgth%
Position>it.aspx,HTMLResponse,1,StartPos
MessageModal>%StartPos%

Used "native" Position command ... works perfectly.

Props and Congrats to the most thorough and patient tech
support I've ever come across ... as well as other users willing to help.

Joel S.

Excellent job well done.

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