Jump to content

Recommended Posts

Posted (edited)

Why will this not work? I have spent a few hours on this one little problem. I have tried everything I can think of to make it work, but never wants too. I have tested the pattern in a few other scripts and it works fine. the @ERROR says it is a bad string - but how can String($HTML) be bad? Is it to much text for it to string?

$IE = _IECreate("C:\Users\Ned\Dropbox\Public\Findings.html", "", 0)
$HTML = _IEBodyReadHTML($IE)
_IEQuit($IE)
$HTML = String($HTML)
$array = StringRegExp($HTML, '(?<=\QNew: <a href="/items/view/\E)(.*?)(?=\Q">\E)', 3) ;gets new item numbers
_ArrayDisplay($array)
Edited by Ned
Posted

I dont see any error checking. How do you know its coming from String()? Have you tried printing $HTML to the console to verify that _IEBodyReadHTML() worked?

Posted

I have made string $html print to console and everything was there like it should. The pattern works fine when I put the raw text in the script directly, just never when it gets it from an ie window.

Posted

Wait...If you manually add the string $html to your script it works? That is weird. I have a few ideas that might work, but nothing to figure out whats actually going wrong. Maybe try putting on the clipboard and then reading back?

Clipput($html)
$html = clipget()

If that doesnt work maybe :graduated:

Clipput($html)
$html = clipget()
_filecreate(@scriptdir & '\Temphtml.txt')
filewrite(@scriptdir & '\Temphtml.txt', $html)
$html = fileread(@scriptdir & '\Temphtml.txt')
filedelete(@scriptdir & '\Temphtml.txt')
Posted

I ended up going a different route using table to array function since it wasn't working. Luckily I am able to use that function. Never tried the other options you gave in last post, but thanks for the help.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...