Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Any way to get all the save target as links to a file

Hi,

Say if i am on EE page and there anr many links Can i get all these to a  file.
Say i have opened Q's need to get all these names(The full Http path) to a file.


Regards
SHarath
Avatar of JonMny
JonMny



      Dim IeDoc As Object
        'Create new instance of IE
        Dim ieapp As Object = CreateObject("InternetExplorer.Application")
        'Make it visible - some things dont work
        'unless its visible
        ieapp.Visible = True
        'define the page to open
        Dim sURL As String = "www.yahoo.com"
        'navigate to the page
        ieapp.Navigate(sURL)
        'Pause the macro using a loop until the
        'page is fully loaded
        Do
        Loop Until ieapp.ReadyState = 4 ' READYSTATE_COMPLETE
        'store the Document object
        IeDoc = ieapp.Document
        For d As Integer = 0 To ieapp.Document.All.tags("a").Length
            My.Computer.FileSystem.WriteAllText("C:\Test.txt", IeDoc.Links(d).href & vbCrLf, True)
        Next
Avatar of bsharath

ASKER

Is this a Vbs script...
It's VB.Net, converted from a vbs
Sorry to ask how should i run this..
I saved the code as "Filename.vbs" But gives an error.

The code is vb.net if you want to make a vbs file  use this

    Dim sURL
    Dim IeDoc
    Dim i

Const ForAppending = 8


set objFSO = CreateObject("Scripting.FileSystemObject")

set objFile = objFSO.OpenTextFile("C:\testa.txt", ForAppending, True)




    'Create new instance of IE
    Set ieapp = CreateObject("InternetExplorer.Application")
   
    'Make it visible - some things dont work
    'unless its visible
    ieapp.Visible = True
        'define the page to open
    sURL = "www.yahoo.com"
    'navigate to the page
    ieapp.Navigate sURL
    'Pause the macro using a loop until the
    'page is fully loaded
    Do
    Loop Until ieapp.ReadyState = 4 ' READYSTATE_COMPLETE
    'store the Document object
    Set IeDoc = ieapp.Document
   For d = 0 To ieapp.Document.All.tags("a").Length

objFile.WriteLine(IeDoc.Links(d).href)



    Next
objFile.Close




I get this...

---------------------------
Windows Script Host
---------------------------
Script:      C:\Documents and Settings\sharathr\Desktop\Get all links.vbs
Line:      33
Char:      1
Error:      Object required: 'Links(...)'
Code:      800A01A8
Source:       Microsoft VBScript runtime error

---------------------------
OK  
---------------------------
Did it open IE when you ran it? What URL did you use?
Yes it opens the iE and for this link...
https://www.experts-exchange.com/?qipuIndex=1&openQuest=true#questionsInProgress


Here i have all my open Q's...
I got the error here.

For Yahoo it worked fine...
ASKER CERTIFIED SOLUTION
Avatar of JonMny
JonMny

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wayne Taylor (webtubbs)
>>but if your wanting to monitor questions on EE you may want to check out quickee on sourceforge.net

...or even better, check out my profile :)
I get this...
---------------------------
QuickEE
---------------------------
Object reference not set to an instance of an object.
---------------------------
OK  
---------------------------


After installing it asks me for the username and password after i provide i get this...

It says Logging in please wait....
bsharath,

Any bugs or problem you encounter, please post in the Bugs thread -> http:/Q_22769793.html

Wayne