Sim0n Posted April 29, 2008 Share Posted April 29, 2008 Hi, For my script I want to get some information from notepad, so first take sentence 1 to a string, then line 2 to a second string, then line 3 to the third string etc. Of course I could select the information I want, but how to get this into a string? (Sorry for asking this simple question, but I can't find the answer.) Link to comment Share on other sites More sharing options...
Dampe Posted April 29, 2008 Share Posted April 29, 2008 Look in the help file for FileRead and FileReadLine Link to comment Share on other sites More sharing options...
Sim0n Posted April 29, 2008 Author Share Posted April 29, 2008 Yes, I could use the Fileread(line) option for my problem, but this asks for the line etc, in my notepad not every parameter is on a new line, and not every line has the same number of characters. I could always select the text without problems, It's much easier for me if the selected text puts directly in a string. Isn't this possible? Link to comment Share on other sites More sharing options...
Sim0n Posted April 29, 2008 Author Share Posted April 29, 2008 I have seen AutoIt has much clipboard options, I hope it's possible with them. I will try this in about an hour. Link to comment Share on other sites More sharing options...
smashly Posted April 29, 2008 Share Posted April 29, 2008 You'd have to have some form of delimiter for a sentence. Period would be used for a sentence of normal text, but there's other characters that are used as well. So maybe StringSplit() the text file and loop the array for each line of text.#include <Array.au3> $textfile = @ScriptDir & "\textfile.txt" $FO = FileOpen($textfile, 0) $FR = FileRead($FO) FileClose($FO) $SS = StringSplit(StringTrimRight(StringReplace($FR, @CRLF, ""), 1), ".") _ArrayDisplay($SS, "Array Of Strings") the text I used.Here are some sentences in a text file. But not all the lines will be the same. Maybe that's because you can put more then 1 sentence on a line. Maybe the sentence could be wrapped to the next line as well as more then 1 sentence on a line. So you need a delimiter of some sort so you can destiguish where the sentence ends or the next starts. Cheers 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