haXor4life Posted January 22, 2009 Share Posted January 22, 2009 (edited) Please help me. I want to send 2 lines from a text file. And I want it to be repeated after pause but then it should be another two lines etc. Please help. Or can you help in sending ANY AMOUNT OF INFOMATION from text file that goes beetwen certain symbols? Edited January 22, 2009 by haXor4life Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 (edited) Check out FileReadLine Send Loops Sleep Cheers, Brett Edited January 22, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 BrettF, I added to my wish, can you help? Link to comment Share on other sites More sharing options...
AzKay Posted January 22, 2009 Share Posted January 22, 2009 $Text = FileRead("somefile.txt") $Text = __StringBetween($Text, "PointA", "PointB") MsgBox(0, "", $Text) Func __StringBetween($s, $from, $to) $x = StringInStr($s, $from) + StringLen($from) $y = StringInStr(StringTrimLeft($s, $x), $to) Return StringMid($s, $x, $y) EndFunc # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 I have helped. You will need to produce some attempt before I even look at opening SciTE. Not many here will do it for you. I for one prefer others that I help learn, from their mistakes, from what we tell them etc, and it improves their coding skills. No giving without receiving first Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 Thank you for this example AzKay.BrettF, I can make mouseclicks and sends but other things are hard.There is a problem. I made this filePointA1PointBPointA2PointBPointA3PointBPointA4PointBbut code send only '1'.How can I send leftover text? Link to comment Share on other sites More sharing options...
AzKay Posted January 22, 2009 Share Posted January 22, 2009 __StringBetween will only return the first found; Try _StringBetween instead. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 __StringBetween will only return the first found;Try _StringBetween instead.It did the same thing. Link to comment Share on other sites More sharing options...
AzKay Posted January 22, 2009 Share Posted January 22, 2009 Shouldnt. As _StringBetween returns an array. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 Shouldnt. As _StringBetween returns an array.So I wrote new code and it returned only '1'. Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 #include <file.au3> Dim $aRecords If Not _FileReadToArray("file.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Step 2 Send ($aRecords[$x]) Send ($aRecords[$x + 1]) Sleep (2000) Next Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
AzKay Posted January 22, 2009 Share Posted January 22, 2009 Also; Where is the "new code". Hard to see what to fix; when theres no code to fix. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 #include <file.au3> Dim $aRecords If Not _FileReadToArray("file.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Step 2 Send ($aRecords[$x]) Send ($aRecords[$x + 1]) Sleep (2000) NextThank you, I have two questions. I need 2 mouseclicks then sending a text and then 2 more mouseclicks, then pause. New cycle should be with same mouseclicks but sending new part of text. Why is my code don't work correctly. MouseClick("left", 111, 222, 1) MouseClick("left", 333, 444, 1) #include <file.au3> Dim $aRecords If Not _FileReadToArray("file.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Step 2 Send ($aRecords[$x]) Send ($aRecords[$x + 1]) MouseClick("left", 234, 345, 1) MouseClick("left", 456, 567, 1) Sleep (2000) NextThis code repeat final MCs forever. Second question: how does this code know what to send? And how to tell it send for example 3 lines, then 2, then 5 etc? Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 Also; Where is the "new code". Hard to see what to fix; when theres no code to fix.Sorry, I just replaced '__StringBetween' with '_StringBetween'. Link to comment Share on other sites More sharing options...
AzKay Posted January 22, 2009 Share Posted January 22, 2009 Sorry, I just replaced '__StringBetween' with '_StringBetween'.Might want to look at _StringBetween() in the helpfile. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 1) Look where the first mouse clicks are, and where the second set is. See a problem with repeating them? 2) The function _FileReadToArray outputs an array, where the array index[0] is the total, and using a for loop, we loop through every 2 lines (step 2) and send the text ($i, $i +1) contained in the array. Process increments $i, different part of the array. Cheers Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 1) Look where the first mouse clicks are, and where the second set is. See a problem with repeating them?No. I tried various variations of placing those MCs. Didn't help. 2) The function _FileReadToArray outputs an array, where the array index[0] is the total, and using a for loop, we loop through every 2 lines (step 2) and send the text ($i, $i +1) contained in the array. Process increments $i, different part of the array. Cheers BrettDo you mean if insert some $i="PointA" and then in text file it will send between those "PointA"? Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 1) It can't repeat if its not in a loop. Now go figure. 2) Lets output the array: $aRecords[0] = 12 $aRecords[1] = PointA $aRecords[2] = 1 $aRecords[3] = PointB $aRecords[4] = PointA $aRecords[5] = 2 $aRecords[6] = PointB $aRecords[7] = PointA $aRecords[8] = 3 $aRecords[9] = PointB $aRecords[10] = PointA $aRecords[11] = 4 $aRecords[12] = PointB Now lets switch to the For Loop line: For $x = 1 To $aRecords[0] Step 2 In english it is a loop, where $x will increment by the step. So in this case, every time the loop reaches "Next", it will increment the loop by 2. Then it tests if $x is greater than $aRecords[0], if it is, it continues the script. If we outputed $x once every iteration loop it would look like so: 1 3 5 7 9 11 Each part of the array is accessed by an index (the bits in the []). Try reading the script again with that knowledge and see if it makes more sense. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
haXor4life Posted January 22, 2009 Author Share Posted January 22, 2009 1) It can't repeat if its not in a loop. Now go figure.Thank you. 2) Lets output the array: $aRecords[0] = 12 $aRecords[1] = PointA $aRecords[2] = 1 $aRecords[3] = PointB $aRecords[4] = PointA $aRecords[5] = 2 $aRecords[6] = PointB $aRecords[7] = PointA $aRecords[8] = 3 $aRecords[9] = PointB $aRecords[10] = PointA $aRecords[11] = 4 $aRecords[12] = PointB Now lets switch to the For Loop line: For $x = 1 To $aRecords[0] Step 2 In english it is a loop, where $x will increment by the step. So in this case, every time the loop reaches "Next", it will increment the loop by 2. Then it tests if $x is greater than $aRecords[0], if it is, it continues the script. If we outputed $x once every iteration loop it would look like so: 1 3 5 7 9 11 Each part of the array is accessed by an index (the bits in the []). Try reading the script again with that knowledge and see if it makes more sense.Thank you. So I can't make some marks in text and then send text which is between marks? Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2009 Share Posted January 22, 2009 _StringBetween() Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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