JOELO Posted June 30, 2020 Share Posted June 30, 2020 Hi I'm trying to create a tool that use the Input box value and verify if that number is listed Ej; If input box "123456" = 546789 465854 645874 123456 Then MsgBox "YES" Else MsgBox "NO" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 30, 2020 Moderators Share Posted June 30, 2020 Moved to the appropriate forum. Moderation Team 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...
Moderators Melba23 Posted June 30, 2020 Moderators Share Posted June 30, 2020 JOELO, Welcome to the AutoIt forums. What code have you tried that does not work? 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 June 30, 2020 Share Posted June 30, 2020 The list of numbers, where is it coming from ? “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...
JOELO Posted June 30, 2020 Author Share Posted June 30, 2020 I want the list to be inside the script Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 30, 2020 Moderators Share Posted June 30, 2020 JOELO, Quote I want... Please note we are not a "code for you" service, but a bunch of people who help you get your code running correctly. So I suggest you look at the following functions in the Help file and see what you can put together: InputBox, If..ElseIf...EndIf, MsgBox. See how you get on - you know where we are if you run into problems. 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...
JOELO Posted June 30, 2020 Author Share Posted June 30, 2020 This is what I have #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 376, 197, 192, 124) $Input1 = GUICtrlCreateInput("", 80, 64, 193, 21) $Go = GUICtrlCreateButton("GO", 80, 120, 113, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go Go() EndSwitch WEnd Func Go() If ('1012,1221,1411' , $input) Then MsgBox(0,'','YES') Else MsgBox(0,'','NO') EndIf Link to comment Share on other sites More sharing options...
JOELO Posted June 30, 2020 Author Share Posted June 30, 2020 Hi I'm trying to create a tool that use the Input box value and verify if that number is listed Ej; If input box "123456" = 546789 465854 645874 123456 Then MsgBox "YES" Else MsgBox "NO" This is what I have #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 376, 197, 192, 124) $Input1 = GUICtrlCreateInput("", 80, 64, 193, 21) $Go = GUICtrlCreateButton("GO", 80, 120, 113, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go Go() EndSwitch WEnd Func Go() If ('1012,1221,1411' , $input) Then MsgBox(0,'','YES') Else MsgBox(0,'','NO') EndIf Link to comment Share on other sites More sharing options...
TheXman Posted June 30, 2020 Share Posted June 30, 2020 To obtain the value in $input1, use the GuiCtrlRead() function. Then you can compare its value to your list of values using an IF statement or maybe a SWITCH statement. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Developers Jos Posted June 30, 2020 Developers Share Posted June 30, 2020 16 minutes ago, JOELO said: Hi I'm trying to create a tool that use the Input box value and verify if that number is listed There is no need to start a new topic so please stick to the topic you already have! ... MERGED. 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...
Nine Posted June 30, 2020 Share Posted June 30, 2020 At the beginning of the script create an array of numbers : Local $aVar[3] = [1, 2, 3] ; An Array Then you can easily compare the value of the input field to the array list thru a for loop. Try this, and come back if you get stuck. “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...
JOELO Posted June 30, 2020 Author Share Posted June 30, 2020 awesome! now how can I have multiples values in one line? Ej: If GUICtrlRead ($Input1) = "1" or "2" or "3" Then MsgBox(0,'','YES') Else MsgBox(0,'','NO') EndIf Link to comment Share on other sites More sharing options...
Nine Posted June 30, 2020 Share Posted June 30, 2020 Not quite. Either use an array approach like I suggested with a For...Next loop. Another way is to use the Switch statement, where you could enumerate all values into a single line. “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...
TheXman Posted June 30, 2020 Share Posted June 30, 2020 (edited) 1 hour ago, JOELO said: how can I have multiples values in one line? For someone who is obviously so new to scripting, I don't understand your requirement that the comparison of the valid values be a one-liner. I would think that it is more important to learn the different ways that it can be done, regardless of the number of lines. The example below, using Nine's suggestion to use an array for your valid values, does the reading of the value and the comparison for valid values all in one line (Go1). Go2 & Go3 show other ways to do the same thing. expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> #include <Array.au3> Const $aValues = ["1012", "1221", "1411"] Global $Form1 = GUICreate("Form1", 376, 197, 192, 124) Global $Input1 = GUICtrlCreateInput("", 80, 64, 193, 21) Global $Go = GUICtrlCreateButton("GO", 80, 120, 113, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go Go1() ;Using _ArraySearch ;Go2() ;Using If ;Go3() ;Using Switch EndSwitch WEnd Func Go1() If _ArraySearch($aValues, GUICtrlRead($input1)) <> -1 Then MsgBox(0,'','YES') Else MsgBox(0,'','NO') EndIf EndFunc Func Go2() Local $sInput = GUICtrlRead($input1) If $sInput = "1012" Or $sInput = "1221" Or $sInput = "1411" Then MsgBox(0,'','YES') Else MsgBox(0,'','NO') EndIf EndFunc Func Go3() Switch GUICtrlRead($input1) Case "1012", "1221", "1411" MsgBox(0,'','YES') Case Else MsgBox(0,'','NO') EndSwitch EndFunc Edited June 30, 2020 by TheXman Added additional examples Dan_555 and JOELO 1 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Exit Posted July 1, 2020 Share Posted July 1, 2020 Just for fun the one-liner: MsgBox(0, 0, StringInStr("|546789|465854|645874|123456|", "|" & InputBox("", "Enter Value") & "|") ? "Yes" : "No", 0) Dan_555 1 App: Au3toCmd UDF: _SingleScript() 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