copy text from hello.txt to a text-box in an URL and auto click on a button on the URL

Dear sir and mdm,

I am currently doing a school prj involved visual basic 6.0 which I get stuck in midway and I had tried for the past few wks searching for books and website for ideas or solution. Hope u all can help me.

I have this hello.txt file in which there is some English sentences. I want to copy these sentence to an URL www.freetranslation.com where there is a textbox on the URL for people to key in English text and click on the translation button in the URL.

I have managed to open the website using

Private Sub text_translation_Click()

Dim R As Long

R = ShellExecute(0, "open", "www.freetranslation.com", 0, 0, 1)

End Sub

Problem
(1) I could not do a copy and paste function from hello.txt to the textbox in the URL

(2) I could not perform auto click function on the translation button in the URL after text is entered.

I have only visual basic 6.0 and visual C++ but the build-on is on visual basic platform and no java

Thanks a lot…

yinmuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
You can try open the targeted post page with the parameters required.

Example:

mytext = "Hello World"
mypara = "?language=English/Spanish&srctext=" & mytext & "&sequence=core&mode=html&template=results_en-us.htm"

then

Dim R As Long

R = ShellExecute(0, "open", "www.freetranslation.com" & mypara, 0, 0, 1)
0
Ryan ChongCommented:
oops, try this instead:

R = ShellExecute(0, "open", "http://ets.freetranslation.com/" & mypara, 0, 0, 1)
0
aelatikCommented:
You can do this by browsing to the website > filling info and clicking buttons :


Private Sub Form_Load()

'Open the file containing the sentences and store it in a variable called MySentences
    Dim MySentences As String
    Dim MyLine As Variant
        MySentences = ""
    Open "c:\yourtextfile.txt" For Input As #1
        While Not EOF(1)
            Line Input #1, MyLine
                MySentences = MySentences & MyLine & vbCrLf
        Wend
    Close #1

'Create an internet explorer session
    Dim IE As Object
    Dim DOC, ITEM As Variant
    Set IE = CreateObject("internetexplorer.application")
'navigate to the website
        IE.navigate "http://www.freetranslation.com"
'Show the browser or hide it by settings it to false
        IE.Visible = True
    While IE.busy: DoEvents: Wend
'Wait till the page loads
        Set DOC = IE.Document
            Do Until DOC.readyState = "complete": DoEvents: Loop
'Wait till the document is complete
            For Each ITEM In DOC.All.tags("textarea")
'srctext = Name of the textarea in HTML
                If ITEM.Name = "srctext" Then ITEM.Value = MySentences
            Next
            For Each ITEM In DOC.All.tags("input")
'Humantranslation = Name of the button in HTML
                If ITEM.Name = "HumanTranslation" Then ITEM.Click
            Next
    Set IE = Nothing
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Richie_SimonettiIT OperationsCommented:
hearing...
0
EDDYKTCommented:
Did I read something before because of security reason, You can not set the textbox value from outside?

May be I'm wrong
0
Richie_SimonettiIT OperationsCommented:
Optionally, you could see this, it is an autologin to Hotmail but the approach is exactly the same:
http://www.angelfire.com/realm/vb-shared/IEDOM_Tip06.htm
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.