Jump to content

Copy line from txt file and paste into browser


Recommended Posts

Hey forum,

I was wondering if I could get your input on if it's possible to copy a line of text from a txt file and then paste it into a certain x/y coordinate in the browser (basically a box)

I know to use filereadline, then clipput to copy it to the clipboard. however how would you set it up - as an example there are 3 lines of txt and you want to paste it into 3 different boxes in your browser given the x/y coordinates?

Thank you in adv for you help.

Link to comment
Share on other sites

Assuming that you have a document with 3 lines, something like:

This is text 1

This is text 2

This is text 3

you can do something like that:

AutoItSetOption("MouseCoordMode",0)

Dim $TEXT[3]
$FILE = FileOpen("my_file.txt",0)
For $INDEX = 1 To 3
    $TEXT[$INDEX-1] = FileReadLine($FILE,$INDEX)
Next
FileClose($FILE)

$MAIN = GUICreate("Example")
$INPUT1 = GUICtrlCreateInput("",15,27,100,20)
$INPUT2 = GUICtrlCreateInput("",84,111,150,20)
$INPUT3 = GUICtrlCreateInput("",245,79,125,20)
GUISetState(@SW_SHOW,$MAIN)

SendText($TEXT[0],26,66)
Sleep(1500)
SendText($TEXT[1],95,150)
Sleep(1500)
SendText($TEXT[2],255,120)

While True
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
    Sleep(10)
WEnd

Func SendText($TEXT,$X,$Y)
    MouseClick("left",$X,$Y)
    Send($TEXT)
EndFunc

EDIT: example more suggestive

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Assuming that you have a document with 3 lines, something like:

you can do something like that:

AutoItSetOption("MouseCoordMode",0)

Dim $TEXT[3]
$FILE = FileOpen("my_file.txt",0)
For $INDEX = 1 To 3
    $TEXT[$INDEX-1] = FileReadLine($FILE,$INDEX)
Next
FileClose($FILE)

$MAIN = GUICreate("Example")
$INPUT1 = GUICtrlCreateInput("",15,27,100,20)
$INPUT2 = GUICtrlCreateInput("",84,111,150,20)
$INPUT3 = GUICtrlCreateInput("",245,79,125,20)
GUISetState(@SW_SHOW,$MAIN)

SendText($TEXT[0],26,66)
Sleep(1500)
SendText($TEXT[1],95,150)
Sleep(1500)
SendText($TEXT[2],255,120)

While True
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
    Sleep(10)
WEnd

Func SendText($TEXT,$X,$Y)
    MouseClick("left",$X,$Y)
    Send($TEXT)
EndFunc

EDIT: example more suggestive

awesome Andreik thank you very much for your time w/ putting this example together. This right here without the gui was exactly what i was trying to figure out :)

Dim $TEXT[3]

$FILE = FileOpen("my_file.txt",0)

For $INDEX = 1 To 3

$TEXT[$INDEX-1] = FileReadLine($FILE,$INDEX)

Next

FileClose($FILE)

SendText($TEXT[0],26,66)

Sleep(1500)

SendText($TEXT[1],95,150)

Sleep(1500)

SendText($TEXT[2],255,120)

Func SendText($TEXT,$X,$Y)

MouseClick("left",$X,$Y)

Send($TEXT)

EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...