cdjphoenix Posted July 27, 2012 Share Posted July 27, 2012 I am pretty new to AuotIt and thought that I had a decent grasp on how to do stuff but I cannot get my script to work right no matter what I try. Basically what I am trying to accomplish is making a script that will copy all the User files, such as My Documents and Desktop, off an external HDD that has an old Windows install to the local drive that is running the current Windows Install. Here is what I have so far: #include <GUIConstants.au3> ;Dim $TargetDrive = InputBox("Target Drive", "Enter Target Drive Letter.", "", " M2") Dim $SourceDrive = InputBox("Source Drive", "Enter Source Drive Letter.", "", " M2") Dim $SourceUser = InputBox("Source User", "Enter Source User Name.", "") DirCopy($SourceDrive & "\users\" & $SourceUser & "\Desktop", @UserProfileDir & "\Desktop\", 1) DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Documents", @MyDocumentsDir, 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\Downloads", @UserProfileDir & "\Downloads\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\Favorites", @UserProfileDir & "\Favorites\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Music", @UserProfileDir & "\My Music\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Pictures", @UserProfileDir & "\My Pictures\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Videos", @UserProfileDir & "\My Videos\", 1) As it stands the folders with just one word such as Downloads and Desktop work just fine but the folders with two words such as My Pictures and My Documents fail. Any insight on what I am doing wrong would be greatly apreciated. Side Note: I know that some of the lines are commented out, I disabled them so I could test one working line of code vs one broken line. Thanks Link to comment Share on other sites More sharing options...
BrewManNH Posted July 27, 2012 Share Posted July 27, 2012 The "folders" that you see under the Users folder in Window 7 and Vista aren't actually named what they appear to be. Some of them are junction points and aren't really folders at all. My Documents actually redirects to Documents, My Pictures redirects to Pictures, if you right click one of them and go to Properties, you can see what their real names/locations are. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
cdjphoenix Posted July 27, 2012 Author Share Posted July 27, 2012 Thanks, That was the problem and it works wonderfully. Although, I'm not sure if I should be happy my coding was right or sad that it was something simple that I should of known lol. Thanks Again. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 27, 2012 Share Posted July 27, 2012 You aren't the only one to get bitten by this, it happens a lot because it's not well documented, for the average user, what is happening in the Users folder with all the folder names. You'll probably also see a "folder" called Documents and Settings on your C: drive which causes an error if you try and click on it, with no explanation why you can't access it. Also, if you delete one of these junction points, that is if you manage to be able to do it because it's not easy at all to do it, you will find that you just deleted something completely different from what you thought you were deleting much to your regret. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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