Jump to content

Objects only accepting 1st parameter arguments?


Recommended Posts

  • Moderators

I was working on another project not related to the example script below, when I ran across an issue using FO/FOF constants and CopyFile.

Searching the forum I found a couple of examples that used both FOF and CopyFile:

http://www.autoitscript.com/forum/index.ph...st&p=471594

That being based on Jos's:

http://www.autoitscript.com/forum/index.ph...st&p=186168

I just need to know if I'm losing my mind, or if the 2nd parameter for CopyFile is not doing its job here and it possibly being a bug.

I used this script below to show the issue of the 2nd parameter not working, with $FOF_RESPOND_YES, you should not get a confirmation diealog to overwrite anything on the 2nd pass of _FileCopy()

$Source = "FooBar"
$Dest = "BarFoo" ;-)

For $i = 0 To 9
    $dummy = FileOpen(@ScriptDir & "\" & $Source & "\" & $i & ".txt", 2)
    FileWriteLine($dummy, $i)
    FileClose($dummy)
    For $k = 0 To 999
        $dummy = FileOpen(@ScriptDir & "\" & $Source & "\" & $i & "\" & $i & "-" & $k & ".txt", 10)
        FileWriteLine($dummy, $i & $k)
        FileClose($dummy)
    Next
Next

MsgBox(64, "1st copy", "Should go smooth, we didn't ask for a progress, but lets assume it's by default.")
_FileCopy(@ScriptDir & "\" & $Source & "\*.*", @ScriptDir & "\" & $Dest & "\")
MsgBox(64, "Info", "2nd copy, with $FOF_ you aren't supposed to get a confirmation dialog.")
_FileCopy(@ScriptDir & "\" & $Source & "\*.*", @ScriptDir & "\" & $Dest & "\")

Func _FileCopy($fromFile, $tofile)
    If FileExists($tofile) = 0 Then DirCreate($tofile)
    Local $FOF_RESPOND_YES = 16
    Local $FOF_SIMPLEPROGRESS = 256
    $winShell = ObjCreate("shell.application")  
    $winShell.namespace($tofile).CopyHere($fromFile, $FOF_RESPOND_YES)
EndFunc   ;==>_FileCopy

This was tested on:

XP Pro SP2 32bit

XP Pro SP3 64bit

XP Pro SP3 32bit

Vista Ultimate 32bit

AutoIt Versions:

3.2.10

3.2.11.1

3.2.12

Edit:

Just for the record, I'm not looking for a DLLCall alternative, I'm sure I could come up with something, I am just looking for confirmation on parameter(s) not accepting/invoking the commands. Unless you have a fix for the above specifically (parameters), please don't post alternative Non-COM methods.

Edited by SmOke_N

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.

Link to comment
Share on other sites

  • Developers

I remember something about having this issue but only when using WildCards as Source/Target filename.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

I remember something about having this issue but only when using WildCards as Source/Target filename.

Jos

Thanks Jos, ... truth be known, I didn't even notice the wildcards (that's what being up to late does I suppose).

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...