Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2001, 01:12 AM
faru91 faru91 is offline
Junior Member
 
Join Date: Jan 2001
Posts: 1
Default Open URL in default browser and auto fill form fields

I would be in need for a function which does the following:

1) Open a given URL in the default web browser (This is working)

2) Fill in data in form fields.

The call would look like:
AutoLogin('http://www.delphipages.com', 'MyUserID, 'MyPassword')
Reply With Quote
  #2  
Old 01-11-2001, 04:36 AM
The Smurf The Smurf is offline
Member
 
Join Date: Jan 2001
Posts: 40
Default RE: Open URL in default browser and auto fill form fields

The only way to really do this is to use the Windows API to get the handle of the browser window, and then send the text to the window.

There is an easier way to get the result you want. The difference is that the browser won't stop on the login site, it will go straight to the site that it would be at after you logged in.

This may or may not work, depending on the URL. When you call ShellExecute to open the browser, pass to it the URL of the page you would be at after you logged in in this format:

http://loginnameassword@www.site.com/thepage

If the site you're trying to view supports it, that will log the user in without having to diddle with the HTML form on the front end.

Hope that helps.

-- The Smurf
Reply With Quote
  #3  
Old 01-11-2001, 01:50 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: RE: Open URL in default browser and auto fill form fields

>The only way to really do this is to use the Windows API to
>get the handle of the browser window, and then send the
>text to the window.

This won't work as the "control" in a browser window have no
handles.

I have tried using ShellExecute to login to Hotmail and
all my attempts have failed. There are a number of hidden
varaibles that need to be passed to the commandline along
with the username and password.

Personally, I use AutoIt to do that. It is a freeware
scripting utility available at: http://www.hiddensoft.com/AutoIt

Here is a script to login to Hotmail using the default
browser. I have included code in the script for using
IE and Netscape, just in case...

; ================================================== ==========
; Logs into a Hotmail account
; ========================={ES 11/01/00}=========================

; Get the path to Netscape from the registry
; ========================={ES 11/01/00}=========================
; {this next line may wrap}
; RegRead, NSPath, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Netscape.exe,
; Run,%NSPath% http://www.hotmail.com,,

; Get the path to IE from the registry
; ========================={ES 11/01/00}=========================
; {this next line may wrap}
;RegRead, IEPath, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE,
;Run,%IEPath% http://www.hotmail.com,,

; Run using just the default browser
; ========================={ES 01/11/00}=========================
Run, %comspec% /c start http://www.hotmail.com,,hide

WinWaitActive, Hotmail
; ========================={ES 11/01/00}=========================
; Wait 5 seconds
; ========================={ES 11/01/00}=========================
Sleep, 5000

; ========================={ES 11/01/00}=========================
; No longer needed as Hotmail now uses javascript to
; move the cursor to the UserID field
; ========================={ES 11/01/00}=========================
; You may have to change these coordinates depending upon your screen resolution
;LeftClick, 260, 210

; Replace xxxxxxxx with your username:
Send, xxxxxxxx
Send, {TAB}
; ========================={ES 11/01/00}=========================
; Extra tab is now needed
; ========================={ES 11/01/00}=========================
Send, {TAB}

; Replace yyyyyyyy with your password:
Send, yyyyyyyy
Send, {TAB}
Send, {ENTER}

BTW, AutoIt includes another utility that allows you to
"comiple" your scripts to exe files. You still need
AutoIt installed to run the exe files, but you do not
need the script source. My Hotmail script compiles to
a 61K executable but I used ASPack (a freeware executable
packer) to pack it to 40kb. (be sure to select Preserve
Extra Data on the Options Tab}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 04:25 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.