Jump to content

Box to enter IP


Recommended Posts

I'm sure there is a better way to do this and I'm no programmer. So let me just get that out there first. B)

This should be what your looking for though.

#include <GuiConstants.au3>
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("Form2", 310, 76, 430,346 ,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Edit1 = GuiCtrlCreateInput("256", 8, 8, 41, 21)

GUICtrlSetLimit($Edit1,3)
$Edit2 = GuiCtrlCreateInput("20", 56, 8, 41, 21)

GUICtrlSetLimit($Edit2,3)
$Edit3 = GuiCtrlCreateInput("30", 104, 8, 41, 21)

GUICtrlSetLimit($Edit3,3)
$Edit4 = GuiCtrlCreateInput("100", 152, 8, 41, 21)

GUICtrlSetLimit($Edit4,3)
$Button1 = GuiCtrlCreateButton("Button1", 216, 8, 65, 25)



GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button1
        $ip1 = GUICtrlRead($Edit1)
        $ip2 = GUICtrlRead($Edit2)
        $ip3 = GUICtrlRead($edit3)
        $ip4 = GUICtrlRead($Edit4)
        $string = $ip1 & "." & $ip2 & "." & $ip3 & "." &  $ip4  
        _IPerrorCtrl()
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Func _IPerrorCtrl()
    If $ip1 > 255 Then 
        MsgBox(16,"Warning!","Number be must be lower then 255")
        GUICtrlSetData($Edit1,"0")
    ElseIf $ip2 > 255 Then
        MsgBox(16,"Warning!","Number be must be lower then 255")
        GUICtrlSetData($Edit1,"0")
    ElseIf $ip3 > 255 Then
        MsgBox(16,"Warning!","Number be must be lower then 255")
        GUICtrlSetData($Edit1,"0")
    ElseIf $ip4 > 255 Then   
        MsgBox(16,"Warning!","Number be must be lower then 255")
GUICtrlSetData($Edit1,"0")      
    Else
        Msgbox(32,"",$string)
    ;RunCommand Here
    EndIf
    
EndFunc
Link to comment
Share on other sites

Might help, but I don't know how easy it is to integrate into projects:

http://www.autoitscript.com/forum/index.ph...7855&hl=address

In fact, it seems the Func Dot() doesn't work right in the current version of AutoIt....

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

HI,

Thx for reply..

CyberSlug Posted Yesterday, 08:55 PM

Might help, but I don't know how easy it is to integrate into projects:

http://www.autoitscript.com/forum/index.ph...7855&hl=address

In fact, it seems the Func Dot() doesn't work right in the current version of AutoIt....

This is 100% close to my Query...

But problem is its not working with TAB or when we press "." Any suggestions to resolve this???

Thx

Edited by Rahul Rohela
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...