Grof Posted June 27, 2019 Share Posted June 27, 2019 (edited) In the executable folder are two subfolder, 1 and 2. 1 contain some stuff, 2 is empty. I have written: Local $PORTABLEDIR1 = "1" Local $PORTABLEDIR2 = "2" FileCopy($PORTABLEDIR1 & "\*.*", $PORTABLEDIR2) Not works (does't copy). I have tryed also Local $PORTABLEDIR1 = @HomePath & "\1" Local $PORTABLEDIR2 = @HomePath & "\2" Where is the mismatch? Edited June 27, 2019 by Grof Link to comment Share on other sites More sharing options...
Grof Posted June 27, 2019 Author Share Posted June 27, 2019 (edited) Sorry. I have found the solution. Why if I have a folder in exe path, I cannot use @HomePath to refeer it? Edited June 27, 2019 by Grof Link to comment Share on other sites More sharing options...
Sidley Posted June 27, 2019 Share Posted June 27, 2019 (edited) Why not use DirCopy? @ScriptDir will refer to the directory the script is called from. Edited June 27, 2019 by Sidley Extra info Earthshine 1 Link to comment Share on other sites More sharing options...
TheXman Posted June 27, 2019 Share Posted June 27, 2019 21 minutes ago, Grof said: Why if I have a folder in exe path, I cannot use @HomePath to refeer it? The short answer is because it would be the wrong macro. A longer answer is because @HomePath resolves to the same location as the %HOMEPATH% environment variable. So unless your script/exe is in the %HOMEPATH% folder, using that macro is WRONG. If you would have spent a little more time in the Help file as others have suggested, you may have come across another macro named @ScriptDir which, as it is named, refers to the folder in which the script/exe is running. Earthshine 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Skysnake Posted June 27, 2019 Share Posted June 27, 2019 @TheXman is right. Check out the differences between @scriptdir @workingdir And the Macro Reference in the Help File Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Grof Posted June 27, 2019 Author Share Posted June 27, 2019 "Why not use DirCopy? ". I'm translating a NSIS algorithm, and because I'm learning, I'm trying to be closest to the original. " If you would have spent a little more time in the Help file". I have spent many time in the help file, but many things I haven't understood, many I' have forgotten, and don't forget I'm here only from 48 hours! Anyway I've translated ALL the code except the registry routine. Few minutes and I'll begin to write post about it! (And this wil be very hard, so get ready!!!). Link to comment Share on other sites More sharing options...
Skysnake Posted June 27, 2019 Share Posted June 27, 2019 DirCopy is a command. It tells AutoIt to do something. @WorkingDir is a macro, a shortcut to tell AutoIt where to get the folder These are not opposites, they are complementary. ; DirCopy ( "source dir", "dest dir" [, flag = 0] ) Consolewrite("@scriptdir "& @scriptdir&@CRLF) Consolewrite("@workingdir "& @workingdir&@CRLF) DirCopy(@scriptdir &"\*", @workingdir, 0) ; note that if the two macros have the same value, then nothing will happen :) Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Grof Posted June 27, 2019 Author Share Posted June 27, 2019 Thanks. Work fine. 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