Jump to content
Sign in to follow this  
icene

autoit compare string use % or *

Recommended Posts

icene

Hi

Could autoit use like * or % to compare string

if "abcde" = "*bc*" then

return true

I know there is stringcompare function,

but have the other sulotion for this?

Thanks

Edited by icene

Share this post


Link to post
Share on other sites
Authenticity

Look at StringInStr or StringRegExp if you need it to be more specific.

Share this post


Link to post
Share on other sites
icene

Look at StringInStr or StringRegExp if you need it to be more specific.

hi

if i have two windows with the same title but different text.

i want to choose the correct one.

use ControlSetText ( "title", "text","controlID")

but i only know the part of text , like "xxxx this is xxxxx"

could i type ControlSetText ( "hello", "*this is*","edit1") ?

ps: the two windows have the same title and controlID only texts are difference .

Share this post


Link to post
Share on other sites
Authenticity

Well, there is REGEXPTITLE and REGEXPCLASS (Advanced Window Descriptions) but there is not REGEXPTEXT so I guess you'll need to use WinList('TheWindowTitle') and use WinGetText like:

Dim $avWindows = WinList('TheWindowTitle')

For $i = 1 To $avWindows[0][0]
    If StringInStr(WinGetText($avWindows[$i][1]), 'Sometext') Then
    ; Or If StringRegExp(WinGetText($avWindows[$i][1]), '.*?Text') Then...
    ; ...
    EndIf
Next

Share this post


Link to post
Share on other sites
icene

Well, there is REGEXPTITLE and REGEXPCLASS (Advanced Window Descriptions) but there is not REGEXPTEXT so I guess you'll need to use WinList('TheWindowTitle') and use WinGetText like:

Dim $avWindows = WinList('TheWindowTitle')

For $i = 1 To $avWindows[0][0]
    If StringInStr(WinGetText($avWindows[$i][1]), 'Sometext') Then
    ; Or If StringRegExp(WinGetText($avWindows[$i][1]), '.*?Text') Then...
    ; ...
    EndIf
Next
Thanks for your reply :D

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.