Loc Posted July 22, 2020 Share Posted July 22, 2020 code: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GuiM = GUICreate("Example", 300, 129, 411, 115) $Input_String = GUICtrlCreateInput("Delete", 48, 16, 193, 21) $Button_Delete = GUICtrlCreateButton("Delete", 80, 56, 129, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 22, 2020 Moderators Share Posted July 22, 2020 (edited) Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Edited July 22, 2020 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 22, 2020 Moderators Share Posted July 22, 2020 Why would you not want to use GUICtrlSetData? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Loc Posted July 22, 2020 Author Share Posted July 22, 2020 I mean, in the input there are any texts I want the line of delete button in the gui that I mentioned to delete a word like Backspace but it deleted with that button :(. I'm sorry for not using guictrlsetdata Link to comment Share on other sites More sharing options...
Nine Posted July 22, 2020 Share Posted July 22, 2020 (edited) I do not understand the answer you just gave, but if you are looking at more flexibility, you could use GuiEdit.au3 UDF. There is a lot of functions that will help you manipulate the control (e.g. _GUICtrlEdit_ReplaceSel) Edited July 22, 2020 by Nine “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...
Moderators Melba23 Posted July 22, 2020 Moderators Share Posted July 22, 2020 Loc, Is it possible you are looking for a "cue banner" that only appears when the input does not have focus? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> $GuiM = GUICreate("Example", 300, 129, 411, 115) $Input_String = GUICtrlCreateInput("", 48, 16, 193, 21) _GUICtrlEdit_SetCueBanner ($Input_String, "Delete") $Button_Delete = GUICtrlCreateButton("Delete", 80, 56, 129, 41) GUICtrlSetState($Button_Delete, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Loc Posted July 23, 2020 Author Share Posted July 23, 2020 In my gui there are input and button. When I press the button it will delete 1 word on the input as using the backspace key. I mean it Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 23, 2020 Moderators Share Posted July 23, 2020 Loc, So how about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GuiM = GUICreate("Example", 300, 129, 411, 115) $Input_String = GUICtrlCreateInput("Word_1 Word_2 Word_3", 48, 16, 193, 21) $Button_Delete = GUICtrlCreateButton("Delete", 80, 56, 129, 41) GUICtrlSetState($Button_Delete, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button_Delete ; Read input content $sContent = GUICtrlRead($Input_String) ; Look for right-most space $iIndex = StringInStr($sContent, " ", 0, -1) If $iIndex Then ; Strip final word GUICtrlSetData($Input_String, StringMid($sContent, 1, $iIndex - 1)) Else ; Only one word so empty input GUICtrlSetData($Input_String, "") EndIf EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted July 23, 2020 Share Posted July 23, 2020 Or maybe this ? #include <GUIConstants.au3> #include <GuiEdit.au3> #include <Constants.au3> Global Const $WordToBeDeleted = "Test" Local $hGUI = GUICreate("Example", 300, 129, 411, 115) Local $Input_String = GUICtrlCreateInput("Word_1 Test Word_2", 48, 16, 193, 22) Local $Button_Delete = GUICtrlCreateButton("Delete", 80, 56, 129, 25) GUICtrlSetState($Button_Delete, $GUI_FOCUS) GUISetState() Local $sContent, $iIndex While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button_Delete ; Read input content $sContent = _GUICtrlEdit_GetText ($Input_String) ; Look for first occurence $iIndex = StringInStr($sContent, $WordToBeDeleted) If $iIndex Then ; Strip word with a backspace GUICtrlSetState($Input_String, $GUI_FOCUS) _GUICtrlEdit_SetSel ($Input_String, $iIndex-1, $iIndex+StringLen($WordToBeDeleted)-1) Send ("{BS}") EndIf EndSwitch WEnd “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...
jchd Posted July 23, 2020 Share Posted July 23, 2020 Another way: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GuiM = GUICreate("Example", 300, 129, 411, 115) $Input_String = GUICtrlCreateInput("Word_1 Word_2 Word_3", 48, 16, 193, 21) $Button_Delete = GUICtrlCreateButton("Delete", 80, 56, 129, 41) GUICtrlSetState($Button_Delete, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button_Delete GUICtrlSetData($Input_String, StringRegExpReplace(GUICtrlRead($Input_String), "(.*)\b\h?\S+", "$1")) EndSwitch WEnd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Loc Posted July 23, 2020 Author Share Posted July 23, 2020 Thank you everyone for your help Link to comment Share on other sites More sharing options...
spudw2k Posted July 24, 2020 Share Posted July 24, 2020 Following @Nine's example, you could also use _GUICtrlEdit_ReplaceSel($Input_String, "") or ControlSend instead of Send ("{BS}") Sightly more elegant and error proof in my opinion. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Loc Posted July 24, 2020 Author Share Posted July 24, 2020 I tested, there is no way to delete a word from right to left. Because I applied this method to input without input, I didn't use backspace Link to comment Share on other sites More sharing options...
Nine Posted July 24, 2020 Share Posted July 24, 2020 (edited) Loc what exactly do you want to achieve, could you show us an example of the content of the input box before and after clicking the button ? Is is the last word you want to erase ? Or like I was thinking a specific word somewhere inside the box ? Do you want the caret be located in the input box at the deletion location ? An example would greatly help us understand your goals Edited July 24, 2020 by Nine “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...
Dan_555 Posted July 24, 2020 Share Posted July 24, 2020 (edited) Maybe you mean to delete a char from left side ? Or from the right side ? Here are both examples #include <GUIConstantsEx.au3> $GuiM = GUICreate("Example", 300, 129, 411, 115) $Input_String = GUICtrlCreateInput("Delete me test tset em eteleD", 48, 16, 193, 21) $Button_Delete = GUICtrlCreateButton("Delete", 80, 46, 129, 25) $Button_BS = GUICtrlCreateButton("Backspace", 80, 76, 129, 25) GUICtrlSetState($Button_Delete, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button_Delete $tmp=GUICtrlRead($Input_String) $tmp=StringRight($tmp, StringLen($tmp)-1) GUICtrlSetData($Input_String, $tmp) Case $Button_BS $tmp=GUICtrlRead($Input_String) $tmp=StringLeft($tmp, StringLen($tmp)-1) GUICtrlSetData($Input_String, $tmp) EndSwitch WEnd Edited July 24, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Loc Posted July 25, 2020 Author Share Posted July 25, 2020 @ Dan_555 has always been the one who answered my questions correctly. Many thanks ❤️ Link to comment Share on other sites More sharing options...
jchd Posted July 25, 2020 Share Posted July 25, 2020 Mostly by chance I suppose, since you never took the pain to explain yourself completely, nor answer the several questions that were posed. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Loc Posted July 25, 2020 Author Share Posted July 25, 2020 ❤️ sorry i don't know english i posted my question with google translate. 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