Jump to content

Send 2 lines from text file


Recommended Posts

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

FYI, in the examples the marks are [ and ] and the numbers are the strings inside. It should give you enough knowledge to have a go, and produce some sort of result. Now try, and don't post until you've got something happening (post your code).

*Bang*

Edited by BrettF
Link to comment
Share on other sites

#include <String.au3>
#include <array.au3>
$aArray1 = _StringBetween('[18][20][3][5][500][60]', '[', ']')
_ArrayDisplay($aArray1, 'Default Search')

There is an example. You are hardly trying.

"PLS HALP, IT USES NUMBERS!1111", Did you try, CHANGING IT TO YOUR NEEDS?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Here's a tested bit of code:

$file=fileopen("c:\file.txt",4)

for $i=1 to 500 step +2

MsgBox(4096,"",filereadline("c:\file.txt",$i)& @crlf& FileReadLine("c:\file.txt",($i+1)))

if filereadline("c:\file.txt",$i)="" or filereadline("c:\file.txt",($i+1))="" Then ExitLoop

Sleep(3000)

Next

Sleep gives it A DELAY..

File.txt is the text file to read from.

Njoi

Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Here's a tested bit of code:

$file=fileopen("c:\file.txt",4)

for $i=1 to 500 step +2

MsgBox(4096,"",filereadline("c:\file.txt",$i)& @crlf& FileReadLine("c:\file.txt",($i+1)))

if filereadline("c:\file.txt",$i)="" or filereadline("c:\file.txt",($i+1))="" Then ExitLoop

Sleep(3000)

Next

Sleep gives it A DELAY..

File.txt is the text file to read from.

Njoi

Thank you very much.

If anybody willing to help with 'Marks/Send what in beetwen' it would be cool.

Link to comment
Share on other sites

No you didn't post it. You posted the syntax. Now, you try. That is all I'm going to say for the rest of this thread until I see effort FROM YOU. Because quite frankly, I haven't seen enough effort from you, so now its time to see some. So go have a go. I can never see why everyone finds it so hard to experiment, to try stuff. Its what I did. How I learnt AutoIt. What makes it so hard to play with the code? Most of the time you get something that works, and if it doesn't you can look at it. Try understand what exactly is happening... Try work out where you're going wrong.

Just try...

Brett

Link to comment
Share on other sites

No you didn't post it. You posted the syntax. Now, you try. That is all I'm going to say for the rest of this thread until I see effort FROM YOU. Because quite frankly, I haven't seen enough effort from you, so now its time to see some. So go have a go. I can never see why everyone finds it so hard to experiment, to try stuff. Its what I did. How I learnt AutoIt. What makes it so hard to play with the code? Most of the time you get something that works, and if it doesn't you can look at it. Try understand what exactly is happening... Try work out where you're going wrong.

Just try...

Brett

Are you troll? Not everybody is into coding. I make efforts. I can send you some scripts that I made, they are VERY simple but I tried hard. This field is beyond my understanding. Examples help little.
Link to comment
Share on other sites

Last time I checked I didn't look like a troll. And no, I'm not.

I'm just fed up with the constant waves of users who put minimal effort and expect great results, or the people who just want someone else to write their script for them. This will somehow teach them? Why are you asking for support if you want someone to write it for you? There is RentACoder.com for script requests.

If your not into Coding, then why are you doing it?

I don't need to see other scripts, I need to see code that relates to this topic! To me code speaks a gazillion languages. It lets us know where you are at, whats happening, what you're trying to do, where you're going wrong. That's the main reason we ask for it, along with it takes time to work up examples, where with your code we change a few lines or something, and then there is an answer. Simple ain't it?

Since you are new I recommend you looking into my tutorial and AutoIt 1-2-3. They will teach you the basics of AutoIt, and I believe it will help you understand how to go about tackling different challenges and give you a more solid understanding of AutoIt.

Brett

Link to comment
Share on other sites

Its pretty simple really "haXor4life"...

If you want to learn how to do something in AutoIt, there are people here that are willing to help you "IF" you are willing to put some effort into it yourself.

If you want someone to write it for you for free... well, good luck with that. Most people here won't do it for you.

If you do want to learn something about how to do things with AutoIt, then I suggest you do what Brett suggested and read through the tutorial in his signature block. It only takes a little while to read, and it will give you a good basis to work from.

-Spook

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Yeah I read helpfiles and did very simple scripts myself. Now I need help and I hope there are people who are willing to help.

I think you are missing my point.

The help file is one hell of a resource once you understand some basic things about how autoit works, but it doesn't do a very good job of explaining those basics. It kind of expects you to have some general coding/scripting knowledge first. The tutorial in Brett's signature is a good way of bridging the gaps that the help file can leave, which is where you are at.

Good Luck

-Spook

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

$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

This code is good but it returns only first part of text.

Link to comment
Share on other sites

Post some solid code that youve done, and explain exactly what you need help doing.

I need this code to send text between marks. Now it sends two strings:

#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

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...