The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Cookies are twarting me!
Posted: 08 Dec 06 1:26 PM
|
fiogf49gjkf0d Ok I have a pretty simple sub (that works): -------------------------------------------------- Sub txtFDICDblClick(Sender) DIM strFDIC DIM strURL
strFDIC = CLng(txtFDIC.Text) strURL = "http://www2.fdic.gov/idasp/confirmation.asp?inCert1=" & strFDIC & "&AsOf=MostCurrent&Refer=ID" msgbox strURL Application.BasicFunctions.WebOpen(strURL) End Sub -----------------------------------------
The trouble is that the FDIC website uses session cookies and doesn't like me trying to go directly to the URL specified.
Anyone know a trick around this? |
|
|
|
Re: Cookies are twarting me!
Posted: 08 Dec 06 2:33 PM
|
fiogf49gjkf0d Something I tried but didn't work as hoped is: ---------------------------- Dim strLaunchURL strLaunchURL = "http://www2.fdic.gov/idasp/index.asp" Application.BasicFunctions.WebOpen(strLaunchURL) ---------------------------
I set that code before launching the specific page (above). It creates the session cookie but the sub routine runs the two WebOpen functions so quickly that Windows opens both URLs at the same time so the session cookie has not been assigned in time for the second window to use it.
If I run the script again, with the browser window open it works fine.
Basically the only way I see this working, at this point, is two separate actions. One to open the browser initially, to get the cookie and then another action to pass the URL with my FDIC variable.
I can do this a number of ways but none of them seem very user friendly/transparent to the user.
Thoughts? |
|
|
|
Closer but still not perfect
Posted: 08 Dec 06 3:35 PM
|
fiogf49gjkf0d Here is what I eventually wrote and it kinda works (I'll explain at the bottom): ================= Sub txtFDICDblClick(Sender)
FDICInitialize
dim i i = 0 Do While i < 5000000 i = i + 1 Loop
FDICPassthru End Sub
sub FDICInitialize Dim strLaunchURL
strLaunchURL = "http://www2.fdic.gov/idasp/index.asp" Application.BasicFunctions.WebOpen(strLaunchURL) End Sub
Sub FDICPassthru DIM strFDIC DIM strURL
strFDIC = CLng(txtFDIC.Text) strURL = "http://www2.fdic.gov/idasp/confirmation.asp?inCert1=" & strFDIC & "&AsOf=MostCurrent&Refer=ID" Application.BasicFunctions.WebOpen(strURL) End Sub ==============
The problem with this approach is two-fold. One, the loop delay is dependent on the speed of the processor so newer systems may move too fast. Two, only new tab-based browsers are able to use this. IE 6 will open up two separate windows. The second window will not have the session cookie that the first window opens. We could force all our users to upgrade their browsers but that's not realistic.
So I'm back to the drawing board. |
|
|
|
Re: Closer but still not perfect
Posted: 10 Dec 06 8:35 AM
|
fiogf49gjkf0d Got a nice thread running here to yourself from yourself. Happens to all of us at one time or another.... -- rjl |
|
|
|
Re: Closer but still not perfect
Posted: 11 Dec 06 7:25 AM
|
fiogf49gjkf0d LOL Yea well I thought orginally that the topic might be useful, then I didn't want to look like a dummy. Now I just look like I talk to myself. |
|
|
|
Re: Closer but still not perfect
Posted: 12 Dec 06 6:40 AM
|
fiogf49gjkf0d It's an interesting topic.. not just attracting much attention - except for hecklers -- rjl |
|
|
| |
|
Re: Closer but still not perfect
Posted: 12 Dec 06 8:02 AM
|
fiogf49gjkf0d I had to figure out a way to hit 100 posts some how J/K
I still don't have a good solution either. Sucks, but there are bigger fish to fry right now. I was hoping it would have been a quick solution. If the FDIC site didn't use session cookies it would have only been like 6-7 lines of very simple code, including the SUB/END SUB and a couple DIMs. |
|
|
|
Re: Closer but still not perfect
Posted: 13 Dec 06 7:46 AM
|
fiogf49gjkf0d You could try automating IE through COM, but I don't have any examples to give you, nor have I tried automating IE with vbscript, only VB6. |
|
|
|
Re: Closer but still not perfect
Posted: 13 Dec 06 7:51 AM
|
fiogf49gjkf0d Doug,
Later next year I'll be getting a copy of Visual Studio. At that time I'll look at more powerful ways to manipulate IE or another browser to get my desired results. I'm not going to try to get data to pass back into SalesLogix (if even possible) with it's native dev environment. I'm not that good of a coder. LOL |
|
|
|
Re: Closer but still not perfect
Posted: 13 Dec 06 8:11 AM
|
fiogf49gjkf0d The reason I bring up this suggestion is because it will allow you to open and control 1 instance of IE, so you could open the initial page so the cookie gets set and then have it navigate to the detail page you are interested in.
Something like this may work the gEventCookie hooks IE's events and allows subs in slx to fire in response to said events.. so in the buttonclick event, navigate to your initial web page, and then in the NavigateComplete2 sub, if the URL matches your initial site, navigate to your detail page.. '''''''''code below dim IE dim gEventCookie
Sub Button1Click(Sender) set IE = CreateObject("InternetExplorer.Application") gEventCookie = HookEvents(IE, "IE_")
IE.Navigate "http://www.google.com" IE.Visible = true End Sub
sub IE_NavigateComplete2(pDisp, URL)
select case URL case "http://www.google.com/" IE.Navigate "http://www.yahoo.com/" end select end sub
Sub AXFormDestroy(Sender) if gEventCookie <> "" then UnhookEvents(gEventCookie) end if on error resume next IE.Quit
set IE = nothing End Sub
|
|
|
| |
|
Re: Closer but still not perfect
Posted: 13 Dec 06 10:35 AM
|
fiogf49gjkf0d Dude! This is looking good. So far so good. I need to test it on a couple other systems to confirm, but you may have just made me look like a hero! Thanks! |
|
|
| |
|