I'm tired of manually copying all the urls one by one in ie browser tab links or multiple ie windows/browsers urls address link field, then paste into a text file.
Anyone have any simple coding method of doing it?
Thank you.
Read all urls in ie and write to a file
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Read all urls in ie and write to a file
Can you clarify your requirements?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Read all urls in ie and write to a file
I mean the actual link in the address bar in IE, I want to copy that link into a file.
Eg, if I open multiple IE tabs, I just want copy the address link in each IE tab into a file or
if I open multiple IE windows, I want copy the address link in each IE window into a file.
For now, I'm doing it manually copy and paste link by link into a file, so I guess whynot create a macro to do it instead.
But I have no idea how to do it.
Thanks.
Eg, if I open multiple IE tabs, I just want copy the address link in each IE tab into a file or
if I open multiple IE windows, I want copy the address link in each IE window into a file.
For now, I'm doing it manually copy and paste link by link into a file, so I guess whynot create a macro to do it instead.
But I have no idea how to do it.
Thanks.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Read all urls in ie and write to a file
Try this:
Set the path of out_file to your preference.
Code: Select all
VBSTART
Sub GetURLS(filename)
set objShell = CreateObject("shell.application")
set objShellWindows = objShell.Windows
If objShellWindows.Count = 0 Then
WScript.Echo "Can not find any opend tabs in Internet Explorer."
Else
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExportFile = objFSO.CreateTextFile(filename, ForWriting, True)
For Each objItem In objShellWindows
FileFullName = objItem.FullName
objFile = objFSO.GetFile(objItem.FullName)
objFileName = objFSO.GetFileName(objFile)
If LCase(objFileName) = "iexplore.exe" Then
LocationURL = objItem.LocationURL
'LocationName = objItem.LocationName
objExportFile.WriteLine LocationURL
End If
Next
End If
End Sub
VBEND
Let>out_file=C:\temp\IEurls.txt
DeleteFile>out_file
VBRun>GetURLs,out_file
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Read all urls in ie and write to a file
What if I want to change it to get all the urls in google chrome or firefox and write it into a file, any idea how I could do that?
Can anyone show me how its done, thank you.
Can anyone show me how its done, thank you.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Read all urls in ie and write to a file
The code provided works only with IE. IE offers a very convenient API which can be used to get the data you're after and hook into the html elements. Chrome and FF not so much, at least not one we currently have access to.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?