Ashalshaikh Posted July 25, 2009 Posted July 25, 2009 (edited) Hi . First :: My English Is Very Bad <<<< So I'm Sorry. >_< It's Sample Function Thank You expandcollapse popup;~ #Example-------------------------------- ;~ $DDD = _FileOpenDialogToArray("Select Files", @DesktopDir, "All (*.*)") ;~ _ArrayDisplay($DDD) ;~ #Example -------------- End------------- ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileOpenDialogToArray ; Description ...: Show FileOpenDialog & Return Files In Array By Full Path. ; Syntax.........: _FileOpenDialogToArray($title, $initdir, $filter, [$options = 4, [$defaultname = "", [$hwnd = ""]]]) ; Parameters ....: Look At FileOpenDialog In HelpFile. ; Return values .: Success - Full Paths In Array ; Failure - 0 ; @Error - Look At FileOpenDialog In HelpFile. ; Author ........: Ashalshaikh : Ahmad ALshaikh ; Remarks .......: Return (Full Path) In Array ; =============================================================================================================================== #include <Array.au3> Func _FileOpenDialogToArray($title, $initdir, $filter, $options = 4, $defaultname = "", $hwnd = "") Local $ERR[1] = [0] Local $Files = FileOpenDialog($title, $initdir, $filter, $options, $defaultname, $hwnd) If @error Then SetError(@error, "", $ERR) If StringInStr($Files, "|") Then Local $SS = StringSplit($Files, "|") $Folder = $SS[1] For $x = 2 To $SS[0] $SS[$x] = $Folder & "\" & $SS[$x] Next _ArrayDelete($SS, 1) $SS[0] -= 1 Return $SS Else Local $Arr[2] = [1, $Files] Return $Arr EndIf EndFunc ;==>_FileOpenDialogToArray Thank You !! Edited November 30, 2009 by Ashalshaikh
happy2help Posted July 26, 2009 Posted July 26, 2009 Hi. Here is my version i had to make when i needed to list all the files i wanted to unpack with winrar. #include <UnRAR.au3> #include <File.au3> #include <Array.au3> Local $ArchiveFile[1] Global $Cancel = False HotKeySet("{Esc}", "_CancelUnpack") $copy1 = FileInstall("C:\Users\Public\Backup\Batch files\Install Files\unrar.dll", "unrar.dll", 1) $oFolder = "H:\To Burn\To Laptop\" If Not FileExists($oFolder) Then $oFolder = "D:\Laptop\Unpacked\" ; set for testing purposes $iFolder = "H:\To Burn\" If Not FileExists($iFolder) Then $iFolder = "D:\Laptop\Unpacked\" ; set for testing purposes $OutputFolder = FileSelectFolder("Browse for output path", $oFolder, 1) If $OutputFolder = "" Then Exit ; if its cancelled then exit script $InputFolder = FileSelectFolder("Browse for output path", $iFolder, 1) If $InputFolder = "" Then Exit ; if its cancelled then exit script $ArchiveFile[0] = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)") Do $ask = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)") if $ask = "" Then ExitLoop ; if its cancelled then no more files to add _ArrayAdd($ArchiveFile, $ask) Until False ...more code... Your code seems much cleaner. Thanks >_<
Ashalshaikh Posted July 27, 2009 Author Posted July 27, 2009 Hi. Here is my version i had to make when i needed to list all the files i wanted to unpack with winrar. #include <UnRAR.au3> #include <File.au3> #include <Array.au3> Local $ArchiveFile[1] Global $Cancel = False HotKeySet("{Esc}", "_CancelUnpack") $copy1 = FileInstall("C:\Users\Public\Backup\Batch files\Install Files\unrar.dll", "unrar.dll", 1) $oFolder = "H:\To Burn\To Laptop\" If Not FileExists($oFolder) Then $oFolder = "D:\Laptop\Unpacked\" ; set for testing purposes $iFolder = "H:\To Burn\" If Not FileExists($iFolder) Then $iFolder = "D:\Laptop\Unpacked\" ; set for testing purposes $OutputFolder = FileSelectFolder("Browse for output path", $oFolder, 1) If $OutputFolder = "" Then Exit ; if its cancelled then exit script $InputFolder = FileSelectFolder("Browse for output path", $iFolder, 1) If $InputFolder = "" Then Exit ; if its cancelled then exit script $ArchiveFile[0] = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)") Do $ask = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)") if $ask = "" Then ExitLoop ; if its cancelled then no more files to add _ArrayAdd($ArchiveFile, $ask) Until False ...more code... Your code seems much cleaner. Thanks >_< Great idea But the problem is that the function out more than once Thank You !!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now