Maurizio Posted October 27, 2020 Share Posted October 27, 2020 Hi Foro I would like to kindly ask you how I have to do to write in input 2 and 4 what the user types on Input 1 and 3 Thank you #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 56, 56, 497, 217) $Input1 = GUICtrlCreateInput("Input1", 88, 104, 121, 21) $Input2 = GUICtrlCreateInput("Input2", 88, 144, 121, 21) $Input3 = GUICtrlCreateInput("Input3", 272, 104, 105, 21) $Input4 = GUICtrlCreateInput("Input4", 272, 144, 105, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
pixelsearch Posted October 27, 2020 Share Posted October 27, 2020 Hi Maurizio Registering WM_COMMAND should do it expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 56, 56, 497, 217) $Input1 = GUICtrlCreateInput("Input1", 88, 104, 121, 21) $Input2 = GUICtrlCreateInput("Input2", 88, 144, 121, 21) $Input3 = GUICtrlCreateInput("Input3", 272, 104, 105, 21) $Input4 = GUICtrlCreateInput("Input4", 272, 144, 105, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;============================================= Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ; Local $hWndFrom = $lParam Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) Switch $iCode Case $EN_CHANGE Switch $iIDFrom Case $Input1 GUICtrlSetData($Input2, GUICtrlRead($Input1)) Case $Input3 GUICtrlSetData($Input4, GUICtrlRead($Input3)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Maurizio Posted October 27, 2020 Author Share Posted October 27, 2020 thanks, i try to learn this too Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 I tried this code that you kindly passed me, but it doesn't write anything back. What I would like to do is insert a number in the Input1 box and receive the total in the Input2 box in the sense: If I first write 10 in Input1, in the Input2 box, I will have 10. Then if I go back to writing another number in the Input1 box, type 20, in the Input2 box I will have 30, that is 10 + 20. Link to comment Share on other sites More sharing options...
Zedna Posted October 28, 2020 Share Posted October 28, 2020 Add button to manually write adding: GUICtrlSetData($Input2, GUICtrlRead($Input1) + GUICtrlRead($Input2)) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 Thanks for your attention, could you kindly explain it to me, I can't get there by myself Link to comment Share on other sites More sharing options...
Dan_555 Posted October 28, 2020 Share Posted October 28, 2020 (edited) Look at the code from pixelsearch. There you will see the GuiCTRLsetData Command. When you find it, replace it with the command which zedna gave you. And modify the code with input4 in it, accordingly. Edited October 28, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 Ok thanks now I dedicate myself to it Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 i can't find that command in pixelsearch Link to comment Share on other sites More sharing options...
Dan_555 Posted October 28, 2020 Share Posted October 28, 2020 (edited) (Deleted Image). Edited October 28, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 I got confused, you were talking about pixelsearch forum member, and I was looking on the code pixelsearch. Mortified Thank you. Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 Now it works great Thanks Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 It happens that if I have to type a three-digit number in the Input1 box, in Input2 it already adds the first number I type. Example, if I type 21 in Input1, in Input2 it writes 23 because it adds up the 2, and the 21. It would need to write the number only after it has finished writing, perhaps with a key or simply by pressing enter. Link to comment Share on other sites More sharing options...
Nine Posted October 28, 2020 Share Posted October 28, 2020 I would suggest that you use Ctrl-Z to cancel the last entry, Del to clear all fields. You could also add a toolbar to perform those tasks. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 No the problem is not deleting the fields, but the fact that if I write a two-digit number, it reads it as if they were 2 numbers, for example: if I write 21 he adds 2 + 21 because he does not wait for you to finish writing, but adds immediately. It would take a key that says to add only when pressed. Link to comment Share on other sites More sharing options...
Nine Posted October 28, 2020 Share Posted October 28, 2020 I see, could you provide your latest script, so we can see what it is best under the circumstances. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 Certainly, imagine, indeed thanks. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 56, 56, 481, 225) $Input1 = GUICtrlCreateInput("Input1", 80, 96, 153, 21) $Input2 = GUICtrlCreateInput("Input2", 328, 96, 161, 21) $Input3 = GUICtrlCreateInput("Input3", 80, 160, 153, 21) $Input4 = GUICtrlCreateInput("Input4", 328, 160, 169, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;============================================= Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ; Local $hWndFrom = $lParam Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) Switch $iCode Case $EN_CHANGE Switch $iIDFrom Case $Input1 GUICtrlSetData($Input2, GUICtrlRead($Input1) + GUICtrlRead($Input2)) Case $Input3 GUICtrlSetData($Input4, GUICtrlRead($Input3) + GUICtrlRead($Input4)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Dan_555 Posted October 28, 2020 Share Posted October 28, 2020 Hi, i would do it in this way: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 56, 56, 481, 225) $Input1 = GUICtrlCreateInput("Input1", 80, 96, 153, 21) $Input2 = GUICtrlCreateInput("Input2", 328, 96, 161, 21) $Input3 = GUICtrlCreateInput("Input3", 80, 160, 153, 21) $Input4 = GUICtrlCreateInput("Input4", 328, 160, 169, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Global $tTimer1, $tTimer2, $fInput1 = 0, $fInput2 = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If TimerDiff($tTimer1) > 1500 And $fInput1 = 0 Then $fInput1 = 1 GUICtrlSetData($Input2, GUICtrlRead($Input1) + GUICtrlRead($Input2)) EndIf If TimerDiff($tTimer2) > 1500 And $fInput2 = 0 Then $fInput2 = 1 GUICtrlSetData($Input4, GUICtrlRead($Input3) + GUICtrlRead($Input4)) EndIf WEnd ;============================================= Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ; Local $hWndFrom = $lParam Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) Switch $iCode Case $EN_CHANGE Switch $iIDFrom Case $Input1 $tTimer1 = TimerInit() $fInput1 = 0 ;GUICtrlSetData($Input2, GUICtrlRead($Input1) + GUICtrlRead($Input2)) Case $Input3 $tTimer2 = TimerInit() $fInput2 = 0 ;GUICtrlSetData($Input4, GUICtrlRead($Input3) + GUICtrlRead($Input4)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND the timing can be adjusted in this line: If TimerDiff($tTimer1) > 1500 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 28, 2020 Author Share Posted October 28, 2020 yes this would also be interesting even if it would be better to put a button that when all the fields are full you click Link to comment Share on other sites More sharing options...
Zedna Posted October 28, 2020 Share Posted October 28, 2020 Yes, that is exactly what I wrote in my previous post ... 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