Rename a file

Rename a file

691
Advanced UserAdvanced User
691

    Mar 24, 2009#1

    Hi There
    I want to rename the active document by adding some text to the end of the filename.
    Often this text would be in the clipboard but maybe I would generate a popup to enter the text.
    Generating the popup to prompt for the text is the one thing I have managed.
    That proves that I have looked at the help!
    I have also looked through the set of scripting commands and see nothing obvious to help.
    Indeed there seems to be no menu based command.
    I see some possibility with the runTool command and other vaguely relevant commands are newFile and saveAs.
    Am I missing something here?
    I presume this is best done my scripting and not a macro? (Macros looked even less promising...)

    Thanks for any reply.

    6,686585
    Grand MasterGrand Master
    6,686585

      Mar 27, 2009#2

      Yes, File - Rename File is yet (UE v14.20.1.008) not available as script or macro command. So there is no other possibility then using a user tool. Save As is not good because it does not delete the original file and therefore is not a real replacement for a file rename operation.

      You would need to save and close the active file, create a new file where to insert

      "full path of just saved file" "new file name without path"

      select that string and run the tool which has the command line:

      ren %sel%

      Then you can close the temp file without saving it and open the file with the new name. Of course you don't get back with this method anything about success or failure of the rename done by Windows command ren. You would need to capture the output of the ren command and evaluate it with the script if you need to know also if the rename operation was successful.
      Best regards from an UC/UE/UES for Windows user from Austria