anixon Posted August 31, 2008 Share Posted August 31, 2008 The name to match is always going to be unique it can be all alpha, alpha numeric or numeric. This code works fine: $sNameToMatch = "smith" $pNameToMatch = "jones smith brown green white black" $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) Where the variable you want to match is a numeric [like a phone number] it does not work $sNameToMatch = "61390902657" $pNameToMatch = "jones smith brown 61390902657 white black" $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) Is this a simple case of converting the number to text [for example - a61390902657] or is it achieved in some other way? Help is always appreciated.. Ant.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 31, 2008 Share Posted August 31, 2008 What do you mean it doesn't work? That should work just fine. Are you sure the numeric formatting is the same? Link to comment Share on other sites More sharing options...
picaxe Posted August 31, 2008 Share Posted August 31, 2008 I think you have strings wrong way arround. Try $NameMatched = StringInStr($pNametoMatch, $sNameToMatch) Link to comment Share on other sites More sharing options...
anixon Posted August 31, 2008 Author Share Posted August 31, 2008 Sorry I got it the wrong way round with the variables $pNameToMatch [Process name to match] = 'smith' $sNameToMatch [string containing name to match] "jones smith brown green white black" In which case this code is correct $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) Result should be 7 Are you saying that $pNameToMatch [Process name to match] = '123456' $sNameToMatch [string containing name to match] "jones 123456 brown green white black" $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) will produce the the same result 7? Ant.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 31, 2008 Moderators Share Posted August 31, 2008 Sorry I got it the wrong way round with the variables $pNameToMatch [Process name to match] = 'smith' $sNameToMatch [string containing name to match] "jones smith brown green white black" In which case this code is correct $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) Result should be 7 Are you saying that $pNameToMatch [Process name to match] = '123456' $sNameToMatch [string containing name to match] "jones 123456 brown green white black" $NameMatched = StringInStr($sNametoMatch, $pNameToMatch) will produce the the same result 7? Ant.. Well... yes it does ... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now