ESATU Posted May 22, 2012 Share Posted May 22, 2012 I always use my GUI with drop target to make an easier copy from file or folder with filecopy process... but the problem is... how to create destination folder name, same as source folder name.. this my GUI... expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Local $Msg, $Box_1, $Box_2 Operation() Func Operation() GUICreate("Copy File & Folder", 500, 150, -1,-1, Default, $WS_EX_ACCEPTFILES) GUICtrlCreateLabel("Copy Files and Folders...", 15, 15, 470, 40) GUICtrlCreateLabel("From :", 20, 40, 53, 15) $Box_1 = GUICtrlCreateInput("", 55, 35, 425, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("To :", 20, 65, 53, 15) $Box_2 = GUICtrlCreateInput("", 55, 60, 425, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Bttn1 = GUICtrlCreateButton("Start", 315, 85, 80, 30) $Bttn2 = GUICtrlCreateButton("Close", 400, 85, 80, 30) GUISetState() While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE ExitLoop EndSelect Select Case $Msg = $Bttn1 If File_Copy() Then MsgBox(0, "Success", "File was copied") Else MsgBox(0, "Error", "File was not copied") EndIf Case $Msg = $Bttn2 Exit EndSelect WEnd EndFunc Func File_Copy() $From = GUICtrlRead($Box_1) $Dest = GUICtrlRead($Box_2) If Not FileExists($From) Then Return 0 EndIf If Not FileExists($Dest) Then Return 0 EndIf If Not StringInStr(FileGetAttrib($Dest), "D", 1) Then Return 0 EndIf If FileCopy($From, $Dest, 9) Then Return 1 Else Return 0 EndIf EndFunc example... if I drop.. From = C:\Pictures\June22 Dest = D:\My File\All Pictures I want it always to be like this D:\My File\All Pictures\June22, although it is not displayed in the drop input box.. want it to create destination folder name, same as source folder name... Sorry, I am new in AutoIt and English is not my first language... thanks to all for helping... Link to comment Share on other sites More sharing options...
PhoenixXL Posted May 22, 2012 Share Posted May 22, 2012 (edited) Here We Go First Input is 'From' Second Input is 'TO' Code:expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $file, $btn, $msg,$sInput Example() Func Example() GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateInput("", 10, 5, 300, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $sInput=GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files GUICtrlSetState(-1, $GUI_DROPACCEPTED) $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn If _FileCopy() Then Return MsgBox(64,"Information","SuccessFull :)") Return MsgBox(16,"Information","Failure..... :(") ExitLoop EndSelect WEnd EndFunc ;==>Example Func _FileCopy() Local $sFile=GUICtrlRead($file) Local $sTo=GUICtrlRead($sInput) If Not StringInStr(FileGetAttrib($sTo),'D',2) Then Local $sSplit=StringSplit($sTo,'',1) $sTo= $sSplit[$sSplit[0]-1] EndIf If Not FileExists($sFile) Then Return 0 If StringRight($sFile,1)='' Then StringTrimRight($sFile,1) Local $sDirectory=StringSplit($sFile,'',1) If StringInStr(FileGetAttrib($sFile),'D',2) Then $sDirectory=$sDirectory[$sDirectory[0]] Else $sDirectory=$sDirectory[$sDirectory[0]-1] EndIf DirCreate($sTo&''&$sDirectory) GUIDelete() Return FileCopy($sFile,$sTo&''&$sDirectory,1) EndFunc Thumbs Up If it Helped Regards Phoenix XL Edited May 22, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
ESATU Posted May 22, 2012 Author Share Posted May 22, 2012 Here We GoFirst Input is 'From'Second Input is 'TO'Wow..! it's great.... Yes..!!! this is what I want.....Thanks..! Phoenix XL.... :) Link to comment Share on other sites More sharing options...
PhoenixXL Posted May 23, 2012 Share Posted May 23, 2012 your welcome My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Mechaflash Posted July 5, 2012 Share Posted July 5, 2012 HI how do i copy from Appdata/local/Adobeto Appdata/Roaming/ResourcesTried everything but it wont copyit wont even make a copy in the same folder like Appdata/local/Adobe - CopyTried creating a directory like above and tried copying the contents to the new folder but nothingPlease helpHijacking is illegal in most countries You should make your own thread on your problem. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now