Jump to content

Recommended Posts

  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

JOELO,

Welcome to the AutoIt forums. What code have you tried that does not work?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites

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.

 

Link to post
Share on other sites
  • Developers
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 post
Share on other sites

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.

Link to post
Share on other sites

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 post
Share on other sites

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.

Link to post
Share on other sites
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.

#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 by TheXman
Added additional examples
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...