Jump to content

Read and paste a text from file.


 Share

Recommended Posts

Hi pretty new to thsi autoit, i havent been working with it since V2, and my memory is pretty bad. So now im about to start with it again.

So here is my question how do i, copy a part of a text from a file without opening the file. And paste in the window that is active at the time.

Whould it be more easy to copy a section from a ini file ?

I hope some of you could help me on this, a little example code.

Best regards ME.

Link to comment
Share on other sites

Look in the help file for 'FileRead' and get back here if you need more help (kinda busy, but if you need it I don't mind :lmao:)

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Look in the help file for 'FileRead' and get back here if you need more help (kinda busy, but if you need it I don't mind :lmao:)

<{POST_SNAPBACK}>

Weel i got so far that i can make it write the txt into the aplication.

But it makes a extra line break (On line break + the line thats allready is i the file)

so far my codes looks like this

HotKeySet("^!x", "Exit")
HotKeySet("{PAUSE}", "Insert")
$file = FileOpen("Text.txt", 0)


Func MyExit()
    Exit 
EndFunc 


If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf


Func insert()
While 1
    $Text = FileRead($file, 1)
    If @error = -1 Then ExitLoop
    send ($Text)
Wend
fileclose ($file)
EndFunc
Link to comment
Share on other sites

Hi,

Try this ?

HotKeySet("^!x", "Exit")
HotKeySet("{PAUSE}", "Insert")
$file = FileOpen("Text.txt", 0)


Func MyExit()
    Exit
EndFunc


If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf


Func insert()
While 1
    $Text = FileRead($file, 1)
    If @error = -1 Then ExitLoop
    send (StringStripCR($Text))
Wend
fileclose ($file)
EndFunc

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
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...