| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Tue Nov 04, 2003 4:56 pm Post subject: Capturing URL from Browser Windows Etc |
|
|
Heres a link i found for delphi compoents.
If anyone is good at can they make a dll that can use of of these components, so are free and some are not.
http://www.torry.net/browsers.htm
I personally would like a dll that will capture the url from the browser and thats it
Nathan |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri Nov 07, 2003 9:23 pm Post subject: Here is some example code to grab a browser's url... |
|
|
Make sure Internet Explorer is open and then run the following code.
Using this example, you should be able to put together routines that will work with other browsers. (The code below will work with Internet Explorer.)
Cheers,
Keith L.
| Code: | DIALOG CREATE,GetUrl,-1,0,889,356
DIALOG ADD,LIST,LIST1,10,18,76,328
DIALOG ADD,LIST,LIST2,10,104,74,328
DIALOG ADD,LIST,LIST3,10,190,80,328
DIALOG ADD,LIST,LIST4,10,284,80,326
DIALOG ADD,LIST,LIST5,10,380,78,326
DIALOG ADD,LIST,list8,12,664,210,328
DIALOG ADD,LIST,LIST6,10,468,80,326
DIALOG ADD,LIST,LIST7,10,560,92,326
DIALOG SHOW
list create,1
list create,2
list create,3
list create,4
list create,5
list create,6
list create,7
list create,8
%N = 2
list winlist,1,N
list seek,1,0
if @match(1,Internet Explorer)
goto firstprocess
else
goto evloop
end
:firstprocess
%%Child = @item(1)
%%Child = @window(%%Child,Child)
if @null(%%Child)
goto prepare
end
list add,list1,%%Child
list add,list8,%%Child @wintext(%%Child)
repeat
%%Child = @window(%%Child,Next)
if @null(%%Child)
goto proceed2
end
list add,list1,%%Child
list add,list8,%%Child @wintext(%%Child)
until @equal(@pos(@chr(37),%%Child),0)
:proceed2
list seek,list1,0
goto process
:process
%%Child = @next(list1)
if @equal(@pos(@chr(37),%%Child),0)
goto prepare
end
:process2
%%Child = @window(%%Child,Child)
if @equal(@pos(@chr(37),%%Child),0)
goto nextchild
end
:process3
list add,list%N,%%Child
if @null(%%Child)
goto proceed
end
list add,list8,%%Child @wintext(%%Child)
:process4
%%Child = @window(%%Child,Next)
if @null(%%Child)
goto proceed
end
list add,list%N,%%Child
list add,list8,%%Child @wintext(%%Child)
goto process4
:proceed
list seek,list%N,0
%%Child = @next(list%N)
%N = @succ(%N)
if @equal(%N,9)
goto prepare
end
goto process2
:prepare
list seek,list8,0
if @match(list8,http://)
%%www = http://
goto geturl
end
if @match(list8,https://)
%%www = https://
goto geturl
end
goto evloop
:geturl
%%Url = @item(list8)
%%Len = @len(%%Url)
%%Pos = @pos(%%www,%%Url)
%%Url = @substr(%%Url,%%Pos,%%Len)
info %%Url
goto evloop
:nextchild
%Z = 1
:nextchild2
if @equal(%Z,6)
goto process
end
%%Child = @next(list@pred(%N))
if @null(%%Child)
%Z = @succ(%Z)
goto nextchild2
else
%%Child = @window(%%Child,child)
goto process3
end
:evloop
wait event
goto @event()
:close
exit
|
|
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Thu Feb 02, 2006 2:37 pm Post subject: |
|
|
Getting this thread out of the dust ...
Anyone managed to make it work with FireFox which does not seem to use standard MS controls.. Well I dont see them using WinSpy..
Thanks... |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sat Feb 04, 2006 5:48 am Post subject: |
|
|
Hi Marty,
Have you tried using DDE?
Give this a whirl:
| Code: |
rem Get the active browser window.
%S = @winactive(N)
if @not(@zero(@pos(Firefox,%S)))
DDE LINK,firefox,WWW_GetWindowInfo
if @not(@OK())
warn Cannot connect!
else
%T = 1
%T = @ddeitem(%T)
rem The following function utilizes the string.dll. Of course, you can always use pure VDS to accomplish the same (although with a bit more coding).
%T = @string(Del,%T,@chr(34))
option fieldsep,@chr(44)
parse "%%url",%T
option fieldsep,|
DDE TERMINATE
end
rem The %%url variable should now contain the url.
|
Cheers,
- Boo |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Sat Feb 04, 2006 12:16 pm Post subject: |
|
|
Thanks Boo.. yes I got that option already.. But its not fast and efficient enought for me  |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sat Feb 04, 2006 5:55 pm Post subject: |
|
|
Hi Marty,
Works well for me on both XP and 98SE machines. What do you mean by "...its not fast and efficient ..."? Please elaborate.
Cheers,
- Boo |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Sat Feb 04, 2006 9:01 pm Post subject: |
|
|
By the time the URL is captured half the webpage is already loaded. I want to trap the URL before the webpage starts showing.
And sometimes with IE clicking the Back button does not always trigger the WWW_GetWindowInfo correctly... So the grab URL you did is good for IE.. Thats why I was wondering for Firefox...
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|