eKolin

Detect text (pretty simple imo)

11 posts in this topic

Basicly what i want to do is to detect certain words with numbers (case sensitive).

John has won GUI45n with a score of 5!

It would search for exact "John has won". Bolded text is what i need. It would have to send the bolded text to the active window. (p.s. the text wouldn't be bolded.)

Any suggestions how the code should look like? Thanks in advance ;)

Share this post


Link to post
Share on other sites



?

$str = "some text" &@crlf& "John has won GUI45n with a score of 5!" &@crlf& "some other text"
Msgbox(0,"", $str)

$key = "John has won"
$res = StringRegExpReplace($str, '(?s).*' & $key & '\h*(\w+).*', "$1")
Msgbox(0,"", $res)

 

Share this post


Link to post
Share on other sites

Look in the help file.   StringRegExp

This code pulls the whole line that begins with either a 1 or 2.   Little mod and you should be able to get what you are looking for

$sFile = FileRead("Path to your file")
Local $aResults[0]

$aResults = StringRegExp($sFile, "(?m)^[12].*", 3)

_ArrayDisplay($aResult)

Best I can do for you. But should get you on the right track.  

Share this post


Link to post
Share on other sites

@mikell @xcaliber13 Thanks for the replies, gonna try to understand everything that u've wrote there with #Help option in editor ;) (The text would be in an image, would it affect the code?)

Share this post


Link to post
Share on other sites
9 minutes ago, eKolin said:

 (The text would be in an image, would it affect the code?)

Yes, it would. Why don't you post a screenshot of the image with the text so we can see what we are dealing with?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

@JLogan3o13 Ok. The font size and colour would be exact as shown in the image.
V911EGT.png
It would search for that text in certain coordinates, let's pretend it's (100,200,200,300).
Like i said in my upper post, it's case sensitive, can contain numbers, letters, signs ":" and "/".
It would have to check the area every 10ms, if true then "send(Found)" AND repeat the loop after 1 minute (after sending the "found")

It sounds a bit more complex than i thought xD Thanks in advance ;)

Share this post


Link to post
Share on other sites

Doubleposting since i didin't find a way to edit my post.

What i need is to find a certain "word" that's always random.

John has won GUI45n with a score of 5!

 

"John has won" and "with a score of 5!" Will always be the same, while GUI45n can be anything that's made of 6 letters. I need to respond it with send(/GUI45n), yes i additionaly need the slash. Hope that you guys will understand me despite how bad my grammar nd stuff is. I would be really greatful if someone would write this code for me:)

Share this post


Link to post
Share on other sites

eKolin,

Quote

John has won GUI45n with a score of 5!

That sounds very much like a game - have you read the Forum rules? What is this app that you are attempting to automate?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@Skysnake you have been around long enough to know that when a Moderator weighs in with a question as to the legitimacy of a thread, that is not the time for you to continue posting. Wait until that question is answered by the OP.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Noted. Sorry.


Skysnake

Why is the snake in the sky?

Share this post


Link to post
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