I am trying to extract numbers from an page acquired with HTTPRequest and have run into issues
If I place the number in a variable (the number being 8 characters long) and test it with
IF>{(%CN% > 0) AND (%CN% < 30000000)}
When there is puncutation in the variable it fails with a message
Line:33 e not appropriate
So I decided to use a sub routine that I have in the past with VBScript which tests for ASCII Characters and that locks up as there is something in the page it does not like, it displays as little boxes in notepad.
Now for the kicker, if I copy the text from the downloaded page from Notepad to Word and then back to Notepad the VBScript option will work. However, this is not an acceptable option
Does anyone have any ideas as to what else to try?
Advanced Parsing Help
Moderators: Dorian (MJT support), JRL
Hi kpassaur,
Will this work?
Will this work?
Code: Select all
let>CN=300.0000
StringReplace>CN,.,,CN
IF>{(%CN% > 0) AND (%CN% < 30000000)}
MessageModal>True
else
MessageModal>False
endifModal>False
endif
Parsing Number
I have sort of a fix, what seems to be causing it to hang up is when it comes to a " if I place a line before it
StringReplace>%CN%,",,CN
It will not get hung up. However, there is still major issues. When using HTTPRequest the data has extra characters of some kind, it is not just the text. But if I write the response to a file then read it line by line and write it back it removes some of it. (but not all of it)
Since I am just trying to parse out numbers I have resorted to using StringReplace on all letters and puncuation. It takes a 32K text file down to 3K in less than a second, but the script never seems to finnish. I have stepped through it and it does the process but something in the file is causing it to just run and run.
This is the page I am trying to get
HTTPRequest>http://www.jokeswarehouse.com/cgi-bin/c ... MLResponse
Anyone know of another way?
StringReplace>%CN%,",,CN
It will not get hung up. However, there is still major issues. When using HTTPRequest the data has extra characters of some kind, it is not just the text. But if I write the response to a file then read it line by line and write it back it removes some of it. (but not all of it)
Since I am just trying to parse out numbers I have resorted to using StringReplace on all letters and puncuation. It takes a 32K text file down to 3K in less than a second, but the script never seems to finnish. I have stepped through it and it does the process but something in the file is causing it to just run and run.
This is the page I am trying to get
HTTPRequest>http://www.jokeswarehouse.com/cgi-bin/c ... MLResponse
Anyone know of another way?
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
If you see "boxes" and Notepad -> Word -> Notepad fixes it then you most likely have control (unprintable) ascii characters in there. Have you tried the vbscript posted by support in this thread http://www.mjtnet.com/forum/viewtopic.p ... hlight=asc
If you see "boxes" then it helps to use a HEX editor to take a look. There are a lot of free ones available.
If you see "boxes" then it helps to use a HEX editor to take a look. There are a lot of free ones available.
Here is a simple filter you can use within Macro Script.
let>validchar=0123456789
let>Str2Chk=123%456
let>Pos2Chk=0
len>Str2Chk,LenOfStr
let>CleanStr=
label>StartCheck
let>Pos2Chk=Pos2Chk+1
if>Pos2Chk>LenOfStr
goto>EndCheck
endif
midstr>Str2Chk,Pos2Chk,1,Char2Chk
pos>Char2Chk,validchar,1,Found
if>Found>0
con>CleanStr,Char2Chk
goto>StartCheck
else
goto>StartCheck
endif
label>EndCheck
let>validchar=0123456789
let>Str2Chk=123%456
let>Pos2Chk=0
len>Str2Chk,LenOfStr
let>CleanStr=
label>StartCheck
let>Pos2Chk=Pos2Chk+1
if>Pos2Chk>LenOfStr
goto>EndCheck
endif
midstr>Str2Chk,Pos2Chk,1,Char2Chk
pos>Char2Chk,validchar,1,Found
if>Found>0
con>CleanStr,Char2Chk
goto>StartCheck
else
goto>StartCheck
endif
label>EndCheck