Sign in to follow this  
Followers 0
Saboath

Returning an IP to Input field - Resolved

2 posts in this topic

#1 ·  Posted (edited)

Hi guys.. I am writing a new script and have come across a bit of a problem.. hope you guys can help!

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $oldIP, $Ioldname, $oldname

#Region ### START Koda GUI section ### Form=
$GuiComparison = GUICreate("Comparison", 647, 450, -1, -1, $WS_Border)
$Label1 = GUICtrlCreateLabel("This script requires an administrative account to run.", 48, 24, 249, 17)
$Label2 = GUICtrlCreateLabel("New Computer:", 56, 64, 75, 25)
$Inewname = GUICtrlCreateInput(@ComputerName, 144, 64, 121, 21)
$Label3 = GUICtrlCreateLabel("Old Computer: ", 56, 96, 80, 17)
$Ioldname = GUICtrlCreateInput($oldname, 144, 96, 121, 21)
$bTest = GUICtrlCreateButton("Test", 272, 96, 51, 25, 0)
$Label4 = GUICtrlCreateLabel("Site Selection:", 56, 144, 72, 17)
$Combo1 = GUICtrlCreateCombo("", 144, 144, 145, 25)
GUICtrlSetData(-1, "Site1|Site2|Site3|Site4", "Site1")
$Label5 = GUICtrlCreateLabel("Item Selection: ", 56, 176, 77, 17)
$Combo2 = GUICtrlCreateCombo("", 144, 176, 145, 25)
GUICtrlSetData(-1, "Desktop|Laptop", "Desktop")
$Group1 = GUICtrlCreateGroup("Comparison Options ", 64, 216, 257, 145)
$Checkbox1 = GUICtrlCreateCheckbox("Comparison Basic", 80, 240, 100, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetState(-1, $GUI_DISABLE)
$Checkbox2 = GUICtrlCreateCheckbox("Copy Folders / Files", 80, 264, 113, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Install Applications", 80, 288, 105, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Uninstall Drawing Locator and Extra", 80, 312, 193, 17)
$Checkbox5 = GUICtrlCreateCheckbox("General Cleanup", 80, 336, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Brun = GUICtrlCreateButton("Run", 56, 384, 75, 25, 0)
$BCancel = GUICtrlCreateButton("Cancel", 176, 384, 75, 25, 0)
$Group2 = GUICtrlCreateGroup("Computer Details", 328, 48, 297, 377)
$Label6 = GUICtrlCreateLabel("Old Computer Details -", 352, 80, 109, 17)
$Label7 = GUICtrlCreateLabel("IP Address", 392, 104, 69, 17)
$Label8 = GUICtrlCreateLabel("Available Space", 376, 128, 81, 17)
$Input3 = GUICtrlCreateInput($oldIP, 464, 96, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 464, 120, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BCancel
            Exit
        Case $bTest
            Test()

    EndSwitch
WEnd


Func Test()
    TCPStartup()
    $oldIP = TCPNameToIP($oldname)
    TCPShutdown()
EndFunc ;==>Test

The problem is, its not returning the $OldIP to the $Input3 section. Its giving an IP (Ive put in a message box in the Test() and its returning it correctly) its just not displaying it after I press the Test button.

Thanks in advance!

Saboath.

Edited by Saboath

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok, so im Stubborn and I fixed it myself!

Like so:

Func Test()
    TCPStartup()
    $oldname = GUICtrlRead($Ioldname)
    $oldIP = TCPNameToIP($oldname)
    If @error Then
        $oldIP = "Not Responding"
    Else
    EndIf
    TCPShutdown()
    GUICtrlSetData($Input3, $oldIP)
EndFunc ;==>Test
Edited by Saboath

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