Sign in to follow this  
Followers 0
stilllearning

paste into an input box

9 posts in this topic

#1 ·  Posted (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 by stilllearning

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 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]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$Hwnd = FileOpen(@MyDocumentsDir&"\test.txt", 0)
$Read = FileRead($Hwnd)
FileClose($Hwnd)
InputBox("Question", "Work", $Read, "", -1, -1, 0, 0)

:P

Edited by TehWhale

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 :P

Edited by DexterMorgan

code

Share this post


Link to post
Share on other sites

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 :P

Don't you have to open the file first to read it?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Don't you have to open the file first to read it?

no

edit: 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 :P Edited by DexterMorgan

code

Share this post


Link to post
Share on other sites

no

edit: from teh help file :( But i dont think there is much text , if its going in a inputbox :P

Haha I didn't know that :idea:

Share this post


Link to post
Share on other sites

Thanks - sorted it, used TehWhales solution

Share this post


Link to post
Share on other sites

@Tehwhale : You learn something new everyday :P

Thanks - sorted it, used TehWhales solution

Still think my solution was best :(


code

Share this post


Link to post
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
Sign in to follow this  
Followers 0