Musashi Posted August 16, 2022 Share Posted August 16, 2022 (edited) 1 hour ago, EAHuaroto said: do you think we could add or concatenate a "STRING" at the end of the Textbox value? Take a look at https://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm Edit : You can add the € sign behind the numeric string ( ... & " €"). This will be ignored by the Number function (but don't put it before the value !). Which position is suitable for this operation, however, I can not judge, because I only see your code snippet. Edited August 16, 2022 by Musashi EAHuaroto 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Werty Posted August 16, 2022 Share Posted August 16, 2022 (edited) Compacted version $sTextOld = '' While WinActive("[Title:Caja]") And Assign("sText", ControlGetText("Caja", "", "ThunderRT6TextBox21")) If $sText <> $sTextOld And Number(StringReplace(StringStripWS($sText, 8), ',', '.',1))<>0 And Assign("sTextOld", $sText) And Beep(660, 300) Then Sleep(0) WEnd Edited August 16, 2022 by Werty Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Musashi Posted August 16, 2022 Share Posted August 16, 2022 45 minutes ago, Werty said: Compacted version Hi Werty ! In principle, there is nothing wrong with writing compact code. In this case, however, I am of the opinion that comprehensibility is more important than saving a few lines of code. But please don't take this as a criticism of your suggestion . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Werty Posted August 16, 2022 Share Posted August 16, 2022 lol, yea, it is more like a sport, fun doing it, but i also use the method in my own scripts simply to make a long script shorter, when there are parts that are done and doesnt need anymore changing, less scrolling. Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Zedna Posted August 19, 2022 Share Posted August 19, 2022 (edited) On 8/16/2022 at 8:33 PM, EAHuaroto said: Great, thanks! …By the way, using this code, I mean not creating a new script file, do you think we could add or concatenate a "STRING" at the end of the Textbox value? I'd like to see the Textbox showing the currency symbol every time the value changes. By default, the Textbox does not shows the currency symbol on the app . Ref. POS Textbox Parameter Layout by default How I wish It would look like Here are two possible ways, you can accomodate code accordingly: $sTextOld = '' While True If WinActive("[Title:Caja]") Then ;Check if POS Window is currently active. $sText = ControlGetText("Caja", "", "ThunderRT6TextBox21") ;Get data from "TOTAL Textbox" If $sText <> $sTextOld Then ;Beep if "TOTAL Textbox" value changes If Number(StringReplace(StringStripWS($sText, 8), ',', '.',1)) <> 0 Then Beep(660, 300) ;Beep sound (not when 0 / 0,00) $sTextOld = $sText & ' €' ControlSetText("Caja", "", "ThunderRT6TextBox21", $sTextOld) EndIf EndIf Sleep(0) WEnd $sTextOld = '' While True If WinActive("[Title:Caja]") Then ;Check if POS Window is currently active. $sText = ControlGetText("Caja", "", "ThunderRT6TextBox21") ;Get data from "TOTAL Textbox" If $sText <> $sTextOld Then ;Beep if "TOTAL Textbox" value changes If Number(StringReplace(StringStripWS($sText, 8), ',', '.',1)) <> 0 Then Beep(660, 300) ;Beep sound (not when 0 / 0,00) If Not StringInStr($sText,'€',1) Then $sText &= ' €' ControlSetText("Caja", "", "ThunderRT6TextBox21", $sText) EndIf $sTextOld = $sText EndIf EndIf Sleep(0) WEnd Edited August 19, 2022 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
EAHuaroto Posted August 20, 2022 Author Share Posted August 20, 2022 23 hours ago, Zedna said: Here are two possible ways, you can accomodate code accordingly: $sTextOld = '' While True If WinActive("[Title:Caja]") Then ;Check if POS Window is currently active. $sText = ControlGetText("Caja", "", "ThunderRT6TextBox21") ;Get data from "TOTAL Textbox" If $sText <> $sTextOld Then ;Beep if "TOTAL Textbox" value changes If Number(StringReplace(StringStripWS($sText, 8), ',', '.',1)) <> 0 Then Beep(660, 300) ;Beep sound (not when 0 / 0,00) $sTextOld = $sText & ' €' ControlSetText("Caja", "", "ThunderRT6TextBox21", $sTextOld) EndIf EndIf Sleep(0) WEnd $sTextOld = '' While True If WinActive("[Title:Caja]") Then ;Check if POS Window is currently active. $sText = ControlGetText("Caja", "", "ThunderRT6TextBox21") ;Get data from "TOTAL Textbox" If $sText <> $sTextOld Then ;Beep if "TOTAL Textbox" value changes If Number(StringReplace(StringStripWS($sText, 8), ',', '.',1)) <> 0 Then Beep(660, 300) ;Beep sound (not when 0 / 0,00) If Not StringInStr($sText,'€',1) Then $sText &= ' €' ControlSetText("Caja", "", "ThunderRT6TextBox21", $sText) EndIf $sTextOld = $sText EndIf EndIf Sleep(0) WEnd With these lines we're experiencing a "slow transition effect" every time the control Textbox update the value (deleting de currency symbol, putting the numeric value, adding the currency symbol again) but It was a good try, though Link to comment Share on other sites More sharing options...
Zedna Posted August 20, 2022 Share Posted August 20, 2022 (edited) Try Sleep(250) as I sugested in my first post, your Sleep(0) in this case is problematic. You may try even bigger Sleep(...) Edited August 20, 2022 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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