Jump to content

WinGetText Feature and further


Recommended Posts

Hi there, I'm having a problem to know what I should do, this is how far I could go with my script

autoitsetoption("WinTextMatchMode",2)
$var2=controlgettext("title", "text",596)
IF $Var2="The Text I want" Then "Do what I want"

What I pretend is that Auto IT does a certain action if a certain text is found in a certain window. I've looked up everywhere but it seems that this isn't a usualy wanted action, so it's hard to find. So I though I could ask help to those who are more expert in this than me :D (I'm a begginer at this :D )

Thanks in advance.

EDIT: I posted a wrong Title to this topic :S

Edited by jiglei
Link to comment
Share on other sites

Hi there, I'm having a problem to know what I should do, this is how far I could go with my script

autoitsetoption("WinTextMatchMode",2)
$var2=controlgettext("title", "text",596)
IF $Var2="The Text I want" Then "Do what I want"

What I pretend is that Auto IT does a certain action if a certain text is found in a certain window. I've looked up everywhere but it seems that this isn't a usualy wanted action, so it's hard to find. So I though I could ask help to those who are more expert in this than me :D (I'm a begginer at this ;) )

Thanks in advance.

EDIT: I posted a wrong Title to this topic :S

So, how does that not work for you?

You could simplify and it a little:

Opt("WinTextMatchMode",2)
If ControlGetText("title", "text", 596) = "The Text I want" Then 
    ; Do what I want
    ; Put code here
EndIf

But that's just style; it could work the way you had it.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

What I mean is that the text that the auto IT finds is too big (like 1000 lines)

And I just want it to do something if it finds in those 1000 lines a certain sentence (like 5 words)

But it will only do something i want if all the text is found, but thats not what I want.

Hope you understood me fine now.

Link to comment
Share on other sites

What I mean is that the text that the auto IT finds is too big (like 1000 lines)

And I just want it to do something if it finds in those 1000 lines a certain sentence (like 5 words)

But it will only do something i want if all the text is found, but thats not what I want.

Hope you understood me fine now.

That's pretty trivial to not find it in the help file:
Opt("WinTextMatchMode",2)
$sText = ControlGetText("title", "text", 596)
If StringInStr($sText, "The Text I want") Then
   ; Do what I want
   ; Put code here
EndIf

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 weeks later...

That's pretty trivial to not find it in the help file:

Opt("WinTextMatchMode",2)
$sText = ControlGetText("title", "text", 596)
If StringInStr($sText, "The Text I want") Then
  ; Do what I want
  ; Put code here
EndIf

:)

Thanks a lot, it really helped, the delay in reply was because I was on vacations :)

Now that I'm back I can finish my program ;)

Thanks once more.

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