augustspies Posted March 23, 2011 Share Posted March 23, 2011 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 More sharing options...
Andreik Posted March 23, 2011 Share Posted March 23, 2011 (edited) Assuming that you have a document with 3 lines, something like: This is text 1 This is text 2 This is text 3you 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 March 23, 2011 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
augustspies Posted March 24, 2011 Author Share Posted March 24, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now