Skip navigation
Currently Being Moderated

"Save as a copy" script

May 24, 2012 5:14 AM

Tags: #project #save_as_a_copy

Hi everyone

 

I`m looking for how to make "Save as a copy" script.

All variants that I ever met (scripting guide or examples from the internet), were based on copying existing file.

And they doesn`t suit.

 

Why "Save as a copy ?

 

Because you can save you file to different directory (for example dropbox),

and your original file with undo options will stay opened (unlike the "Increment and Save").

 
Replies
  • Currently Being Moderated
    May 31, 2012 2:27 AM   in reply to Alex Grey

    In CS 5.5 there is a menu command for Save a copy....?

    Leaves current scene open with your undo stack?

     
    |
    Mark as:
  • Currently Being Moderated
    May 31, 2012 8:53 AM   in reply to Alex Grey

    You can feed the command name into this....

    This is not 100 percent reliable, if you do a search here or aeenhancers, but does the job in most instances...

     

    function exectuteCommandID(theCommand){

                                            app.executeCommand(app.findMenuCommandId(theComma nd));

                                            }

     

     

    executeCommandID("Save A Copy or whatever is the menu command exactly.");

     
    |
    Mark as:
  • Currently Being Moderated
    May 31, 2012 12:59 PM   in reply to Alex Grey

    If you look at the scripting guide, you only have access to save() and saveWithDialog(). Therefore the code below works the same as the save as command.

    However then your current project is this new saved file. So no joy.

     

     

    var f = new File("C:/Users/Alan/Desktop/Noel Kealahan/copy.aep");

    app.project.save(f);

     

    You could lay out the functionality of your script like this.

    1.Save current project and store it''s path in a var.

    2.Execute save() to a custom path

    3.File open the project stored in the var.

     

    Of course the custom path would overwrite that file then each time.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 1, 2012 11:31 AM   in reply to Alex Grey

    Yep that would work... excuse syntax errors below.

    Keep and eye on URI notation too....

     

    if(app.project.file){

    save();

    var target = new File([path to dropbox etc])

    var thisFile = new File (app.project.name); // (of fsname - look it up)

    thisFile.copy(target);

    }

     

    I'm not sure if it would overwrite the copied file each time .

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2012 5:29 AM   in reply to Alex Grey

    That's great, oh yes I forgot the app.project.save();

    There is no need for the [ ] in var target = new File(["C:/Users/admin/Dropbox/copy.aep"])   also.

     

     

     

     

     

    if(app.project.file){

            app.project.save();

            var target = new File("C:/Users/Alan/Desktop/Noel Kealahan/copy.aep")

            var thisFile = new File (app.project.file.fsName); // (of fsname - look it up)

           

            if(target.exists){

                //put stuff in here to increment file name using regex, perhaps

                //or save the file elsewhere.

                }

            else{

            thisFile.copy(target);

            }

           

           

            alert(app.project.file.fsName)

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points