Jump to content

array to gui


Jochem
 Share

Recommended Posts

Hi,

I have an folder with log files and I want to change the control of a gui based on the existens of a log file:

so I made this script (it is working). Part of the script:

$folder1 = "\\location1\on\with list of computers in use"
$folder2 = "\\location1\own\with list of computers we have"
$own = _FileListToArray($folder1, "*")
$computer1 = _ArrayToString($own, @TAB, 1, 1)

$Pic1 = GUICtrlCreatePic("picture.jpg", 8, 8, 100, 100, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))

If FileExists($folder2 & $computer1) Then
    GUICtrlSetState($Pic1, $GUI_SHOW)
Else
    GUICtrlSetState($Pic1, $GUI_HIDE)
EndIf

But I have 100 logfiles (100 computers wich I have to check if they are on or off). Is there a quicker way to do this?

Edited by Jochem
Link to comment
Share on other sites

Hi,

I have an folder with log files and I want to change the control of a gui based on the existens of a log file:

so I made this script (it is working). Part of the script:

$folder1 = "\\location1\on\with list of computers in use"
$folder2 = "\\location1\own\with list of computers we have"
$own = _FileListToArray($folder1, "*")
$computer1 = _ArrayToString($own, @TAB, 1, 1)

$Pic1 = GUICtrlCreatePic("picture.jpg", 8, 8, 100, 100, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))

If FileExists($folder2 & $computer1) Then
    GUICtrlSetState($Pic1, $GUI_SHOW)
Else
    GUICtrlSetState($Pic1, $GUI_HIDE)
EndIf

But I have 100 logfiles (100 computers wich I have to check if they are on or off). Is there a quicker way to do this?

Use FileListToArray() to list all the available files once then use _ArraySearch() to determine if any given file is present. Should be much faster than repeated remote accesses.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Use FileListToArray() to list all the available files once then use _ArraySearch() to determine if any given file is present. Should be much faster than repeated remote accesses.

:)

thanks that works:

$own = _FileListToArray($folder1, "*")
$use = _FileListToArray($folder2, "*")

$iIndex = _ArraySearch($use, _ArrayToString($own, @TAB, 17, 17), 0, 0, 0, 1)
If @error Then
    GUICtrlSetState($Pic1, $GUI_HIDE)
Else
    GUICtrlSetState($Pic1, $GUI_SHOW)
EndIf
Edited by Jochem
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...