Jump to content

read last line


Recommended Posts

Newbie here!!

The control box is a newsfeed so i'ts updating everytime. What I want this script to do is just read the last line instead of the full page.

 

 

global $content, $find, $search
$search = "Pause"
$content = controlGetText("[CLASS:#32770]", "??", 1008)
msgbox(0,0,$content)
$find = StringRegExp($content, $search)
if $find = 1 then

MsgBox(0, 0, "check")
else
    msgbox(0,0,"none")
EndIf
 

 

Link to comment
Share on other sites

Checkout

FileReadLine

Sorry, I didn't read your 1st post carefully.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

You can also use _FileCountLines to get the last line number.

But as JohnOne says, you may need to use StringSplit to get lines returned.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Thing is though, you are going to need to write thee data to an actual file first.

 

Why ?

$content looks like a ready-to-use multiline text retrieved using a ControlGetText(). Did you try the regex ?

Edited by mikell
Link to comment
Share on other sites

JO,

Sorry I edited my previous comment about StringSplit

As we can't know if the text ends with a crlf or not, the only (maybe) reliable way using StringSplit is this

$s = StringSplit($str, @crlf, 1)
For $i = $s[0] to 1 step -1
  If $s[$i] <> "" Then Exitloop
Next
$lastline = $s[$i]
Msgbox(0,"", $lastline)

But if the text is in a variable, File* funcs are useless and a regex like the one in post #4 works well

Link to comment
Share on other sites

thanks for the help guys but the script i wrote on post 1 actually works.. 

What didn't work was the macro "Run(@ProgramFilesDir & "folderproggy.exe")". It's not on my post but it's part of the whole script.

The script actually works on scite editor but when I compiled it to 64bit, it wont run. I tried the compiled 32bit on vmware and it seems to be ok.

So I replaced the @ProgramFilesDir  with the actual directory and eveything is good.

by the way i'm running on win7 64 bit and win7 32 bit on vmware.. 

 
Link to comment
Share on other sites

  • Moderators

 

thanks for the help guys but the script i wrote on post 1 actually works.. 

What didn't work was the macro "Run(@ProgramFilesDir & "folderproggy.exe")". It's not on my post but it's part of the whole script.

The script actually works on scite editor but when I compiled it to 64bit, it wont run. I tried the compiled 32bit on vmware and it seems to be ok.

So I replaced the @ProgramFilesDir  with the actual directory and eveything is good.

by the way i'm running on win7 64 bit and win7 32 bit on vmware.. 

 

 

There's a 32 bit @ProgramFilesDir: "Program Files (x86)"

And a 64 bit @ProgramFilesDir: "Program Files"

Plus you have to escape the spaces: Run('"' & @ProgramFilesDir & ' folderproggy.exe"').

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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