Jump to content

Help with displaying Arrays


Recommended Posts

The following code is used to check for the existence of a particular file on a server share. If I use an Inputbox instead of GUICreate it works but it closes after each run. I figured I would do it properly so I could search for several files without having to relaunch the script each time. It sort of works but what happens is I get a complete list of all files (around 5000 of them) then the whittled down list that I am asking for after closing the first full list. Also the whittled down list continues to display itself instead of closing. I have to kill the script from the SysTray. Any help appreciated as always.

#include <File.au3>
#include <Array.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

$Server = "\\SERVER\SHARE\"
;$List = _FileListToArray($Server, $CompName & "*")

#Region ### START Koda GUI section ### 
;RecKey.kxf
$Form1 = GUICreate("Search for Recovery Key", 251, 129, 393, 303)
$Label1 = GUICtrlCreateLabel("Enter Computer Name", 72, 16, 108, 17)
$Input1 = GUICtrlCreateInput("", 56, 48, 137, 21)
$Button1 = GUICtrlCreateButton("Search", 88, 88, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    $CompName = GUICtrlRead($Input1)
    $List = _FileListToArray($Server, $CompName & "*")
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $Button1
            If @error <> 0 Then
                MsgBox(0, "No Key", "No Recovery Key found for " & $CompName & ".")
                Exit
            EndIf
            _ArrayDisplay($List)
            ;Exit
    EndSwitch
WEnd

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

#include <File.au3>
#include <Array.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

$Server = "\\SERVER\SHARE\"
;$List = _FileListToArray($Server, $CompName & "*")

#Region ### START Koda GUI section ### 
;RecKey.kxf
$Form1 = GUICreate("Search for Recovery Key", 251, 129, 393, 303)
$Label1 = GUICtrlCreateLabel("Enter Computer Name", 72, 16, 108, 17)
$Input1 = GUICtrlCreateInput("", 56, 48, 137, 21)
$Button1 = GUICtrlCreateButton("Search", 88, 88, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $Button1
            $CompName = GUICtrlRead($Input1)
    $List = _FileListToArray($Server, $CompName & "*")
    If @error <> 0 Then
                MsgBox(0, "No Key", "No Recovery Key found for " & $CompName & ".")
                ContinueLoop
            EndIf
            _ArrayDisplay($List)
            ;Exit
    EndSwitch
WEnd

Link to comment
Share on other sites

It is bad practice to call a function inside your GUI loop (filelisttoarray) without requiring user interaction first. This loop needs to be fast for your GUI to respond in a timely fashion.

Link to comment
Share on other sites

<br />It is bad practice to call a function inside your GUI loop (filelisttoarray) without requiring user interaction first. This loop needs to be fast for your GUI to respond in a timely fashion.<br />

<br /><br /><br />

So what would be proper?

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

Ahh... not sure who you were talking too. Thanks.

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

Nevermind. Changed Switch to Select and all is well. Guess I need to read up on those.

Edited by ksmith247

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

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...