Jump to content

GuiIPAddress UDF


GaryFrost
 Share

Recommended Posts

Requires beta

http://www.autoitscript.com/fileman/users/gafrost/ipaddress.GIF

TODO features:

> set address function

> set range function

Fixed: _GetIPAdress function, used code from LazyCat's control

This was more for a learning experience.

Edit: added ability to use styles and extended styles

Functions:

; create the control

_GuiCtrlIpAddressCreate($h_Gui, $x, $y, $width, $heigth, $v_styles = -1, $v_exstyles = -1)

; Clears the contents of the IP address control.

_ClearIPAdress($h_IPAdress)

; Retrieves the address values for all four fields in the IP address control.

_GetIPAdress($h_IPAdress)

; Determines if all fields in the IP address control are blank.

_IPIsBlank($h_IPAdress)

; Sets the keyboard focus to the specified field in the IP address control.

; All of the text in that field will be selected.

_IPSetFocus($h_IPAdress, $index)

; Sets the valid range for the specified field in the IP address control.

_IPSetRange($h_IPAdress, $field_index, $low_range = 0, $high_range = 255)

; Sets the address values for all four fields in the IP address control.

; i.e. "24.2.255.2"

_IPSetAddress($h_IPAdress, $s_address)

Enjoy

Edit: some refinements to _GetIPAdress and _IPSetRange functions

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

... :lmao:

so..what does it do..

It's a SysIPAdress32 control, so don't have to do all the checking to see if each field is > 255 because it won't let you.

Just thru it together for anyone wanting add an IP control to an script, think holger or someone did an IP Control dll a while back.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Funny, I already make the same UDF :lmao: But yours can set styles, I forget about that in mine.

I knew someone had done an dll, didn't know it had been done as a UDF already

Made some refinements to _GetIPAdress and _IPSetRange functions

Thanks.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...

Hi!

Is it possible to disable the input field? I tried it with "GUICtrlSetState($variable, $GUI_DISABLE), but it don't work.

Can anyone help me?

Thanks, Dennis

Sorry for the delay, was out of town

put the following just before the while line in the example to see how it works

ControlDisable("IP Address Control Example", "", "Edit1")
 ControlDisable("IP Address Control Example", "", "Edit2")
 ControlDisable("IP Address Control Example", "", "Edit3")
 ControlDisable("IP Address Control Example", "", "Edit4")

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 5 months later...

Trying to run it with the latest beta, but I get this:

C:\Program Files\AutoIt3\Examples\IPAdress_Example.au3 - 1 error(s), 0 warning(s)

!>AU3Check ended.rc:2

>Running:(3.2.1.1):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Program Files\AutoIt3\Examples\IPAdress_Example.au3"

C:\Program Files\AutoIt3\Examples\GuiIPAdress.au3 (4) : ==> Can not redeclare a constant.:

Global Const $WM_USER = 0x400

Global Const ^ ERROR

+>AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 7.306

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Just comment that line out, that example was written before the includes were split

That allowed it to run. Then ran into problem trying to input 172.20.xx.xx. Hits snag on the second octet...

Changed values in lines 35 and 37 and it works with 172.20.etc., but am too stupid to understand what I would use this for. My apologies... :P

Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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...