Jump to content

Recommended Posts

Posted

G'day,

Is it possible to extract numbers from two strings (e.g. from window titles) and then compare those two numbers to find which is bigger? Something like this:

$Title1 = $WinList[1][0]
$Title2 = $WinList[2][0]

$Number1 = Some operation to extract the number from $Title1 and make it a usable integer
$Number2 = Some operation to extract the number from $Title2 and make it a usable integer

If $Number1 < $Number2 Then
; Do something
    
ElseIf $Number1 > $Number2 Then
       ; Do something else

EndIf

Any help would be greatly appreciated.

Until anon,

Sean

Posted

how are these string formatted, if you could paste some sample string here it'd be easier to help find a solution

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Posted

G'day Don,

how are these string formatted, if you could paste some sample string here it'd be easier to help find a solution

There are 24 possible window titles all in this format: "suny1", "suny2", "suny3" ... "suny24".

Until anon,

Sean

Posted

$str1 = "suny12"
$str2 = "suny20"

$int1 = StringTrimLeft( $str1, 4 )
$int2 = StringTrimLeft( $str2, 4 )

;compare the ints and do whatever else here

StringTrimLeft(), as i used it here, wioll remove the 4 leftmost characters from the string leaving only the integer part remaingin. Check out the helpfile in StringTrimLeft adn StringTrimRight for more details.

hope this helps

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Posted

quick and dirty but it extracts 25 from Un25titled

$Num=""

$winTitle="Un25titled"

For $i = 1 to StringLen($winTitle)

$char=StringMid($winTitle,$i,1)

if ASC($char) < 58 then $Num=$Num & $char

Next

msgbox(0,"",$Num)

Rauto

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...