Sign in to follow this  
Followers 0
jben

Array and function

3 posts in this topic

#1 ·  Posted (edited)

Hey...Can someone let me know how I can implement the array into the code below so I can call the function with different folder names...This works fine for 1 folder.

thanks

$F_Array = __FldrListToArray("C:\TEST\89765\", 0)
$F_Array1 = __FldrListToArray("C:\TEST\2345\", 0)
$F_Array = _loop($F_Array)


Func _loop( $F_Array)
    For $I = 1 To Ubound($F_Array) -1
    $targetDir = $F_Array[$I]
    MsgBox(0, "", $targetDir)
    $aZipList = _FileListToArray($targetDir,"*.zip",0)
    If IsArray($aZipList) Then FileMove($targetDir & $aZipList[1], $targetDir & "DATA_CHILD.zip")
    Next
Return $aZipList
Edited by jben

Share this post


Link to post
Share on other sites



Hey...Can someone let me know how I can implement the array into the code below so I can call the function with different folder names...This works fine for 1 folder.

thanks

$F_Array = __FldrListToArray("C:\TEST\89765\", 0)
$F_Array1 = __FldrListToArray("C:\TEST\2345\", 0)
$F_Array = _loop($F_Array)


Func _loop( $F_Array)
    For $I = 1 To Ubound($F_Array) -1
    $targetDir = $F_Array[$I]
    MsgBox(0, "", $targetDir)
    $aZipList = _FileListToArray($targetDir,"*.zip",0)
    If IsArray($aZipList) Then FileMove($targetDir & $aZipList[1], $targetDir & "DATA_CHILD.zip")
    Next
Return $aZipList
This is one way

Dim F_Folders[20],$F_Array[20]

$F_Folders[1] = "C:\TEST\89765\"
$F_Folders[2] = "C:\TEST\2345\"
$F_Folders[0] = 2

For $n = 1 to $F_Folders[0]
  $F_Array [$n] = _loop($F_Folders[$n])
next 


Func _loop( $F_list)
    Local $I, $target, $aZipList
    Local $Flist = __FldrListToArray($F_list,0)
    For $I = 1 To Ubound($Flist) -1
     $targetDir = $Flist[$I]
     MsgBox(0, "", $targetDir)
     $aZipList = _FileListToArray($targetDir,"*.zip",0)
     If IsArray($aZipList) Then FileMove($targetDir & $aZipList[1], $targetDir & "DATA_CHILD.zip")
    Next
Return $aZipList

I changed the local variable in _loop from the $F_Array to $F_list because I think it's better to have local variable names distinct from global names.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

thanks mate thats brilliant..

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