Jump to content

autoit compare string use % or *


 Share

Recommended Posts

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
Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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