Sign in to follow this  
Followers 0
ward2000

I need to help

21 posts in this topic

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

Share this post


Link to post
Share on other sites



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 Gude
How 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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by ward2000

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

Thank you !!!!

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by l3ill
1 person likes this

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I saw this too late ..... Thank you ... I'm going by experience

Edited by ward2000

Share this post


Link to post
Share on other sites

I'm sorry ... but the script deletes the folder ........... is not rename folder

Share this post


Link to post
Share on other sites

I'm sorry ... but the script does not work .... folder stays as is

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

#13 ·  Posted (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 by ward2000

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

HnUV3C.jpg

Share this post


Link to post
Share on other sites

5e91sA.jpg

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0