acoustic25 Posted January 25, 2015 Share Posted January 25, 2015 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 More sharing options...
jguinch Posted January 25, 2015 Share Posted January 25, 2015 What do you mean by "full page" ? Is it $content ? And what about $search ? Give more details Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
JohnOne Posted January 25, 2015 Share Posted January 25, 2015 You could use a stringsplit at whatever line separator character it uses. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted January 25, 2015 Share Posted January 25, 2015 (edited) ? Local $str For $i = 1 to 10 $str &= 'Line ' & $i & @CRLF Next ;Msgbox(0,"", $str) $lastline = StringRegExpReplace($str, '.*\R(?!\s*$)', "") Msgbox(0,"", $lastline) Edited January 25, 2015 by mikell Link to comment Share on other sites More sharing options...
UEZ Posted January 25, 2015 Share Posted January 25, 2015 (edited) CheckoutFileReadLineSorry, I didn't read your 1st post carefully.Br,UEZ Edited January 25, 2015 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 More sharing options...
TheSaint Posted January 25, 2015 Share Posted January 25, 2015 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) Link to comment Share on other sites More sharing options...
JohnOne Posted January 25, 2015 Share Posted January 25, 2015 Thing is though, you are going to need to write thee data to an actual file first. Looks like this is coming from a window control. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted January 25, 2015 Share Posted January 25, 2015 (edited) 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 January 25, 2015 by mikell Link to comment Share on other sites More sharing options...
JohnOne Posted January 25, 2015 Share Posted January 25, 2015 (edited) How do you access variable data with File* functions. EDIT: You use Ubound($array) -2 Edited January 25, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted January 25, 2015 Share Posted January 25, 2015 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 More sharing options...
jguinch Posted January 25, 2015 Share Posted January 25, 2015 It seems the best thing to do is to wait for information from the author, no ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
JohnOne Posted January 25, 2015 Share Posted January 25, 2015 RegEx definitely will work, but I'm just so lousy at it, I rarely suggest it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted January 25, 2015 Share Posted January 25, 2015 Too bad ! Link to comment Share on other sites More sharing options...
acoustic25 Posted January 25, 2015 Author Share Posted January 25, 2015 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 More sharing options...
mikell Posted January 26, 2015 Share Posted January 26, 2015 (edited) It seems the best thing to do is to wait for information from the author, no ? It was, definitely Edited January 26, 2015 by mikell Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 26, 2015 Moderators Share Posted January 26, 2015 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 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