Results 1 to 6 of 6

Thread: Log where I go on the internet

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Question

    How would I take a website name and say log it to a text file? Kinda like what the temp internet files does under microsoft internet explore, and kinda like what the history files do under microsoft internet explore.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    If it's the file writing you're having trouble with then the easiest way is to use the FileSystemObject. Go to the Project menu and hit References. Then you will be presented with a big list of checkboxes, somewhere on the list is one called "Microsoft Scripting Runtime" select this and press OK.

    add a text box and a command putton to your form and add this code

    Code:
    Option Explicit
    
    'Edit this to change the name of the file, you can have it as a variable and not a constant if you want.
    Const MyFileName As String = "C:\MyFile.txt"
    
    'This is a component that handles all the hard stuff about writing files
    Dim FSO As New FileSystemObject
    
    'This is the way it handles a text file
    Dim MyFile As TextStream
    
    Private Sub Command1_Click()
    'just write a line to the end of the file
    MyFile.WriteLine Text1.Text
    End Sub
    
    Private Sub Form_Load()
    
    'We open the file here and leve it open all through the progrem.
    'It closes itself at the end, but if you want to close it before use
    'Set MyFile = Nothing
    
    
    
    'If the File we want already exists
    If FSO.FileExists(MyFileName) Then
    
        'Open the file For appending as MyFile
        Set MyFile = FSO.OpenTextFile(MyFileName, ForAppending)
        
    Else
    
        'Create a new textfile as MyFile
        Set MyFile = FSO.CreateTextFile(MyFileName)
        
    End If
    
    End Sub

    This will add whatever is written in text1 to the file specified, you can modify this to save names of websites.

  3. #3
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    do you want to get the curent URL and window title from your browser too? if so, see my reply at
    http://forums.vb-world.net/showthrea...threadid=25452

  4. #4
    Guest
    If you want to use your own Webbrowser using ShDocVw.dll:

    Code:
    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    Open App.Path & "\visited.log" For Append As #1
    Print #1, URL 'Webbrowser1.LocationURL can do the same, which ever one you feel more comfortable using.
    Close #1
    End Sub

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Unhappy explained wrong

    Ok, sorry about that, if i am useing microsoft internet explore, how could i write every page i go to, into a text file? so if i whent to yahoo.com it would make a file with yahoo.com in it. or i whent to compaq.com right after i whent to yahoo.com the text file would look like this

    yahoo.com
    compaq.com

    so basicly i just want to know every site that has been visited.

  6. #6
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    poll every second using my code mentioned above. Then print to a text file using
    Code:
    Dim FF as Integer
    FF = FreeFile
    Open "MyFile.txt" for Append as #FF
    Print #FF,BrowserName; "-"; WindowTitle
    I know it works, i do it in a monitoring app. I write to a database, though.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width