Sign in to follow this  
Followers 0
Jon Mason

Array Issue

5 posts in this topic

Below is a little way I'm trying to deploy applications to various locations, could work good, but the Array is messed up. When you click 'Copy', it figures out the name of the dir I'm copying over, loads the locations into the array, then starts the loop. The loop creates that new dir, then calls another program that does the copy process.

My issue is in the array. It craps out part of the way, some of the time on large deploys. What in my array do I have incorrect. I tried to use the _ArrayDisplay() function after the while loop, but I get an error saying:

(93) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$desFolder = $divArray[$curCpy]$desFolder = ^ ERROR

I don't know what I have incorrect. Ideas?

#include <GUIConstants.au3>
#include <Array.au3>

$numDivs = "13";
dim $desFolder
dim $location
dim $curCpy = 0
Dim $DivArray[1]
Dim $DivNArray[1]

$pointCount = "0" 
$moveCount = "1" 
$ParceCur = "0" 
$loopCount = "0" 
$CurParce = "0"
$folderParce = ""

$AT = "\\location...."
$BACP = "\\location...."
$CDC = "\\location...."

$CE = "\\location...."
$CI = "\\location...."
$DE = "\\location...."

$GO = "\\location...."
$JC = "\\location...."
$MA = "\\location...."

$QF = "\\location...."
$RA = "\\location...."
$SW = "\\location...."

$ZenApps = "\\location...."
$ZenQA = "\\location...."


$Form1 = GUICreate("Copy Dir to Divisions", 430, 110)
$Input1 = GUICtrlCreateInput("", 8, 8, 305, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetTip(-1, "Type path to file or click Browse")
$B_Open = GUICtrlCreateButton("Copy", 375, 8, 49, 25)
GUICtrlSetTip(-1, "Start Copying")
$B_Brows = GUICtrlCreateButton("Browse", 320, 8, 49, 25, $BS_ICON)
GUICtrlSetTip(-1, "Browse to directory to copy");mouse over response
GUICtrlSetImage(-1, "shell32.dll", 22);puts magnifying class icon on button

$ra_AT = GUICtrlCreateCheckbox ("AT", 10, 40)
$ra_BACP = GUICtrlCreateCheckbox ("BACP", 10, 60)
$ra_CDC = GUICtrlCreateCheckbox ("CDC", 10, 80)

$ra_CE = GUICtrlCreateCheckbox ("CE", 70, 40)
$ra_CI = GUICtrlCreateCheckbox ("CI", 70, 60)
$ra_DE = GUICtrlCreateCheckbox ("DE", 70, 80)

$ra_GO = GUICtrlCreateCheckbox ("GO", 130, 40)
$ra_JC = GUICtrlCreateCheckbox ("JC", 130, 60)
$ra_MA = GUICtrlCreateCheckbox ("MA", 130, 80)

$ra_QF = GUICtrlCreateCheckbox ("QF", 190, 40)
$ra_RA = GUICtrlCreateCheckbox ("RA", 190, 60)
$ra_SW = GUICtrlCreateCheckbox ("SW", 190, 80)

$ra_ZenApps = GUICtrlCreateCheckbox ("ZenApps", 250, 40)
$ra_ZemQA = GUICtrlCreateCheckbox ("ZenQA", 250, 60)
;$ra_?? = GUICtrlCreateCheckbox ("??", 250, 80)

GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $B_Brows;browse for file and set into input box
            $folderOpen = FileSelectFolder("Copy Folder", "", 4)
        ;$fileOpen = FileOpenDialog("Choose file...", "P:\ZenApps\", "All Files (*.*)")
            If $folderOpen <> "1" Then
                GUICtrlSetData($Input1, $folderOpen)
            EndIf
            
        Case $msg = $B_Open;click on open button
            $orgfolder = GUICtrlRead($Input1)
            
            _setArray()
            _dirName()
            $curCpy = $curCpy + 1
            While $curCpy <= $numDivs
                
                $desFolder = $divArray[$curCpy] 
                $location = $divNArray[$curCpy] 
                
                DirCreate($desFolder & $folderParce)
                RunWait("copyWprog.exe " & $orgfolder & " " & $desFolder & $folderParce & " " & $location)
                
                $curCpy = $curCpy + 1
            WEnd
            MsgBox(0, "", "Complete")
            Exit

        Case Else
        ;;;;;;;
            
    EndSelect
WEnd
Exit
;Here Right
Func _dirName()
    Do 
        $moveCount = $moveCount + 1 
        $ParceRight = StringRight($orgfolder, $moveCount - "1") 
        $ParceRightLen = StringLen($ParceRight) 
        $CurParce = StringLeft($ParceRight, "1") 
        $loopCount = $loopCount + 1 
        if $CurParce = "\" Then 
            $pointCount = $pointCount + 1 
        EndIf
    Until $pointCount = "1";change this point count to the number of times you want to see $curParce
    $folderParce = StringRight($orgfolder, $loopCount)
EndFunc

Func _setArray()

    if GUICtrlRead($ra_AT) = 1 Then
        _ArrayAdd($divArray,$AT)
        _ArrayAdd($divNArray,"AT")
    EndIf
    if GUICtrlRead($ra_BACP) = 1 Then
        _ArrayAdd($divArray,$BACP)
        _ArrayAdd($divNArray,"BACP")
    EndIf
    if GUICtrlRead($ra_CDC) = 1 Then
        _ArrayAdd($divArray,$CDC)
        _ArrayAdd($divNArray,"CDC")
    EndIf
    if GUICtrlRead($ra_CI) = 1 Then
        _ArrayAdd($divArray,$CI)
        _ArrayAdd($divNArray,"CI")
    EndIf
    if GUICtrlRead($ra_CE) = 1 Then
        _ArrayAdd($divArray,$CE)
        _ArrayAdd($divNArray,"CE")
    EndIf
    if GUICtrlRead($ra_DE) = 1 Then
        _ArrayAdd($divArray,$DE)
        _ArrayAdd($divNArray,"DE")
    EndIf
    if GUICtrlRead($ra_GO) = 1 Then
        _ArrayAdd($divArray,$GO)
        _ArrayAdd($divNArray,"GO")
    EndIf
    if GUICtrlRead($ra_JC) = 1 Then
        _ArrayAdd($divArray,$JC)
        _ArrayAdd($divNArray,"JC")
    EndIf
    if GUICtrlRead($ra_MA) = 1 Then
        _ArrayAdd($divArray,$MA)
        _ArrayAdd($divNArray,"MA")
    EndIf
    if GUICtrlRead($ra_QF) = 1 Then
        _ArrayAdd($divArray,$QF)
        _ArrayAdd($divNArray,"QF")
    EndIf
    if GUICtrlRead($ra_RA) = 1 Then
        _ArrayAdd($divArray,$RA)
        _ArrayAdd($divNArray,"RA")
    EndIf
    if GUICtrlRead($ra_SW) = 1 Then
        _ArrayAdd($divArray,$SW)
        _ArrayAdd($divNArray,"SW")
    EndIf
    
    if GUICtrlRead($ra_ZenApps) = 1 Then
        _ArrayAdd($divArray,$ZenApps)
        _ArrayAdd($divNArray,"ZenApps")
    EndIf
    if GUICtrlRead($ra_ZemQA) = 1 Then
        _ArrayAdd($divArray,$ZenQA)
        _ArrayAdd($divNArray,"ZenQA")
    EndIf
    
EndFunc

Share this post


Link to post
Share on other sites



I believe this is what your attempting to do

Case $msg = $B_Open;click on open button
            $orgfolder = GUICtrlRead($Input1)
            
            _setArray()
            _dirName()
                For $curCpy = 1 To UBound($divArray) - 1
                $desFolder = $divArray[$curCpy] 
                $location = $divNArray[$curCpy] 
                
                DirCreate($desFolder & $folderParce)
                RunWait("copyWprog.exe " & $orgfolder & " " & $desFolder & $folderParce & " " & $location)
                
            Next
            MsgBox(0, "", "Complete")
            Exit

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

Thanks gafrost, that seems to work, but just to check, I want to display the array that is loaded. I tried the below code, but nothing happens, but I don't get anything.

Case $msg = $B_Open;click on open button
            $orgfolder = GUICtrlRead($Input1)
            _setArray()
            _dirName()

            _ArrayDisplay($desFolder, "")
            
        Case Else

Share this post


Link to post
Share on other sites

Thanks gafrost, that seems to work, but just to check, I want to display the array that is loaded. I tried the below code, but nothing happens, but I don't get anything.

Case $msg = $B_Open;click on open button
            $orgfolder = GUICtrlRead($Input1)
            _setArray()
            _dirName()

            _ArrayDisplay($desFolder, "")
            
        Case Else
$desFolder isn't an array, should be just a string

i.e.

MsgBox(0,"test",$desFolder)

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
:) ...dork.... Thanks a mill!!!

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