Jump to content
Sign in to follow this  
jiglei

WinGetText Feature and further

Recommended Posts

jiglei

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jiglei

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.

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jiglei

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.

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.