Jump to content

Just a little help if you could


Recommended Posts

Ok here is the one that JdeB just did . I zip it up so you could look at it in a file .it is a au3 file

http://12.22.230.41/MicroTech/Hosted/Files-D/backup3.zip

Right after I pick the file to copy i get this error .

---------------------------

AutoIt Error

---------------------------

Line 6  (File "C:\Documents and Settings\bob\My Documents\backup3.au3"):

$folder = FileSelectFolder("Choose a directory to backup to", @MyDocumentsDir)

$folder = ^ ERROR

Error: Incorrect number of parameters in function call.

---------------------------

OK 

---------------------------

Edited by bobheart
Link to comment
Share on other sites

Try this.

$message = "Hold down Ctrl or Shift to choose multiple files."
$files = FileOpenDialog($message, "C:\", "files (*.*)", 1 + 4 )
If @error Then Exit
MsgBox(0,"","You chose " & $files & ".")
$list = StringSplit($files, "|")
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
    MsgBox(4096,"","Backup cancelled.")
Else
    MsgBox(4096,"","You chose " & $folder)
EndIf
For $i = 2 to $list[0]
    FileCopy($list[1] & "\" & $list[$i], $folder & "\" & $list[$i], 1)
Next
Link to comment
Share on other sites

  • Developers

Ok here is the one that  JdeB just did . I zip it up so you could look at it in a file .it is a au3 file

http://12.22.230.41/MicroTech/Hosted/Files-D/backup3.zip

Right after I pick the file to copy i get this error .

<{POST_SNAPBACK}>

Runs fine with 3.0.102 and the latest build of 3.0.103....

What version are you running ?

:ph34r:

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

3, 0, 102, 0 I just tried it again with no errors but no copy .

$message = "Hold down Ctrl or Shift to choose multiple files."
$files = FileOpenDialog($message, "C:\", "files (*.*)", 1 + 4 )
If @error Then Exit
MsgBox(0,"","You chose " & $files & ".")
$list = StringSplit($files, "|")
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
    MsgBox(4096,"","Backup cancelled.")
Else
    MsgBox(4096,"","You chose " & $folder)
EndIf
For $i = 2 to $list[0]
    FileCopy($list[1] & "\" & $list[$i], $folder & "\" & $list[$i], 1)
Next
Link to comment
Share on other sites

3, 0, 102, 0  I just tried it again with no errors but no copy .

$message = "Hold down Ctrl or Shift to choose multiple files."
$files = FileOpenDialog($message, "C:\", "files (*.*)", 1 + 4 )
If @error Then Exit
MsgBox(0,"","You chose " & $files & ".")
$list = StringSplit($files, "|")
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
    MsgBox(4096,"","Backup cancelled.")
Else
    MsgBox(4096,"","You chose " & $folder)
EndIf
For $i = 2 to $list[0]
    FileCopy($list[1] & "\" & $list[$i], $folder & "\" & $list[$i], 1)
Next

<{POST_SNAPBACK}>

Really strange. The code works perfect for me.

After you choose the files and folder...

Can you try to open the folder in explorer and press F5...

And which Windows version are you using?

Edited by SlimShady
Link to comment
Share on other sites

this script corrects the problem... it now copies single files, and multiple. give this a try bobheart :ph34r:

$message = "Hold down Ctrl or Shift to choose multiple files."
$files = FileOpenDialog($message, "C:\", "files (*.*)", 1 + 4 )
If @error Then Exit
MsgBox(0,"","You chose " & $files & ".")
$result = StringInStr($files, "|")
if $result = 0 then
Call ("single")
else
Call ("multipes")
endif
Func single()
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
MsgBox(4096,"","Backup cancelled.")
Else
MsgBox(4096,"","You chose " & $folder)
EndIf
FileCopy($files, $folder, 1)
Exit 0
EndFunc
Func multipes()
$list = StringSplit($files, "|")
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
MsgBox(4096,"","Backup cancelled.")
Else
MsgBox(4096,"","You chose " & $folder)
EndIf
For $i = 2 to $list[0]
FileCopy($list[1] & "\" & $list[$i], $folder & "\" & $list[$i], 1)
Next
Exit 0
EndFunc
Link to comment
Share on other sites

(I had this post ready when the forum went down)

SlimShady i just tried your code, it copies multiple files just not single ones(one at a time)..... i am running windows 2000 an when coping from source folder was destopt to destination of my doctuments....

<{POST_SNAPBACK}>

Now it works when you select one file and when you select multiple files.

$message = "Hold down Ctrl or Shift to choose multiple files."
$files = FileOpenDialog($message, "C:\", "files (*.*)", 1 + 4 )
If @error Then Exit
MsgBox(0,"","You chose " & $files & ".")
$folder = FileSelectFolder("Choose a directory to backup to", "", 0)
If @error Then
    MsgBox(4096,"","Backup cancelled.")
Else
    MsgBox(4096,"","You chose " & $folder)
EndIf

If StringInStr($files, "|") >= 1 Then
    $list = StringSplit($files, "|")
    For $i = 2 to $list[0]
        FileCopy($list[1] & "\" & $list[$i], $folder & "\" & $list[$i], 1)
    Next
Else
   FileCopy($files, $folder & "\", 1)
EndIf
Link to comment
Share on other sites

How could you set it up so you could right click on a folder and use part of the program to copy/move that folder to some other drive etc ?

This would be really nice for me as I download a lot of zipfiles so when I unzip them I could move the folders to a drive to keep safe .

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