Sign in to follow this  
Followers 0
Monolith

little help with arrays

3 posts in this topic

#1 ·  Posted (edited)

Hi guys,

I am a little perplexed on what is causing the issue in my script.

where in each command for each array is not outputted to the edit control as soon as it is completed, performance is extreamly slow can take 3+ mins to complete and it only outputs 8 of the 53 to the edit control.

Anyone have a solution and also have any suggestion in making the script performance allot better?

#include <Constants.au3>
#include <Array.au3>
#include <GUIConstants.au3>
#include <process.au3>
#Include <GuiButton.au3>
DirCreate(@TempDir & '\test')
Fileinstall('testinfo.dll', @tempdir & '\test\testinfo.dll', 0)
FileInstall('test.exe', @TempDir & '\test\test.exe')
FileInstall('testStatus.exe', @TempDir & '\test\testStatus.exe', 0)
FileInstall('testparse.exe', @TempDir & '\test\testparse.exe', 0)
FileInstall('testinfo.exe', @TempDir & '\test\testinfo.exe', 0)

global $test, $file, $title, $file2, $unlock

$file = FileGetShortName(@TempDir & '\test\test.exe')
$gui= GUICreate("test app", 474, 285, 193, 115)
$GO = GUICtrlCreateButton("GO", 385, 20, 81, 41)
$edit1 = GUICtrlCreateEdit("", 22, 21, 354, 243)
GUICtrlSetData(-1, "")
$Cancel = GUICtrlCreateButton("Cancel", 385, 69, 81, 41)

GUISetState(@SW_SHOW)

input1()

Func input1()
$user = InputBox("Input", "Input", "", "")
    If @error = 1 Then
        MsgBox(0, "", "Cancel Pressed, application terminated")
        Exit
    Else
        test123()
    EndIf

EndFunc


func test123()
local $i, $pid, $line = ""
$adminuser = InputBox("", "", "")
$adminpwd = InputBox("Password", "", "", "*")
$file = FileGetShortName(@TempDir & '\test\test.exe')
$title = 'Test App' & ' ' & '&' & ' ' & 'cls'
$file2 = @TempDir & '\test\testStatus.exe'

Local $TestArray[46]
$TestArray[0] = $file & " " & ' ' & " " & $test
$TestArray[1] = $file & " " & ' ' & " " & $test
$TestArray[2] = $file & " " & ' ' & " " & $test
$TestArray[3] = $file & " " & ' ' & " " & $test
$TestArray[4] = $file & " " & ' ' & " " & $test
$TestArray[5] = $file & " " & ' ' & " " & $test
$TestArray[6] = $file & " " & ' ' & " " & $test
$TestArray[7] = $file & " " & ' ' & " " & $test
$TestArray[8] = $file & " " & ' ' & " " & $test
$TestArray[9] = $file & " " & ' ' & " " & $test
$TestArray[10] = $file & " " &' ' & " " & $test
$TestArray[11] = $file & " " &' ' & " " & $test
$TestArray[12] = $file & " " &' ' & " " & $test
$TestArray[13] = $file & " " &' ' & " " & $test
$TestArray[14] = $file & " " &' ' & " " & $test
$TestArray[15] = $file & " " &' ' & " " & $test
$TestArray[16] = $file & " " &' ' & " " & $test
$TestArray[17] = $file & " " &' ' & " " & $test
$TestArray[18] = $file & " " &' ' & " " & $test
$TestArray[19] = $file & " " &' ' & " " & $test
$TestArray[20] = $file & " " &' ' & " " & $test
$TestArray[21] = $file & " " &' ' & " " & $test
$TestArray[22] = $file & " " &' ' & " " & $test
$TestArray[23] = $file & " " &' ' & " " & $test
$TestArray[24] = $file & " " &' ' & " " & $test
$TestArray[25] = $file & " " &' ' & " " & $test
$TestArray[26] = $file & " " &' ' & " " & $test
$TestArray[27] = $file & " " &' ' & " " & $test
$TestArray[28] = $file & " " &' ' & " " & $test
$TestArray[29] = $file & " " &' ' & " " & $test
$TestArray[30] = $file & " " &' ' & " " & $test
$TestArray[31] = $file & " " &' ' & " " & $test
$TestArray[32] = $file & " " &' ' & " " & $test
$TestArray[33] = $file & " " &' ' & " " & $test
$TestArray[34] = $file & " " &' ' & " " & $test
$TestArray[35] = $file & " " &' ' & " " & $test
$TestArray[36] = $file & " " &' ' & " " & $test
$TestArray[37] = $file & " " &' ' & " " & $test
$TestArray[38] = $file & " " &' ' & " " & $test
$TestArray[39] = $file & " " &' ' & " " & $test
$TestArray[40] = $file & " " &' ' & " " & $test
$TestArray[41] = $file & " " &' ' & " " & $test
$TestArray[42] = $file & " " &'  '& " " & $test
$TestArray[43] = $file & " " &'  '& " " & $test
$TestArray[44] = $file & " " &'  '& " " & $test
$TestArray[45] = $file & " " &'  '& " " & $test

  For $i=0 To 45
        $pid = run(@comspec & " /c " & $TestArray[$i],"",@SW_SHOW,$STDERR_CHILD + $STDOUT_CHILD)
        Do
            $line &= StdoutRead($pid)
        Until @error
    Next
    GUICtrlSetData($edit1,$line)
    EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Thanks in advance

Edited by Monolith

Share this post


Link to post
Share on other sites



Hi,

After further trial and error, i found a solution two one of my problems, by rearranging GUICtrlSetData($edit1,$line) before Next.

outputs to edit control after execution of each command

Share this post


Link to post
Share on other sites

Two things:

1) The script isn't working on my computer. That is to be expected since it excludes files I don't have. Not that I want them, but it would be easier if you'd remove or replace them in you example

2) I am a little unclear on what the second problem is. Could you state them per problem?

Could it be the programs you run after eachother be the source of the script seeming slow?


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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