Page 2 of 3 <123>
Topic Options
#100967 - 2003-05-14 05:13 PM Re: Looking for ideas...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I think this should work, but I cant get it to refresh on my system. If you query back the value, it is changed, so dont know whats up with that. You might have better luck.

$IE.Document.GetElementById("NTExchange").Value = "Both"

-Shawn

Top
#100968 - 2003-05-14 05:21 PM Re: Looking for ideas...
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#100969 - 2003-05-14 10:55 PM Re: Looking for ideas...
Allen Administrator Offline
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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#100971 - 2003-05-14 11:15 PM Re: Looking for ideas...
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Thanks Kent...

Issue #2 Solved by:

While $IE.Busy and @ERROR = 0 Loop

Still looking for ideas for issue #1.

Top
#100972 - 2003-05-14 11:20 PM Re: Looking for ideas...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
alpo, could you try this and say is it too hard way:

code:
$web=createobject('microsoft.xmlhttp')

$web.open('get','http://my/urg.com', not 1)
$web.send

;send to console:
'page is:'
$web.responsetext



[ 14. May 2003, 23:22: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#100973 - 2003-05-15 01:57 AM Re: Looking for ideas...
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I consider myself very weak [Frown] 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
#100974 - 2003-05-15 02:46 AM Re: Looking for ideas...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Howzit coming along Al?
Top
#100975 - 2003-05-15 03:30 AM Re: Looking for ideas...
Allen Administrator Offline
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 [Frown] 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 Offline
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 Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Shawn... man, how do you figure out these objects? [Confused]

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! [Big Grin]

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. [Cool]

Thanks again.

Top
#100978 - 2003-05-15 10:21 AM Re: Looking for ideas...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, there is no good reference anywhere.
m$ has some docs but they are build with IIS in mind so they have nothing much to offer.

basically, you don't need to click on anything.
with xmlhttp, you can code your own web-browser.

as to, if there is html-tag that wants to you click, you can see the source what the click does and do it in your script.

thus, xmlhttp is better for automation but just like you, ppl don't know much about it.
_________________________
!

download KiXnet

Top
#100979 - 2003-05-15 01:59 PM Re: Looking for ideas...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Al, yeah - keep us up-to-date on your progress, i for one am certainly interested in what your doing. As if you dont have enough status reports to write ?

In terms of the docs, etc ... jlo is right. But to my mind, after you get working with COM objects for a little while, your intuitive ability to guess at how an object model works starts to kick in. Your guesses at what the method or property name "could be" gets more and more accurate. Plus, the search strings you use to lookup stuff on the FW get better and better responses. Plus, what you learn from one MS object model usually can be ported to another. Not sure if any of the old COM hacks on this board can back me on this one.

-Shawn

Top
#100980 - 2003-05-15 02:04 PM Re: Looking for ideas...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
haven't seen the old com-hacks some actively anymore on the board [Wink]

anyway, as what to comes to the keyword and quess, sure you are right.

sadly MS though keeps screwing around their stuff.
I had a way to get to the shell-object documentation for months and now am totally unable to find it with MSDN search engine.

somehow they seem to think that if you search for keyword script, you want to download windows 2003 server and if you use keyword bug they give you link to linux sites [Wink]
_________________________
!

download KiXnet

Top
#100981 - 2003-05-15 02:09 PM Re: Looking for ideas...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm yeah, Stevie B's TypeLibrary viewer can come in handy here as well. I use it and I know you use it too jlo. The other thing I do quite a bit is take a guess at the property name, then dump @SERROR to the console afterwards to see if I get an Unknown name error. Once I get the property name, I use VarTypeName() to see what kind of variant is being returned - an object or a long or a string ... generally just hack it ...

-Shawn

[ 15. May 2003, 14:11: Message edited by: Shawn ]

Top
#100982 - 2003-05-16 09:29 PM Re: Looking for ideas...
Allen Administrator Offline
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
#100983 - 2003-05-17 01:30 AM Re: Looking for ideas...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now I must ask how does the webpage work?
without knowing the internal functioning it's kinda hard to say anything.
_________________________
!

download KiXnet

Top
#100984 - 2003-05-17 01:48 AM Re: Looking for ideas...
Allen Administrator Offline
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? [Confused]

Top
#100985 - 2003-05-17 05:14 PM Re: Looking for ideas...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Take a look at the UPDATE SQL staement and combine it with a WHERE stateemnt to update a perticular person
code:
UPDATE 3/4ID="whatever" IN table WHERE UserID="someone"

_________________________
There are two types of vessels, submarines and targets.

Top
#100986 - 2003-05-19 03:55 PM Re: Looking for ideas...
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Thanks for the ideas... [Smile]

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? [Confused]

Top
Page 2 of 3 <123>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.225 seconds in which 0.181 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org