Jump to content

Problem with FileSelectFolder


yabune
 Share

Recommended Posts

Hi!

I'm unable to copy a dir when I use the FileSelectFolder.

For example:

;$path1 = FileSelectFolder("Choose parent folder", "", 1)
$path2 = "C:\New Folder"
;if $path1 == $path2 Then
;   MsgBox(1, "..", "ok")
;endif
DirCopy(@ScriptDir&"\ThisDir", $path1)

If I use $path2 and comment the FileSelectFolder, the files are copied.

But if I use $path1 (with a path equal to $path2) and uncomment the FileSelectFolder line, the files aren't copied..

Any guesses?

Am I doing something wrong?

Thanks!

Link to comment
Share on other sites

Try this one

;$path1 = FileSelectFolder("Choose parent folder", "", 1)
$path2 = "C:\New Folder"
;if $path1 == $path2 Then
;    MsgBox(1, "..", "ok")
;endif
$a = DirCopy(@ScriptDir&"\ThisDir", $path2)
If $a = 0 Then
    MsgBox(0, "Warning", "A error occured copying directory")
EndIf

and tell me if a error occurs. With me it does.

Link to comment
Share on other sites

Try this one

;$path1 = FileSelectFolder("Choose parent folder", "", 1)
$path2 = "C:\New Folder"
;if $path1 == $path2 Then
;    MsgBox(1, "..", "ok")
;endif
$a = DirCopy(@ScriptDir&"\ThisDir", $path2)
If $a = 0 Then
    MsgBox(0, "Warning", "A error occured copying directory")
EndIf

and tell me if a error occurs. With me it does.

if I use path1 and choose the folder "New Folder", I get an error too..

But with path2 it works ok...

Link to comment
Share on other sites

Hi!

I'm unable to copy a dir when I use the FileSelectFolder.

For example:

;$path1 = FileSelectFolder("Choose parent folder", "", 1)
$path2 = "C:\New Folder"
;if $path1 == $path2 Then
;   MsgBox(1, "..", "ok")
;endif
DirCopy(@ScriptDir&"\ThisDir", $path1)

If I use $path2 and comment the FileSelectFolder, the files are copied.

But if I use $path1 (with a path equal to $path2) and uncomment the FileSelectFolder line, the files aren't copied..

Any guesses?

Am I doing something wrong?

Thanks!

Try this:

$path1 = FileSelectFolder("Choose parent folder", "", 1)
Msgbox(0,"The folder you selected was:",$path1)
$path2 = "C:\New Folder"
Msgbox(0,"These should be equal:",'"' & $path1 & '" = "' &  $path2 & '"')
If $path1 = $path2 Then
    MsgBox(1, "..", "ok")
Endif
DirCopy(@ScriptDir&"\ThisDir", $path1)

In autoit If-Then and other statements similar to that can be in capitol letters(unlike C++ and such). In addition, when doing a string comparison, you want to use a single = sign and not a double ==. The reason for this is because a == means that the literal strings have to match and have the same case. A single quote means that the strings have to match but it isn't case sensitive. I think your problem might be that the strings didn't match in case.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

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...