stilllearning Posted October 19, 2008 Posted October 19, 2008 (edited) I am very new to AutoIt so please be patient. I want to capture data from a terminal emulator as a text file then open the text file and paste it into an input box. It won't paste into the input box - but does if I manually press CTL V so it does copy Here is the code snippet ShellExecute(@MyDocumentsDir & "\test.txt") Sleep(2000) Send("{DOWN}{DOWN}{DOWN}{DOWN}") Send("{LSHIFT}+{RIGHT}") Send("{LSHIFT}+{RIGHT}") Send("{LSHIFT}+{RIGHT}") Send("{CTRLDOWN}+C") Send("{CTRLUP}") ProcessClose("notepad.exe") InputBox("Question", "Work", "", "", -1, -1, 0, 0) Sleep(5000) Send("{CTRLDOWN}+v") Send("{CTRLUP}") Edited October 19, 2008 by stilllearning
komalo Posted October 19, 2008 Posted October 19, 2008 (edited) try this , it reads test.txt and show inputbox with that text$Text = FileRead(@MyDocumentsDir & "\test.txt")InputBox("Question", "Work", $Text, "", -1, -1, 0, 0) Edited October 19, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]
TehWhale Posted October 19, 2008 Posted October 19, 2008 (edited) $Hwnd = FileOpen(@MyDocumentsDir&"\test.txt", 0) $Read = FileRead($Hwnd) FileClose($Hwnd) InputBox("Question", "Work", $Read, "", -1, -1, 0, 0) Edited October 19, 2008 by TehWhale
DexterMorgan Posted October 19, 2008 Posted October 19, 2008 (edited) wouldnt this work $x = fileread('test.txt') inputbox("TEst","Test",$x) unless you mean something else... EDIT: My example is the best dont look at anyone else's Edited October 19, 2008 by DexterMorgan code
TehWhale Posted October 19, 2008 Posted October 19, 2008 wouldnt this work $x = fileread('test.txt') inputbox("TEst","Test",$x) unless you mean something else... EDIT: My example is the best dont look at anyone else's Don't you have to open the file first to read it?
DexterMorgan Posted October 19, 2008 Posted October 19, 2008 (edited) Don't you have to open the file first to read it?noedit: from teh help file If a filename is given rather than a file handle - the file will be opened and closed during the function call - for parsing large text files this will be much slower than using filehandles But i dont think there is much text , if its going in a inputbox Edited October 19, 2008 by DexterMorgan code
TehWhale Posted October 19, 2008 Posted October 19, 2008 noedit: from teh help file But i dont think there is much text , if its going in a inputbox Haha I didn't know that
stilllearning Posted October 19, 2008 Author Posted October 19, 2008 Thanks - sorted it, used TehWhales solution
DexterMorgan Posted October 19, 2008 Posted October 19, 2008 @Tehwhale : You learn something new everyday Thanks - sorted it, used TehWhales solutionStill think my solution was best code
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