Sign in to follow this  
Followers 0
ttleser

Missing buttons

6 posts in this topic

I'm extremely new to using GUI as well as programming in general. So please bare with me.

I wrote a small script to scan 20 of my computers to tell me what IP Gateway each are set to. I have 2 WAN connections I can use (hence the reason for this script). Unfortunately when I click on the ReScan button, both the ReScan and Exit buttons disappear until after the program is done scanning and even then they only appear if I move my cursor over the top of where the buttons would be then they'll show up..

Can someone tell me what I'm doing wrong in my code?

GuiCreate("Remote Computer Gateway Detection", 175, 340)
GuiSetIcon("SHELL32.dll", 18)

; Show the GUI
GUISetState ()
$button_scan = GUICtrlCreateButton('&ReScan', 5, 310, 75, 23)
$button_exit = GUICtrlCreateButton('E&xit', 90, 310, 75, 23)

While 1

$msg = GUIGetMsg()

Select
Case $msg = $button_exit
    Exit
Case $msg = $GUI_EVENT_CLOSE
    Exit
Case $msg = $button_scan

$IP = 1
$listView = GuiCtrlCreateListView("Computer|Gateway", 0, 0, 175, 340)
Do
$var = Ping("192.168.100."&$IP,250)
If $var=1 Then
$var1 = RegRead("\\192.168.100."&$IP&"\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{3AA91409-2717-4EEF-8B03-F87F3C2682AF}", "DefaultGateway")
Else 
$var1 = "Offline"
EndIf
GuiCtrlCreateListViewItem("PC "&$IP&"|"&$var1, $listView)
$IP = $IP + 1
Until $IP = 21

EndSelect

WEnd

Share this post


Link to post
Share on other sites



controls overlap, might want to create the listview before the loop instead of everytime the button is hit.

you'll just have clear the listview

#include <GuiConstants.au3>
#include <GuiListView.au3>

GUICreate("Remote Computer Gateway Detection", 175, 340)
GUISetIcon("SHELL32.dll", 18)

; Show the GUI
GUISetState()
$listView = GUICtrlCreateListView("Computer|Gateway", 0, 0, 175, 300)
$button_scan = GUICtrlCreateButton('&ReScan', 5, 310, 75, 23)
$button_exit = GUICtrlCreateButton('E&xit', 90, 310, 75, 23)

While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $button_exit
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button_scan

            $IP = 1
            _GUICtrlListViewDeleteAllItems($listView)
;~          $listView = GUICtrlCreateListView("Computer|Gateway", 0, 0, 175, 340)
            Do
                $var = Ping("192.168.100." & $IP, 250)
                If $var = 1 Then
                    $var1 = RegRead("\\192.168.100." & $IP & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{3AA91409-2717-4EEF-8B03-F87F3C2682AF}", "DefaultGateway")
                Else
                    $var1 = "Offline"
                EndIf
                GUICtrlCreateListViewItem("PC " & $IP & "|" & $var1, $listView)
                $IP = $IP + 1
            Until $IP = 21

    EndSelect

WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks, I figured it was easy.

I'm getting an error that it can't find: GuiListView.au3

Also, I can't find GUICtrlListViewDeleteAllItems in the help file.

Thoughts?

Edited by ttleser

Share this post


Link to post
Share on other sites

Thanks, I figured it was easy.

I'm getting an error that it can't find: GuiListView.au3

Also, I can't find GUICtrlListViewDeleteAllItems in the help file.

Thoughts?

Make sure you have at least the latest release version 3.2.0.1

You can also get the latest beta which is 3.2.1.13


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Ah, so what you posted is under Beta then... Wasn't using beta. Got it and it's working now. Thanks..

Share this post


Link to post
Share on other sites

Ah, so what you posted is under Beta then... Wasn't using beta. Got it and it's working now. Thanks..

Shoud work with 3.2.0.1 release also


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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