Jump to content

Recommended Posts

Posted

Revised the function just a tad, but nothing that would have effected the previous one.

#include <array.au3>
$aArray = _FileOpenDialogArray("Choose file(s)", @MyDocumentsDir, "All (*.LNK)", 4 + 1)
_ArrayDisplay($aArray, '')

Func _FileOpenDialogArray($sTitle, $sInitDir, $sFilter, $nOptions = Default, $sDefaultName = '')
    Local $sDialog = FileOpenDialog($sTitle, $sInitDir, $sFilter, $nOptions, $sDefaultName)
    If @error Then Return SetError(1, 0, '')
    If StringInStr($sDialog, '|') Then
        Local $aSplit = StringSplit($sDialog, '|'), $sHold = ''
        For $iCC = 2 To UBound($aSplit) - 1
            $sHold &= $aSplit[1] & '\' & $aSplit[$iCC] & Chr(1)
        Next
        Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
    EndIf
    Local $aArray[2] = [1,$sDialog]
    Return $aArray
EndFunc

This worked fine for me:

I typed:

"File One" "File Two"

In the dialog for Multiple files, and it returned the result I expected.

Then I mistyped one of them and it returned an error as it should (File could not be found).

Is the conclusion that I can't copy multiple *.lnk files at once with this software? I copied and pasted your code, and I got the same error when I selected more than one *.lnk file.

I apperciate your help.

Posted

Xcal, if you add a 1 to your flag, the same error will occur as well in your code. It's not that I don't understand how to handle these files gentlemen... it's that whenever you try to select more than one *.lnk file, it errors out.

Try this Smoke_n, is there a way we can create a function that will copy multiple *.lnk files from one location to the next using FileGetShortcut and FileCreateShortcut?

Thanks.

  • Moderators
Posted

Is the conclusion that I can't copy multiple *.lnk files at once with this software? I copied and pasted your code, and I got the same error when I selected more than one *.lnk file.

I apperciate your help.

Well, I've tested the above code many times now, and it does in fact work for me on OS XP Pro SP2. I hadn't tested it in any other environment though.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Xcal, if you add a 1 to your flag, the same error will occur as well in your code. It's not that I don't understand how to handle these files gentlemen... it's that whenever you try to select more than one *.lnk file, it errors out.

Try this Smoke_n, is there a way we can create a function that will copy multiple *.lnk files from one location to the next using FileGetShortcut and FileCreateShortcut?

Thanks.

I don't get that error. Smoke_n's solution works fine for me, too.

  • Moderators
Posted

FileSelectFolder() + _FileListToArray() (or maybe even _FileListToArrayEx()) + FileCopy() should be fine.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

FileSelectFolder() + _FileListToArray() (or maybe even _FileListToArrayEx()) + FileCopy() should be fine.

Well, as if it wasn't obvious, I am a newb programmer... but I tried with the _filelisttoarray and I couldn't get anything to copy. However, I will just use what we already developed and go from there. I apperciate all the help.

  • Moderators
Posted

No, but most of the files even the ones that work have spaces in them.

Spaces sometimes require double quotes before and after the actual string.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
×
×
  • Create New...