[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
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:
Private Sub Form_Load()
WebBrowser1.Navigate "http://babelfish.altavista.com/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim HTML As HTMLDocument
If (pDisp Is WebBrowser1.Application) Then
Set HTML = WebBrowser1.Document
If URL = "http://babelfish.altavista.com/" Then
Dim S As HTMLSelectElement
For Each S In HTML.getElementsByTagName("select")
S.Value = "en_fr"
Next
HTML.All.trtext.Value = "This is a test"
HTML.All.btnTrTxt.Click
Else
MsgBox HTML.All.q.Value
End If
End If
End Sub
Re: Translation of text using VB6
Thanks a lot, this is EXACTLY what I needed!
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!