Search code examples
extendscriptphotoshop-script

The parameters for the command "Open" are not currently valid. (Was Not The One Who Made The Script)


So, I'll try to make this as short as I can with providing the needed information, so my sentences might be a bit short. I downloaded a script to make a custom gamecover 3D. I couldn't run the script, because I didn't have photoshop (I had elements, but extendscript couldn't detect it). So I downloaded Photoshop CS2. Whenever I try to run the script I get the error: "The parameters for command 'Open' are not currently valid. I really want to run this script, so if you could help then I would be very much grateful.

NOTE: I came here because the script was made by a guy on NeoGaf, and I wouldn't be able to message him, because apparently NeoGaf is an exclusive site to join. I googled this so much, but to no avail. So, again, if you could help me, I would very much appreciate it.

EDIT: First 30 lines of code:

function createFolder( folderObj ){
    if( !folderObj.parent.exists ) createFolder( folderObj.parent );
    if( !folderObj.exists ) folderObj.create();
};

#target photoshop

app.bringToFront();
var tgtwdh=prompt("Please enter the target width in pixels for the output files:",800,"Specify Output Size");
var tgtprc = (tgtwdh / 1759) * 100;

// =======================================================
var idOpn = charIDToTypeID( "Opn " );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var myPath = File($.fileName).parent.fsName;
desc2.putPath( idnull, new  File( myPath + "/PC_3DBoxTemplate.psd" ) ); // Template file name
executeAction( idOpn, desc2, DialogModes.NO );

createFolder ( new Folder (myPath + "/Export") ); // Create Export Folder if Not Exist

// LOOP THROUGH DIRECTORY
// A hard coded path to a directory 'mac style'
var processFolder = new Folder ( myPath );
// Use folder object get files function with mask 'a reg ex'
var fileList = processFolder.getFiles(/\.(jpg|jpeg|png)$/i);
// Loop through files
for (var i = 0; i < fileList.length; i++) {
 // Only process the returned file objects
 // The filter 'should' have missed out any folder objects 

Solution

  • This is a blind get around but this should start the script:

    It's looking for a file called "PC_3DBoxTemplate.psd" so I suggest putting it in in somewhere like c:\temp. Edit the script accordingly. Change

    var myPath = File($.fileName).parent.fsName;
    desc2.putPath( idnull, new  File( myPath + "\PC_3DBoxTemplate.psd" ) ); // Template file name
    

    executeAction( idOpn, desc2, DialogModes.NO );

    to

    var myPath = "C:\\temp";
    desc2.putPath( idnull, new  File( myPath + "\\PC_3DBoxTemplate.psd" ) ); // Template file name
    

    executeAction( idOpn, desc2, DialogModes.NO );

    Not the escape slashes. That should at least open the template file.