Sign in to follow this  
Followers 0
Rahul Rohela

Box to enter IP

7 posts in this topic

HI,

I want to create input box to enter IP.. Just same as any other IP input box that we use with windows.

This box will not accespt number grate than 255 & to work same as we found on any window aplication that is using IP address.. Like IP scanners.

Please help....

Thx B)

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


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