joeyg37 Posted June 10, 2017 Share Posted June 10, 2017 (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 June 10, 2017 by joeyg37 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2017 Developers Share Posted June 10, 2017 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 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
joeyg37 Posted June 10, 2017 Author Share Posted June 10, 2017 (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 June 10, 2017 by joeyg37 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2017 Developers Share Posted June 10, 2017 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 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
joeyg37 Posted June 10, 2017 Author Share Posted June 10, 2017 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 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