Jump to content

I need to help


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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
Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...