Skip to main content
Participant
April 17, 2011
Question

SaveAs when saving requires a plugin? Like DDS-files?

  • April 17, 2011
  • 2 replies
  • 1728 views

I have to ask is there a way to skip the save-options or just send in some default-object?

In Photoshop CS4 32-bit I have to save my files as DDS using the nVidia plugin (http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop) but I can't find anything like "DDSSaveOptions" to pass to SaveAs.

How is this usually handled when using plugins in scripts? Is it up to the devlopers of the plugin to give script-support or can you easily make a save-options object on your own?

This topic has been closed for replies.

2 replies

Gryty47Author
Participant
April 18, 2011

Reported error came from another line. Rewriting the ScriptListener-variable with a forward-slash to an underscore worked.

Muppet_Mark-QAl63s
Inspiring
April 17, 2011

Have you tried to see if you can record the 'save as' using scriptlistener plug-in?

Gryty47Author
Participant
April 18, 2011

I hadn't but I used it now and it was  great help. There's just an error now that's preventing the code from running in a script. Here's the code  the script-listener produced when I saved using the DDS-plugin:

// =======================================================

                     var idsave = charIDToTypeID( "save" );

                         var desc3 = new ActionDescriptor();

                         var idAs = charIDToTypeID( "As  " );

                             var desc4 = new ActionDescriptor();

                             var idbarF = charIDToTypeID( "barF" );

                             desc4.putBoolean( idbarF, true );

                             var idfdev = charIDToTypeID( "fdev" );

                             desc4.putDouble( idfdev, 3.000000 );

                             var idfbia = charIDToTypeID( "fbia" );

                             desc4.putDouble( idfbia, 0.000000 );

                             var idurad = charIDToTypeID( "urad" );

                             desc4.putDouble( idurad, 5.000000 );

                             var iduamo = charIDToTypeID( "uamo" );

                             desc4.putDouble( iduamo, 0.500000 );

                             var iduthr = charIDToTypeID( "uthr" );

                             desc4.putDouble( iduthr, 0.000000 );

                             var idxstf = charIDToTypeID( "xstf" );

                             desc4.putDouble( idxstf, 1.000000 );

                             var idxthf = charIDToTypeID( "xthf" );

                             desc4.putDouble( idxthf, 1.000000 );

                             var idqual = charIDToTypeID( "qual" );

                             desc4.putInteger( idqual, 71 );

                             var iderdi = charIDToTypeID( "erdi" );

                             desc4.putBoolean( iderdi, false );

                             var iderdw = charIDToTypeID( "erdw" );

                             desc4.putInteger( iderdw, 1 );

                             var idusfa = charIDToTypeID( "usfa" );

                             desc4.putBoolean( idusfa, false );

                             var idtxfm = charIDToTypeID( "txfm" );

                             desc4.putInteger( idtxfm, 3 );

                             var idweig = charIDToTypeID( "weig" );

                             desc4.putInteger( idweig, 0 );

                             var idtmty = charIDToTypeID( "tmty" );

                             desc4.putInteger( idtmty, 0 );

                             var idmmty = charIDToTypeID( "mmty" );

                             desc4.putInteger( idmmty, 32 );

                             var idsmip = charIDToTypeID( "smip" );

                             desc4.putInteger( idsmip, 0 );

                             var idbina = charIDToTypeID( "bina" );

                             desc4.putBoolean( idbina, false );

                             var idprem = charIDToTypeID( "prem" );

                             desc4.putBoolean( idprem, false );

                             var idfilm = charIDToTypeID( "film" );

                             desc4.putBoolean( idfilm, false );

                             var idalpb = charIDToTypeID( "alpb" );

                             desc4.putBoolean( idalpb, false );

                             var idbord = charIDToTypeID( "bord" );

                             desc4.putBoolean( idbord, false );

                             var idbrdr = charIDToTypeID( "brdr" );

                             desc4.putDouble( idbrdr, 0.000000 );

                             var idbrdg = charIDToTypeID( "brdg" );

                             desc4.putDouble( idbrdg, 0.000000 );

                             var idbrdb = charIDToTypeID( "brdb" );

                             desc4.putDouble( idbrdb, 0.000000 );

                             var idmmft = charIDToTypeID( "mmft" );

                             desc4.putInteger( idmmft, 2 );

                             var idfdcl = charIDToTypeID( "fdcl" );

                             desc4.putBoolean( idfdcl, false );

                             var idfdaf = charIDToTypeID( "fdaf" );

                             desc4.putBoolean( idfdaf, false );

                             var idftworl = charIDToTypeID( "f2rl" );

                             desc4.putDouble( idftworl, 0.500000 );

                             var idftwogl = charIDToTypeID( "f2gl" );

                             desc4.putDouble( idftwogl, 0.500000 );

                             var idftwobl = charIDToTypeID( "f2bl" );

                             desc4.putDouble( idftwobl, 0.500000 );

                             var idftwoal = charIDToTypeID( "f2al" );

                             desc4.putDouble( idftwoal, 0.500000 );

                             var idfddl = charIDToTypeID( "fddl" );

                             desc4.putInteger( idfddl, 0 );

                             var idfafm = charIDToTypeID( "fafm" );

                             desc4.putDouble( idfafm, 0.150000 );

                             var idbafh = charIDToTypeID( "bafh" );

                             desc4.putDouble( idbafh, 0.000000 );

                             var iddthc = charIDToTypeID( "dthc" );

                             desc4.putBoolean( iddthc, false );

                             var iddthzero = charIDToTypeID( "dth0" );

                             desc4.putBoolean( iddthzero, false );

                             var idsmth = charIDToTypeID( "smth" );

                             desc4.putInteger( idsmth, 0 );

                             var idfilg = charIDToTypeID( "filg" );

                             desc4.putDouble( idfilg, 2.200000 );

                             var idfieg = charIDToTypeID( "fieg" );

                             desc4.putBoolean( idfieg, false );

                             var idfilw = charIDToTypeID( "filw" );

                             desc4.putDouble( idfilw, 10.000000 );

                             var idover = charIDToTypeID( "over" );

                             desc4.putBoolean( idover, false );

                             var idfblr = charIDToTypeID( "fblr" );

                             desc4.putDouble( idfblr, 1.000000 );

                             var idnmcv = charIDToTypeID( "nmcv" );

                             desc4.putBoolean( idnmcv, false );

                             var idncnv = charIDToTypeID( "ncnv" );

                             desc4.putInteger( idncnv, 1009 );

                             var idnflt = charIDToTypeID( "nflt" );

                             desc4.putInteger( idnflt, 1040 );

                             var idnmal = charIDToTypeID( "nmal" );

                             desc4.putInteger( idnmal, 1034 );

                             var idnmbr = charIDToTypeID( "nmbr" );

                             desc4.putBoolean( idnmbr, false );

                             var idnmix = charIDToTypeID( "nmix" );

                             desc4.putBoolean( idnmix, false );

                             var idnmiy = charIDToTypeID( "nmiy" );

                             desc4.putBoolean( idnmiy, false );

                             var idnmiz = charIDToTypeID( "nmiz" );

                             desc4.putBoolean( idnmiz, false );

                             var idnmah = charIDToTypeID( "nmah" );

                             desc4.putBoolean( idnmah, false );

                             var idnswp = charIDToTypeID( "nswp" );

                             desc4.putBoolean( idnswp, false );

                             var idnmsc = charIDToTypeID( "nmsc" );

                             desc4.putDouble( idnmsc, 2.200000 );

                             var idnmnz = charIDToTypeID( "nmnz" );

                             desc4.putInteger( idnmnz, 0 );

                             var idusbi = charIDToTypeID( "usbi" );

                             desc4.putBoolean( idusbi, false );

                             var idlien = charIDToTypeID( "lien" );

                             desc4.putBoolean( idlien, false );

                             var idshdi = charIDToTypeID( "shdi" );

                             desc4.putBoolean( idshdi, false );

                             var idshfi = charIDToTypeID( "shfi" );

                             desc4.putBoolean( idshfi, false );

                             var idshmm = charIDToTypeID( "shmm" );

                             desc4.putBoolean( idshmm, true );

                             var idshan = charIDToTypeID( "shan" );

                             desc4.putBoolean( idshan, true );

                             var idclrc = charIDToTypeID( "clrc" );

                             desc4.putInteger( idclrc, 0 );

                             var idvdxone = charIDToTypeID( "vdx1" );

                             desc4.putBoolean( idvdxone, true );

                             var idvdxtwo = charIDToTypeID( "vdx2" );

                             desc4.putBoolean( idvdxtwo, true );

                             var idvdxthree = charIDToTypeID( "vdx3" );

                             desc4.putBoolean( idvdxthree, true );

                             var idvdxfive = charIDToTypeID( "vdx5" );

                             desc4.putBoolean( idvdxfive, true );

                             var idvfourfourfour = charIDToTypeID( "v444" );

                             desc4.putBoolean( idvfourfourfour, true );

                             var idvfivefivefive = charIDToTypeID( "v555" );

                             desc4.putBoolean( idvfivefivefive, true );

                             var idvfivesixfive = charIDToTypeID( "v565" );

                             desc4.putBoolean( idvfivesixfive, true );

                             var idveighteighteight = charIDToTypeID( "v888" );

                             desc4.putBoolean( idveighteighteight, true );

                             var idalph = charIDToTypeID( "alph" );

                             desc4.putBoolean( idalph, false );

                             var idusra = charIDToTypeID( "usra" );

                             desc4.putBoolean( idusra, false );

                             var idusfs = charIDToTypeID( "usfs" );

                             desc4.putInteger( idusfs, 0 );

                             var idprev = charIDToTypeID( "prev" );

                             desc4.putBoolean( idprev, false );

                             var idrdep = charIDToTypeID( "rdep" );

                             desc4.putInteger( idrdep, 3000 );

                             var idlomm = charIDToTypeID( "lomm" );

                             desc4.putBoolean( idlomm, false );

                             var idscar = charIDToTypeID( "scar" );

                             desc4.putDouble( idscar, 1.000000 );

                             var idscag = charIDToTypeID( "scag" );

                             desc4.putDouble( idscag, 1.000000 );

                             var idscab = charIDToTypeID( "scab" );

                             desc4.putDouble( idscab, 1.000000 );

                             var idscaa = charIDToTypeID( "scaa" );

                             desc4.putDouble( idscaa, 1.000000 );

                             var idbiar = charIDToTypeID( "biar" );

                             desc4.putDouble( idbiar, 0.000000 );

                             var idbiag = charIDToTypeID( "biag" );

                             desc4.putDouble( idbiag, 0.000000 );

                             var idbiab = charIDToTypeID( "biab" );

                             desc4.putDouble( idbiab, 0.000000 );

                             var idbiaa = charIDToTypeID( "biaa" );

                             desc4.putDouble( idbiaa, 0.000000 );

                             var idsiar = charIDToTypeID( "siar" );

                             desc4.putDouble( idsiar, 1.000000 );

                             var idsiag = charIDToTypeID( "siag" );

                             desc4.putDouble( idsiag, 1.000000 );

                             var idsiab = charIDToTypeID( "siab" );

                             desc4.putDouble( idsiab, 1.000000 );

                             var idsiaa = charIDToTypeID( "siaa" );

                             desc4.putDouble( idsiaa, 1.000000 );

                             var idbiir = charIDToTypeID( "biir" );

                             desc4.putDouble( idbiir, 0.000000 );

                             var idbiig = charIDToTypeID( "biig" );

                             desc4.putDouble( idbiig, 0.000000 );

                             var idbiib = charIDToTypeID( "biib" );

                             desc4.putDouble( idbiib, 0.000000 );

                             var idbiia = charIDToTypeID( "biia" );

                             desc4.putDouble( idbiia, 0.000000 );

                             var idoutw = charIDToTypeID( "outw" );

                             desc4.putBoolean( idoutw, false );

                             var idclcL = charIDToTypeID( "clcL" );

                             desc4.putBoolean( idclcL, true );

                        var idNVIDIADthreeD/DDS = stringIDToTypeID( "NVIDIA D3D/DDS"  );

                         desc3.putObject( idAs, idNVIDIADthreeD/DDS, desc4 );

                         var idIn = charIDToTypeID( "In  " );

                         desc3.putPath( idIn, new File( "C:\\images\\test.dds" ) );

                     executeAction( idsave, desc3, DialogModes.NO );

When I try to run it in a JSX-file I  get an alert "expected ;" on the line in bold. I originally  thought it was because of that forward-slash in the variable-name but  when I changed that to idNVIDIADthreeD_DDS and on the line below where  it's used I just got the message "Object does not have a constructor"  without a particular line.

That forward-slash is really confusing.  I've never seen it being used in JS-code before and I can't find anything  about it. In the CS4 JavaScript Ref at-least ActionDescriptor and executeAction  seem to be used to record and execute actions so the code seem right  enough. It's just that forward-slash I'm not getting.

SOLVED: That "Object does not have a constructor" came from another line. It seem to work to re-write that forward-slash to underscore. Still I'm a little interested just what it could mean though this question is answered. I'll see if I can give the correct answer to Muppet even-though I clicked helpful answer, otherwise thank you