ward2000 Posted July 5, 2014 Posted July 5, 2014 Hello Can I re-naming the folder or file by the program I hope that I will be understood to type through an interpreter Google Thanks for the help
BrewManNH Posted July 5, 2014 Posted July 5, 2014 To rename a file use FileMove and DirMove for folders. IF that's not what you're looking for please try to explain a bit better, or post in your native language and we can figure it out from there. We understand that not everyone speaks English well, so no worries about whether you write it well enough. 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
ward2000 Posted July 5, 2014 Author Posted July 5, 2014 (edited) Thanks for interaction I want to do that if I have a folder named for example (ABC) It is located in the same folder the script and I want to re-name it to, for example, (DFG)How this can be done I think that this is different than moving the folder The research found this review '?do=embed' frameborder='0' data-embedContent>>But I did not understand the script Edited July 5, 2014 by ward2000
BrewManNH Posted July 5, 2014 Posted July 5, 2014 In AutoIt there's no command that does a rename, so you need to do a file or dirmove command to rename a file or folder. 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
l3ill Posted July 5, 2014 Posted July 5, 2014 (edited) Needed some practice.. Local $sFile = @ScriptDir & "\abc" ; your folder in the script directory If FileExists($sFile) = 1 And FileGetAttrib($sFile) = "D" Then ; this will see if the file is present and if it is a directory DirCopy($sFile, @ScriptDir & "\DFG", 1) ; if it is, the script will change its name to DFG ;----------------------------------------------------------------------------------------------------------------------------------------------------------- If FileExists(@ScriptDir & "\DFG") Then ; you can add this part to delete the original file once the second is succesfully created DirRemove($sFile, 1) EndIf ;----------------------------------------------------------------------------------------------------------------------------------------------------------- Else MsgBox(0, "Fail", "Either File does not exist or is not a Directory") EndIf Edited July 5, 2014 by l3ill Xandy 1 My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
ward2000 Posted July 10, 2014 Author Posted July 10, 2014 (edited) I saw this too late ..... Thank you ... I'm going by experience Edited July 10, 2014 by ward2000
ward2000 Posted July 10, 2014 Author Posted July 10, 2014 I'm sorry ... but the script deletes the folder ........... is not rename folder
mikell Posted July 10, 2014 Posted July 10, 2014 (edited) $before = @DesktopDir & "\ABC" $after = @DesktopDir & "\DFG" DirMove($before, $after ) an other way $before = @DesktopDir & "\ABC" $after = "DFG" RunWait(@ComSpec & ' /C REN "' & $before & '" "' & $after & '"', "", @SW_HIDE) Edited July 10, 2014 by mikell
ward2000 Posted July 10, 2014 Author Posted July 10, 2014 I'm sorry ... but the script does not work .... folder stays as is
ruelas05 Posted July 11, 2014 Posted July 11, 2014 if the folder is in the same directory, you can try something not very fancy, but it should work: ;script needs to be in the same directory as the directory/file you want to rename is send("ABC") ;this selects the folder sleep(2) ; you can change this depending of the number of folders/files in the current directory.same for the other Slepp commands . send("{F2}") ; enter the edit name mode sleep(2) send("DFG") ; change the name slepp(2) send("{ENTER}") ;accepts the new name. All this is basically following what you´d do manually. hope this helps
BrewManNH Posted July 11, 2014 Posted July 11, 2014 If the folder is in a protected area on Vista+ you may need to use #RequireAdmin in the script to get it to change the name. 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
ward2000 Posted July 12, 2014 Author Posted July 12, 2014 (edited) Thanks to all .. Unfortunately I can not change the name .. but I will try to find another way............ move the folder ..Once again ... Thank you for your cooperation Edited July 12, 2014 by ward2000
somdcomputerguy Posted July 12, 2014 Posted July 12, 2014 (edited) Are you changing the names of the directories that are defined in the above example scripts to the actual names of the directories which you want to process? Edited July 12, 2014 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
ward2000 Posted July 14, 2014 Author Posted July 14, 2014 I will explain to you exactly what I'm doing ... I've Arabization dll libraries for the AutoCAD program .. but I want to keep the program in English as well ... when I want to change the language of the program from English to Arabic or vice versa, use Lisp is running the script after it closes the program and then The script changed the names of folders (a folder files original name - en-US) change his name to any name but not (A) and change the name of the folder that has the files of Arab (en-US) and then the lisp run the program again and it will be in Arabic - - in the case of the contrary I have another script and cursing another that converts an English language program for Arab and volumes .... Englishman present in the program folder .. I've overlooked you please be understood, because I write about through an interpreter Google
l3ill Posted July 14, 2014 Posted July 14, 2014 Hi Again, try this code and see if you can get a simple folder create and "copy with name change". If you can get this working we can move on to more difficult tasks ;-) Local $sFile = @ScriptDir & "\abc" DirCreate($sFile) MsgBox(0, "Check", "Go to Script Directory and make sure you have Folder named 'abc' ") If FileExists($sFile) = 1 And FileGetAttrib($sFile) = "D" Then ; this will see if the file is present and if it is a directory DirCopy($sFile, @ScriptDir & "\DFG", 1) ; if it is, the script will change its name to DFG Else MsgBox(0, "Fail", "Either File does not exist or is not a Directory") EndIf My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
l3ill Posted July 18, 2014 Posted July 18, 2014 Nice Pic... and? do you have a folder ( at the point that window pops up ) named abc? heres mine My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
l3ill Posted July 19, 2014 Posted July 19, 2014 Wonderful ! so, with that little script you can: create a folder named "abc" Local $sFile = @ScriptDir & "\abc" DirCreate($sFile) MsgBox(0, "Check", "Go to Script Directory and make sure you have Folder named 'abc' ") after clicking on OK in the msgbox the script will: checks to see if file with name "abc" exists and if it is a folder If FileExists($sFile) = 1 And FileGetAttrib($sFile) = "D" Then ; this will see if the file is present and if it is a directory Then copies and changes the name of folder "abc " to "DFG" DirCopy($sFile, @ScriptDir & "\DFG", 1) ; if it is, the script will change its name to DFG So now you have the original folder - "abc and the copy of it renamed to "DFG" Make sense? My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
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