Jump to content

Recommended Posts

Posted

Sorry, I am new in AutoIt and English is not my first language... and thanks to all for trying to help...

I want to make a DirMove with @ComSpec and it will overwrite all dir and files with my code, but its doesn't work... can anyone help me solve it so that I can run it with progress bar...

$Sour = @DesktopDir & "\Xx"
$Dest = @DesktopDir & "\Zz"
Run(@ComSpec & ' /c for /r "' & $Sour & '" %i in (*) do move %i "' & $Dest & '"')

or anyone who has a code DirMove with Progress Bar can share it... ;)

Posted

You'll want

Enjoy Posted Image

How to use it...? I'm tried.. but get this message...

Line 1029 (File "D:USER_ACCESATUDesktopCopyCopy.au3"):

OnAutoItExitRegister('__CP_AutoItExit')

^ ERROR

Error: Unknown function name.

I am new in AutoIt and don't understand with overly complex code.... this my GUI..

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $Inbox1, $Inbox2
Operation()
Func Operation()
Local $Btn_1, $Btn_2, $Msg

GUICreate("Copy Files & Folders", 505, 300,  -1, -1, Default, $WS_EX_ACCEPTFILES)
    GUICtrlCreateLabel("Drag your file or folder you want to move into the 'From' input box, and" & @CRLF & _
"your target destination into the 'To' input box...", 20, 30)
    GUICtrlCreateLabel("From  :", 30, 88)
    $Inbox1 = GUICtrlCreateInput("", 70, 85, 340, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateLabel("To  :", 30, 113)
    $Inbox2 = GUICtrlCreateInput("", 70, 110, 340, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)

    $Radio1 = GUICtrlCreateRadio("Copy", 170, 265, 65, 20)
$Radio2 = GUICtrlCreateRadio("Move", 235, 265, 70, 20)
GUICtrlSetState($Radio1, $GUI_CHECKED)
    $Btn_1 = GUICtrlCreateButton("Start", 308, 260, 85, 25)
    $Btn_2 = GUICtrlCreateButton("Cancel", 400, 260, 85, 25)
GUISetState()
   While 1
        $Msg = GUIGetMsg()
        Select
  Case $Msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case $Msg = $Btn_1
   If GUICtrlRead($Radio1) = 1 Then
                Dir_Copy()
            Else
                Dir_Move()
            EndIf
  Case $Msg = $Btn_2
   Exit
        EndSelect
WEnd
EndFunc
Func Dir_Copy()
Local $From, $Dest
$From = GUICtrlRead($Inbox1)
$Dest = GUICtrlRead($Inbox2)
Dir_Copy_Start($From,$Dest)
MsgBox(0, "Process", "copying the files have been completed...")
Exit
EndFunc

Func Dir_Move()
Local $From, $Dest
$From = GUICtrlRead($Inbox1)
$Dest = GUICtrlRead($Inbox2)
Dir_Move_Start($From,$Dest)
MsgBox(0, "Process", "copying the files have been completed...")
Exit
EndFunc
Func Dir_Copy_Start($x,$y)
If FileExists($y) = 0 Then
  DirCreate($y)
EndIf
Run(@ComSpec & " /c " & 'xcopy "' & $x & '*.*" "' & $y & '*.*" /s/r/v/y',"")
EndFunc

Func Dir_Move_Start($FromFile,$Tofile);it will copy files with Yes, Yes to All, No and Cancel confirmation box with Windows progress bar...
    $winShell = ObjCreate("shell.application")
    $winShell.namespace($Tofile).CopyHere($FromFile)
EndFunc

how to change a code...

Func Dir_Copy_Start($x,$y)
If FileExists($y) = 0 Then
  DirCreate($y)
EndIf
Run(@ComSpec & " /c " & 'xcopy "' & $x & '*.*" "' & $y & '*.*" /s/r/v/y',"")
EndFunc

or

Func Dir_Move_Start($FromFile,$Tofile);it will copy files with Yes, Yes to All, No and Cancel confirmation box with Windows progress bar...
    $winShell = ObjCreate("shell.application")
    $winShell.namespace($Tofile).CopyHere($FromFile)
EndFunc

with that code for make file or dir move with progress bar working.... or else another code...

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
  • Recently Browsing   0 members

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