Jump to content
Sign in to follow this  
randeep

IP address input

Recommended Posts

randeep

hello all

i have created a GUI window. Now i want to place "." at the input of IP Address. it should not be editable or replaceable and should be counted as part of IP address. the input window will look like " . . . " , but not able to apply. pls help :D

thanx

#include "Variable Declaration.au3"
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#INCLUDE <File.au3>

InputWindowForSingleSite()


Func InputWindowForSingleSite()

Local $msg1, $Btn_OK, $Label1, $Label2, $Label3, $Label4, $Label5, $Input1, $Input2, $Input3, $Input4, $Input5, $MainLabel, $InputWindowHandle
Local $RetValue = True

Opt("GUIOnEventMode",0)

    $InputWindowHandle = GUICreate("Details for Single Sites", 250, 250, -1, -1, $WS_EX_DLGMODALFRAME)  ; will create a dialog box that when displayed is centered
    GUISetIcon("ARTEVEAI.ICO",-20)
    $MainLabel = GUICtrlCreateLabel("Please provide following details", 10, 20)
    $Label1 = GUICtrlCreateLabel("Database Name", 10, 50)
    $Label2 = GUICtrlCreateLabel("IP Address", 10, 80)
    $Label3 = GUICtrlCreateLabel("HostName", 10, 110)
    $Label4 = GUICtrlCreateLabel("Username", 10, 140)
    $Label5 = GUICtrlCreateLabel("Password", 10, 170)

    $Input1 = GUICtrlCreateInput("", 150, 43, 80)                                   ;for DB Name
    $Input2 = GUICtrlCreateInput("", 150, 73, 80, 0, $ES_NUMBER)                    ;for Ip address
    $Input3 = GUICtrlCreateInput("", 150, 103, 80)
    $Input4 = guictrlcreateinput("", 150, 133, 80)                                  ;for Username
    $Input5 = guictrlcreateinput("", 150, 163, 80)                                  ;for password
    $Btn_OK = GUICtrlCreateButton("OK", 90, 193, 80)                                ;OK button

GuiCtrlSetState($Btn_OK, $GUI_Disable)
GUISetState()
Local $Enabled = False

While 1

$msg1 = GUIGetMsg()

    If GuiCtrlRead($Input1) And GuiCtrlRead($Input3) And GuiCtrlRead($Input4) And GuiCtrlRead($Input5) <> "" And $Enabled = False Then
            GuiCtrlSetState($Btn_OK, $GUI_ENABLE)
            $Enabled = True
        EndIf

    Select

        Case $msg1 = $Btn_OK
             $InputOfInputBoxDataBaseName = GUICtrlRead($Input1)
             $InputOfInputBoxIP = GUICtrlRead($Input2)
             $InputOfInputBoxHostName = GUICtrlRead($Input3)
             $InputOfInputBoxUserName = GUICtrlRead($Input4)
             $InputOfInputBoxPassword = GUICtrlRead($Input5)
             $RetValue = True
             ExitLoop

        Case $msg1 = $GUI_EVENT_CLOSE

            ExitLoop

    EndSelect

WEnd

    GuiDelete($InputWindowHandle)
    WinWaitClose("Provide Details")
    Opt("GUIOnEventMode",1)



EndFunc

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Share this post


Link to post
Share on other sites
BrettF
randeep

now not able to have desired output of "$InputOfInputBoxIP" at below of function. :D

#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#INCLUDE <File.au3>
#Include <GuiIPAddress.au3>


InputWindowForSingleSite()

global  $InputOfInputBoxDataBaseName, $InputOfInputBoxIP,  $InputOfInputBoxHostName, $InputOfInputBoxUserName,  $InputOfInputBoxPassword

Func InputWindowForSingleSite()

Local $msg1, $Btn_OK, $Label1, $Label2, $Label3, $Label4, $Label5, $Input1, $Input2, $Input3, $Input4, $Input5, $MainLabel, $InputWindowHandle

Opt("GUIOnEventMode",0)

    $InputWindowHandle = GUICreate("Details for Single Sites", 250, 250, -1, -1, $WS_EX_DLGMODALFRAME)  ; will create a dialog box that when displayed is centered
    GUISetIcon("ARTEVEAI.ICO",-20)
    $MainLabel = GUICtrlCreateLabel("Please provide following details:", 10, 20)
    $Label1 = GUICtrlCreateLabel("Database Name", 10, 50)
    $Label2 = GUICtrlCreateLabel("IP Address", 10, 80);
    $Label3 = GUICtrlCreateLabel("Host Name", 10, 110)
    $Label4 = GUICtrlCreateLabel("Username", 10, 140)
    $Label5 = GUICtrlCreateLabel("Password", 10, 170)

    $Input1 = GUICtrlCreateInput("", 150, 43, 90)                                   ;for DB Name
    $Input2 = _GUICtrlIpAddress_Create ($InputWindowHandle, 150, 70, 90);GUICtrlCreateInput("", 150, 73, 80, 0);, $ES_NUMBER                    ;for Ip address
    _GUICtrlIpAddress_Set ($Input2, "000.000.000.000")
    $Input3 = GUICtrlCreateInput("", 150, 103, 90)
    $Input4 = guictrlcreateinput("artevea", 150, 133, 90)                                   ;for Username
    $Input5 = guictrlcreateinput("tmatrix", 150, 163, 90)                                   ;for password
    $Btn_OK = GUICtrlCreateButton("OK", 90, 193, 80)                                ;OK button

GuiCtrlSetState($Btn_OK, $GUI_Disable)
GUISetState()
Local $Enabled = False

While 1

$msg1 = GUIGetMsg()

    If GuiCtrlRead($Input1) And GuiCtrlRead($Input3) And GuiCtrlRead($Input4) And GuiCtrlRead($Input5) <> "" And $Enabled = False Then
            GuiCtrlSetState($Btn_OK, $GUI_ENABLE)
            $Enabled = True
        EndIf

    Select

        Case $msg1 = $Btn_OK
             $InputOfInputBoxDataBaseName = GUICtrlRead($Input1)
             $InputOfInputBoxIP = GUICtrlRead($Input2)
             $InputOfInputBoxHostName = GUICtrlRead($Input3)
             $InputOfInputBoxUserName = GUICtrlRead($Input4)
             $InputOfInputBoxPassword = GUICtrlRead($Input5)

             ExitLoop

        Case $msg1 = $GUI_EVENT_CLOSE

            ExitLoop

    EndSelect

WEnd

    GuiDelete($InputWindowHandle)
    WinWaitClose("Provide Details")
    Opt("GUIOnEventMode",1)



EndFunc
msgbox(0, "", $InputOfInputBoxIP)

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Share this post


Link to post
Share on other sites
BrettF

Now this is evidence of limited looking at the help file. So let me go through the steps to find your answer...

We have a look for _GUICtrlIpAddress_Create (). We find it. We look at the included example. We notice that it sets the value of the control. We have a look to see what the function is. We notice that the function _GUICtrlIpAddress_Set. We then ponder to ourselves... 'I wonder if there is the reverse of that function?', which leads us to _GUICtrlIpAddress_Get, the function we are searching for.

Is that extremely hard? The whole process shouldn't have taken more than 2minutes.

Cheers,

Brett

Edited by BrettF

Share this post


Link to post
Share on other sites
randeep

newbie actually :D

will read help file carefully :D

thanx

Now this is evidence of limited looking at the help file. So let me go through the steps to find your answer...

We have a look for _GUICtrlIpAddress_Create (). We find it. We look at the included example. We notice that it sets the value of the control. We have a look to see what the function is. We notice that the function _GUICtrlIpAddress_Set. We then ponder to ourselves... 'I wonder if there is the reverse of that function?', which leads us to _GUICtrlIpAddress_Get, the function we are searching for.

Is that extremely hard? The whole process shouldn't have taken more than 2minutes.

Cheers,

Brett


[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Share this post


Link to post
Share on other sites
randeep

@KenNichols

thanx for ur help

Use

_GUICtrlIpAddress_Get($InputOfInputBoxIP)

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Share this post


Link to post
Share on other sites
BrettF

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
Sign in to follow this  

×