Results 1 to 4 of 4

Thread: [RESOLVED] Translation of text using VB6

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Resolved [RESOLVED] Translation of text using VB6

    I have a long list of small sentences to translate and I would like to write a small VB program to take one sentence at a time, send it to a web translation, possibly using the translator's URL and the text to translate as a parameter, and then get back the translation by parsing the resulting page.

    Have anybody successfully done something similar? If so, which translator where you using? Is it working well? Any source code to get me going?

    Thanks
    Last edited by Hack; May 30th, 2006 at 01:45 PM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Translation of text using VB6

    using babelfish...

    add a webbrowser to your form.. and add a reference to the HTML object library

    VB Code:
    1. Private Sub Form_Load()
    2.     WebBrowser1.Navigate "http://babelfish.altavista.com/"
    3. End Sub
    4.  
    5. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    6.     Dim HTML As HTMLDocument
    7.     If (pDisp Is WebBrowser1.Application) Then
    8.         Set HTML = WebBrowser1.Document
    9.         If URL = "http://babelfish.altavista.com/" Then
    10.             Dim S As HTMLSelectElement
    11.             For Each S In HTML.getElementsByTagName("select")
    12.                 S.Value = "en_fr"
    13.             Next
    14.             HTML.All.trtext.Value = "This is a test"
    15.             HTML.All.btnTrTxt.Click
    16.         Else
    17.             MsgBox HTML.All.q.Value
    18.         End If
    19.     End If
    20. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: Translation of text using VB6

    Thanks a lot, this is EXACTLY what I needed!

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Translation of text using VB6

    Great! had to take a "guess" at that one.. testing on one line seemed to work so u will need to loop it. but figured it would at least get u started

    could you mark the thread resolved? (thread tools > mark thread resolved)

    thanks!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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