ForsakenGod Posted November 21, 2009 Share Posted November 21, 2009 Hello i would like to ask if there s some way to delete thinks send via GUICtrlSetData() I am using an InputBox which gets automatically filled in when i press a buton thanks to this command but i would like to make more buttons and to firstly delete everythink whats in the inputbox and then set there new data is it possible ? $sData = GUICtrlRead($Edit1) & "[" & @hour & ":" & @MIN & ":" & @SEC & "]" GUICtrlSetData($Edit1, $sData) Link to comment Share on other sites More sharing options...
martin Posted November 21, 2009 Share Posted November 21, 2009 (edited) Hello i would like to ask if there s some way to delete thinks send via GUICtrlSetData() I am using an InputBox which gets automatically filled in when i press a buton thanks to this command but i would like to make more buttons and to firstly delete everythink whats in the inputbox and then set there new data is it possible ? $sData = GUICtrlRead($Edit1) & "[" & @hour & ":" & @MIN & ":" & @SEC & "]" GUICtrlSetData($Edit1, $sData) Have a look in the help for GuiCtrlSetData. You will see that you are asking for the default behaviour. EDIT: see czardas's post #4 for a better answer. Edited November 21, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ForsakenGod Posted November 21, 2009 Author Share Posted November 21, 2009 Yes it should delete before writing other but for me it does not Link to comment Share on other sites More sharing options...
czardas Posted November 21, 2009 Share Posted November 21, 2009 (edited) Each time you read the data in the control, you extend the string by adding: & "[" & @hour & ":" & @MIN & ":" & @SEC & "]" So the data will get longer and longer each time. Could that be the problem? Edited November 21, 2009 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
MirnesC2 Posted November 22, 2009 Share Posted November 22, 2009 What are you trying to do? This? #Include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("CtrlSetData", 400, 400) GUISetState(@SW_SHOW) $input = GUICtrlCreateInput("[" & @hour & ":" & @MIN & ":" & @SEC & "]",10,10) $button = GUICtrlCreateButton("Update",50,50) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button GUICtrlSetData($input, "[" & @hour & ":" & @MIN & ":" & @SEC & "]") EndSwitch WEnd Link to comment Share on other sites More sharing options...
ForsakenGod Posted November 22, 2009 Author Share Posted November 22, 2009 Well the script above works for me thought but i dont know why mine does not work at all here s a lil parrt of it expandcollapse popup#Include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("CtrlSetData", 400, 400) GUISetState(@SW_SHOW) $input = GUICtrlCreateInput("[" & @hour & ":" & @MIN & ":" & @SEC & "]",10,10) $button = GUICtrlCreateButton("Update",50,50) $button2 = GUICtrlCreateButton("Update2",100,50) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button OneMin() Case $button2 FiveMin() EndSwitch WEnd Func OneMin() $sData = GUICtrlRead($input) & 5000*2 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000/5 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000/5 GUICtrlSetData($input, $sData) EndFunc Func FiveMin() $sData = GUICtrlRead($input) & 5000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000 GUICtrlSetData($input, $sData) EndFunc Link to comment Share on other sites More sharing options...
whim Posted November 22, 2009 Share Posted November 22, 2009 Unsure what you're trying to do, but maybe this well help to figure it out ? expandcollapse popup#Include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("CtrlSetData", 400, 400) GUISetState(@SW_SHOW) $h = @HOUR $m = @MIN $s = @SEC $input = GUICtrlCreateInput("[" & $h & ":" & $m & ":" & $s & "]",10,10) $button = GUICtrlCreateButton("+ 1 min",50,50) $button2 = GUICtrlCreateButton("+ 5 min",100,50) GUICtrlCreateLabel( "Mixing strings and numbers in AutoIt:", 50, 125) GUICtrlCreateLabel( '"123" + 10 = ' & ("123" + 10), 50, 150) GUICtrlCreateLabel( '"[123]" + 10 = ' & ("[123]" + 10), 50, 175) GUICtrlCreateLabel( '"123" && 10 = ' & ("123" & 10), 50, 200) GUICtrlCreateLabel( '"[123]" && 10 = ' & ("[123]" & 10), 50, 225) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button BumpSecs(60) Case $button2 BumpSecs(300) EndSwitch WEnd Func BumpSecs($x) $s = $s + $x While $s > 59 $s = $s - 60 $m = $m + 1 Wend While $m > 59 $m = $m - 60 $h = $h + 1 Wend While $h > 23 $h = $h - 24 Wend ; string format assures output with leading zero if necessary $sData = "[" & StringFormat("%02d", $h) & ":" & StringFormat("%02d", $m) & ":" & StringFormat("%02d", $s) & "]" GUICtrlSetData($input, $sData) EndFunc whim Link to comment Share on other sites More sharing options...
martin Posted November 22, 2009 Share Posted November 22, 2009 Well the script above works for me thought but i dont know why mine does not work at all here s a lil parrt of it expandcollapse popup#Include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("CtrlSetData", 400, 400) GUISetState(@SW_SHOW) $input = GUICtrlCreateInput("[" & @hour & ":" & @MIN & ":" & @SEC & "]",10,10) $button = GUICtrlCreateButton("Update",50,50) $button2 = GUICtrlCreateButton("Update2",100,50) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button OneMin() Case $button2 FiveMin() EndSwitch WEnd Func OneMin() $sData = GUICtrlRead($input) & 5000*2 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000/5 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000/5 GUICtrlSetData($input, $sData) EndFunc Func FiveMin() $sData = GUICtrlRead($input) & 5000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000 GUICtrlSetData($input, $sData) EndFunc What do you mean by "doesn't work"? It does what it's written to do as far as I can see. The script is written so that in function FiveMin line 1 $sData is set to be the contents of $input & 5000, so now $sData = HR:MIN:SEC5000 line2 $input is set with this string line2 $sData is set to be the contents of $input & 20000, so now $sData = HR:MIN:SEC:500020000 line4 $injput is set to this string etc This has been pointed out earlier in the thread. What are the values 5000, 20000 and 60000 for and how do they relate to one minute? Can you explain what you want the functions to do? Telling us something doesn't work without telling us what it's intended to do just delays, or completely prevents, relevant replies. I don't suppose your user name means that you have been taught by XxXGoD does it? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ForsakenGod Posted November 22, 2009 Author Share Posted November 22, 2009 I ve not posted my wgole script here its just its part. Values 6000,50000 or any number are values that should be inserted into an inputbox and i got variables in my script $sleep1,$sleep2,$sleep3 which read data in those inputboxes . And what does not work ? Very well then BEFORE writing anythink else in the inputbox it SHOULD remove any content contained in the inputbox BEFORE if i am right or no ? Now it just ADDS the value of $sData to the current content of the inpputbox. Link to comment Share on other sites More sharing options...
MirnesC2 Posted November 22, 2009 Share Posted November 22, 2009 Well the script above works for me thought but i dont know why mine does not work at all here s a lil parrt of it expandcollapse popup#Include <GuiConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("CtrlSetData", 400, 400) GUISetState(@SW_SHOW) $input = GUICtrlCreateInput("[" & @hour & ":" & @MIN & ":" & @SEC & "]",10,10) $button = GUICtrlCreateButton("Update",50,50) $button2 = GUICtrlCreateButton("Update2",100,50) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button OneMin() Case $button2 FiveMin() EndSwitch WEnd Func OneMin() $sData = GUICtrlRead($input) & 5000*2 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000/5 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000/5 GUICtrlSetData($input, $sData) EndFunc Func FiveMin() $sData = GUICtrlRead($input) & 5000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 20000 GUICtrlSetData($input, $sData) $sData = GUICtrlRead($input) & 60000 GUICtrlSetData($input, $sData) EndFunc I think you should look in the help files, or in autoit drag mouse over a function and press F1. You can't add & 5000 and so on after closing the parameters. You have to first get the variable from $input then do the math, which is what I think you are trying to do with the & 5000 part. Then after that you can use GUICtrlSetData. Func FiveMin() $var = GUICtrlRead($input) $total = $var + 5000 GUICtrlSetData($input, $total) EndFunc Link to comment Share on other sites More sharing options...
martin Posted November 22, 2009 Share Posted November 22, 2009 I ve not posted my wgole script here its just its part. Values 6000,50000 or any number are values that should be inserted into an inputbox and i got variables in my script $sleep1,$sleep2,$sleep3 which read data in those inputboxes . And what does not work ? Very well then BEFORE writing anythink else in the inputbox it SHOULD remove any content contained in the inputbox BEFORE if i am right or no ? Now it just ADDS the value of $sData to the current content of the inpputbox.You have chosen to ignore my explanation of why you get the result you do so I don't think it is sensible for me to try to help any more. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ForsakenGod Posted November 22, 2009 Author Share Posted November 22, 2009 You have chosen to ignore my explanation of why you get the result you do so I don't think it is sensible for me to try to help any more.I didnt realize what you did sayd to me ... you were right sorry Link to comment Share on other sites More sharing options...
ForsakenGod Posted November 22, 2009 Author Share Posted November 22, 2009 I don't suppose your user name means that you have been taught by XxXGoD does it?<-------- Nope 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