#100968 - 2003-05-14 05:21 PM
Re: Looking for ideas...
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
It is probably hidden away in the GLOBAL.ASA or DBConnect.asp or DBConnect.inc or something like that.. The only thing with that is that you would need how it connects to the database if it uses ODBC itself. However, it maybe using a DBQ connection.
Kent
|
|
Top
|
|
|
|
#100969 - 2003-05-14 10:55 PM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Okay...
I am down to one pressing issue and one mildly pressing issue...
1. How can I load the current document into a varible? In other words, the code below has the value (ABC1234) in it and I need to extract the value so I can place it into my Access Database.
code:
;<LINK rel="stylesheet" type="text/css" href="Include/AcctMgr.css"> <HTML> <HEAD> <Title>New Account Creation</Title> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <LINK rel="stylesheet" type="text/css" href="NewAccount.css"></HEAD> <body bgcolor="black"> <center><br><br><br><br> <table border="1" bgcolor="navy" bordercolor="yellow" cellpadding="10"> <tr> <td align="center" bgcolor="green"><font color="yellow" size="5"><b>The unique UserID assigned to you is:</b></font> <font color="yellow" size="6"><b>ABC1234</b></font></td> </tr> <tr> <td align="center"><A HREF="GeneralInformation.asp?AnotherAcct=1"><font color="yellow"><b>Create another account</b></font></A></td> </tr> </table> </center> </BODY> </HTML>
2. Right now, I am Sleeping between pages. I tried reusing code:
While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
but I suppose it already assumed the page was finished from the first time it was used. Any ideas on how to make it wait until the next page is loaded?
|
|
Top
|
|
|
|
#100970 - 2003-05-14 11:00 PM
Re: Looking for ideas...
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Allen,
What about this?
IE Window
I know there are other variants of this.
Thanks,
Kent
|
|
Top
|
|
|
|
#100973 - 2003-05-15 01:57 AM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
I consider myself very weak in terms of COM objects so I need to dig for some kb links for the 'microsoft.xmlhttp' object. I'll definately look into it.
Does this object have some of the same methods like the IE Object? Like, click, value, getElementById
Thanks for the idea.
|
|
Top
|
|
|
|
#100975 - 2003-05-15 03:30 AM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Hey Shawn,
Mostly down to just trying to get the data from the web page now... Lonkero suggested using XMLHTTP, but I know even less about that object than I do the IE object Since the pages are asp and since the pages require data from me first, before it gives me the data, I'm not even sure the XML object will work.
You might look back a few posts (now that this discussion has gone to the second page) to see the code I posted earlier today.
Any more words of wisdom...
|
|
Top
|
|
|
|
#100976 - 2003-05-15 04:05 AM
Re: Looking for ideas...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
hmmm, that looks kinda tough to parse-out. Especially since the data isn't enclosed in anything that has an ID ... think there is a way to index into the DHTML using a statement like "the innerHTML of the third FONT element in document", but not counting that, maybe the easiest thing to do would be to capture the InnerHTML of the entire document (based on your example, it seems small anyway) and parse it out yourself (like in that Stock Quote example), using a statement like this:
$HTML = $IE.Document.Body.InnerHTML
? "HTML=" $HTML
|
|
Top
|
|
|
|
#100977 - 2003-05-15 04:43 AM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Shawn... man, how do you figure out these objects?
I saw both .body and .innerhtml on the MS website but never thought to put them together, or for that matter, what .innerhtml actually meant.
BUT... The good news is, you've gave me a way to solve the problem!
Here is how I got it.
code:
Break On
$URL = "@scriptdir\34output.html"
$IE = CreateObject("InternetExplorer.Application")
$IE.Visible = 1
$IE.Navigate($URL)
While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
$htmlcode=$IE.Document.body.innerhtml
$html=split($htmlcode,"<B>")
? left($html[2],7)
Exit 0
So... tomorrow I'll begin the Access process... looks like the db UDFs are pretty straight forward, so hopefully everything from here will be all down hill.
Thanks again.
|
|
Top
|
|
|
|
#100982 - 2003-05-16 09:29 PM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Thanks to some very easy to use UDFs by Sealeopard, I am able to extract the data I need to run my script with no problems. The code below only displays each record in the record set.
code:
break on $objConn = DBConnOpen('DRIVER={Microsoft Access Driver (*.mdb)}; UID=; PWD=; DBQ=f:\nes.mdb') $recordset = DBGetRecordset($objConn,'SELECT Staff.[First Name Initial], Staff.[Last Name],' + ' Staff.[SocialSecurity#], Staff.DOB, Managers.[Department Director],' + ' Staff.[Dept#], Managers.[Department Name], Positions.[Position Title],' + ' Staff.[3/4ID] FROM (Staff INNER JOIN Managers ON Staff.[Dept#]' + ' = Managers.[Dept#]) INNER JOIN Positions ON Staff.[Position#] =' + ' Positions.[Position#] WHERE (((Staff.[SocialSecurity#]) Is Not Null)' + ' AND ((Staff.DOB) Is Not Null) AND ((Staff.[3/4ID]) Is Null) AND' + ' ((Staff.OSHA) Is Not Null)) ORDER BY Staff.[Last Name];')
$colFirstNameInits=0 $colLastNames=1 $colSSNs=2 $colDOBs=3 $colDeptManagers=4 $colDeptNums=5 $colDeptNames=6 $colPositionTitles=7 $col34IDs=8
for $row=0 to ubound($recordset,1) ? "First Name Initial : " + $recordset[$row,$colFirstNameInits] ? "Last Name : " + $recordset[$row,$colLastNames] ? "SSN : " + $recordset[$row,$colSSNs] ? "DOB : " + $recordset[$row,$colDOBs] ? "Dept Manager : " + $recordset[$row,$colDeptManagers] ? "Dept Number : " + $recordset[$row,$colDeptNums] ? "Dept Name : " + $recordset[$row,$colDeptNames] ? "Position Title : " + $recordset[$row,$colPositionTitles] ? "3/4 ID : " + $recordset[$row,$col34IDs] ? "_____________________________________________________________"
next
? @error +":"+ @serror
$retcode = DBConnClose($objConn)
Potentially, once all the data above is entered into the website, the website would return a 3/4ID for each record. I need to update the 3/4ID field in the database for each corresponding record in the recordset. How might I go about doing that? [ 17. May 2003, 01:23: Message edited by: Al_Po ]
|
|
Top
|
|
|
|
#100984 - 2003-05-17 01:48 AM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Actually, I'm beyond the web page part now (Thankfully). I just need to enter data the web page gives me back into my Access database.
Although the code above only displays the recordset, here is how everything works:
Like the example above, I am creating the record set from my local Access DB(using DBGetRecordSet). With the recordset, the script goes through each record in the record set, filling in the fields in the web pages(using InternetExplorer.application.getElementById). Once the data is entered into the webpages the Server gives me a "3/4ID" for that record. The "3/4 ID" is recorded in the script (using InternetExplorer.application.body.innerhtml) That "3/4 ID" needs to be placed in my local Access DB for that particular person/record.
The last step is the part I'm not sure about...
Does this help?
|
|
Top
|
|
|
|
#100986 - 2003-05-19 03:55 PM
Re: Looking for ideas...
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
Thanks for the ideas...
However, Whenever I run the DBExecuteSQL the error code is always -2147352567.
These are the lines of sql I tried...
DBExecuteSQL($objConn,'UPDATE Staff SET Staff.[3/4ID] = "ABC1234" WHERE Staff.[SocialSecurity#]="123-45-6789";')
DBExecuteSQL($objConn,'UPDATE 3/4ID="ABC1234" IN Staff WHERE SocialSecurity#="123-45-6789";')
DBExecuteSQL($objConn,'UPDATE Staff.[3/4ID]="ABC1234" IN Staff WHERE Staff.[SocialSecurity#]="123-45-6789";')
The first line of sql is straight from Access, and it works within Access, but not out.
Any more ideas?
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|