08-21-2006, 12:20 PM
Here is the code I am using to extract data from the web page.
Using the (old) MSHTML.IHTMLElement line, it extracts fine. using the HTM line, errors out with window not found' error.
(As previously mentioned, I copied the old functions pertaining to IHTMLElement into v2.19 to be able to use that function in new version, simply as stopgap measure.)
I created both initially with the wizard bar in QM; Note each has an accompanying 'str s' line; REM out one pair of lines to see the two effects.
I have attached an example of the web page I search on; it remains static except for customer data.
Let me know if you need more info. I am using 2.19 QM (Altho I have tried 2.18 with same effect). Thanks for your input.
Using the (old) MSHTML.IHTMLElement line, it extracts fine. using the HTM line, errors out with window not found' error.
(As previously mentioned, I copied the old functions pertaining to IHTMLElement into v2.19 to be able to use that function in new version, simply as stopgap measure.)
I created both initially with the wizard bar in QM; Note each has an accompanying 'str s' line; REM out one pair of lines to see the two effects.
I have attached an example of the web page I search on; it remains static except for customer data.
Let me know if you need more info. I am using 2.19 QM (Altho I have tried 2.18 with same effect). Thanks for your input.
;;Activate Browser
act "Maxthon"
;Search for appropriate HTML to extract
;BEGIN PROBLEM AREA
;------------------------
;MSHTML.IHTMLElement el=HtmlFind3("TABLE" "" "[]<TABLE cellSpacing=0 cellPadding=0 width=''100%'' bgColor=#e1e1e1 border=1><TBODY>[]<TR>[]<TD vAlign=top>[]<TABLE cellSpacing=0 cellPadding=2 width=''100%'' border=0>[]<TBODY>[]<TR>[]<TD vAlign=top>[]<TABLE cellSpacing=2 cellPadding=2 border=0>[]<TBODY>[]<TR>[]<TD align=right><FONT face=Arial,Helvetic" win("Nexicore Services - Maxthon Browser") 0 4 0x28)
;str s = el.innerText
Htm el=htm("TABLE" "Customer Name:DOLLY SMITH[]Street Address:2220 ABLE ST[]Street Address 2:[]City:BESERKELEY[]State:NB[]Zipcode:44702[]Country:US[]Phone 1:9108754365[] " "[]<TABLE cellSpacing=0 cellPadding=0 width=''100%'' bgColor=#e1e1e1 border=1><TBODY>[]<TR>[]<TD vAlign=top>[]<TABLE cellSpacing=0 cellPadding=2 width=''100%'' border=0>[]<TBODY>[]<TR>[]<TD vAlign=top>[]<TABLE cellSpacing=2 cellPadding=2 border=0>[]<TBODY>[]<TR>[]<TD align=right><FONT face=Arial,Helvetic" win("Nexxon Services - Maxthon Browser" "IEFrame") 0 4 0x28)
str s=el.Text
;------------------------
;END PROBLEM AREA
;;Tokenize & Extract data for DB Input
ARRAY(str) arr = s
;nt = tok(s arr 3 ", ()" 8 arr2)
str CN=arr[0]
CN.findreplace("Customer Name:" "")
str SA
SA.findreplace("Street Address:" "")
str SA2=arr[2]
SA2.findreplace("Street Address 2:" "")
str CY=arr[3]
CY.findreplace("City:" "")
str ST=arr[4]
ST.findreplace("State:" "")
str ZP=arr[5]
ZP.findreplace("Zipcode:" "")
str CT=arr[6]
CT.findreplace("Country:" "")
str PH=arr[7]
PH.findreplace("Phone 1:" "")
str fp=PH
str PH1 PH2 PH3
PH1.get(fp 0 3)
PH2.get(fp 3 3)
PH3.get(fp 6 4)
PH.from("(" PH1 ") " PH2 "-" PH3)
str SN=arr[8]
SN.findreplace(" Service Notification:" "")
str Service_Co=arr[9]
Service_Co.findreplace("Service Company:" "")
str Service_Co_Short
Service_Co_Short.get(Service_Co 0 1)
str Ticket_No=arr[10]
Ticket_No.findreplace("PO #:" "")
str AS=arr[11]
AS.findreplace("Assigned To:" "")
str PSD=arr[12]
PSD.findreplace("Part Shipped Date:" "")
str Customer_Address
Customer_Address.from(CN "[]" SA " " SA2 "[]" CY ", " ST " " ZP "[]" PH)
str Comments.from("This is a " Service_Co " Warranty Call" "[]" "This Job has not yet been scheduled")
out Ticket_No
out Service_Co
out Customer_Address
out Comments