joeyg37

Greater than less than msgbox

5 posts in this topic

#1 ·  Posted (edited)

There is no good way to explain what im doing in the title

what im trying to do is make a script for temp control of my GPU by looking into another window. i think i know what the problem is but i don't know how to fix it

what i think is wrong is the C but i dont know how to Fix it

Example()

Func Example()

WinActivate ( "TechPowerUp" )
sleep (2000)
$sText = ControlGetText ( "TechPowerUp", "", 65535 )
if "$sText" > 20 Then
  MsgBox(0, "Tutorial", "Value is bigger than Above 20"))
  Else
     MsgBox(0, "Tutorial", "Value is than Below 20")
EndIf
EndFunc   ;==>Example

here is the Window Info Needed

>>>> Window <<<<
Title:  TechPowerUp GPU-Z 2.1.0
Class:  #32770
Position:   27, 0
Size:   400, 503
Style:  0x94CE0044
ExStyle:    0x00050100
Handle: 0x00000000000A05F8

>>>> Control <<<<
Class:  Static
Instance:   66
ClassnameNN:    Static66
Name:   
Advanced (Class):   [CLASS:Static; INSTANCE:66]
ID: 65535
Text:   32.0 °C 
Position:   164, 34
Size:   70, 20
ControlClick Coords:    39, 12
Style:  0x5000D30D
ExStyle:    0x00020000
Handle: 0x00000000000A07BA
>>>> Visible Text <<<<
&Close
NVIDIA GeForce GTX 660 Ti
Log to file
 GPU Temperature
32.0 °C

 

Edited by joeyg37

Share this post


Link to post
Share on other sites



#2 ·  Posted

this line probably should be:

if $sText > 20 Then

But I guess $sText contains a literal string "32.0 °C", so you need to extract the first bit only and convert that to a number. 

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

5 minutes ago, Jos said:

this line probably should be:

if $sText > 20 Then

But I guess $sText contains a literal string "32.0 °C", so you need to extract the first bit only and convert that to a number. 

Jos

i know that but im not sure how to can you point me in the right direction?

Edited by joeyg37

Share this post


Link to post
Share on other sites

#4 ·  Posted

Try running this from SciTE and check what the 2 log lines return in the output pane to check the exact content of the $sText:

Example()

Func Example()

    WinActivate("TechPowerUp")
    Sleep(2000)
    $sText = ControlGetText("TechPowerUp", "", 65535)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sText = |' & $sText & '|' & @CRLF)
    $sText = Number(StringReplace($sText," °C",""))
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sText = |' & $sText & '|' & @CRLF)
    If $sText > 20 Then
        MsgBox(0, "Tutorial", "Value is bigger than Above 20"))
    Else
        MsgBox(0, "Tutorial", "Value is than Below 20")
    EndIf
EndFunc   ;==>Example

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted

21 minutes ago, Jos said:

Try running this from SciTE and check what the 2 log lines return in the output pane to check the exact content of the $sText:

Example()

Func Example()

    WinActivate("TechPowerUp")
    Sleep(2000)
    $sText = ControlGetText("TechPowerUp", "", 65535)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sText = |' & $sText & '|' & @CRLF)
    $sText = Number(StringReplace($sText," °C",""))
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sText = |' & $sText & '|' & @CRLF)
    If $sText > 20 Then
        MsgBox(0, "Tutorial", "Value is bigger than Above 20"))
    Else
        MsgBox(0, "Tutorial", "Value is than Below 20")
    EndIf
EndFunc   ;==>Example

Jos 

Much Thanks

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