Home Technical Talk

[Photoshop CS4] Scripting book?

polycounter lvl 14
Offline / Send Message
sama.van polycounter lvl 14
I found the 2 following documentations on the Adobe website about Javascript on Photoshop CS4 :

- http://www.adobe.com/devnet/photoshop/pdfs/photoshop_cs4_javascript_ref.pdf
- http://www.adobe.com/devnet/photoshop/pdfs/photoshop_cs4_scripting_guide.pdf


Number of page is ugly... Then I am really not ready to print it...

Does someone know if there is a book version for these PDF?
Already googled is but...

And if anyone knows another good reference book on JavaScript for Photoshop CS4, I could be interested too!

Replies

  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Don't these documents come with Photoshop as standard?

    Not sure about a book though... why not just use the PDF from the installed copy of Photoshop? That's what I do... surely a lot of paper is much less useful than something with a hyperlink index and search function? o_O
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    well thats just a reference, its when you need to read up particular detailed stuff. For starters stuff I would dig into some of their getting started chapters as they should have way less pages to begin with.

    Make also sure to check out the CS4 SWF panel integration as it lets you execute JS code from within a SWF panel without compiling or painlessly selecting a script from the menu in PS. With a mix of XML it could actually become quite a nice development way.
    There are 2 ways you could go here, one using the offical Adobe Configurator which is a AIR app that generates the SWF and the needed files for a designed panel in that app.
    cs4_10_10.jpg
    http://labs.adobe.com/technologies/configurator/

    Or by coding it using either Flash, Flex, FlexSDK or whatever can compile SWF files.
    See also their guide for extending Photoshop using SWF panels:
    http://www.adobe.com/products/photoshop/photoshop/pdfs/pscs4_swf_panels.pdf

    another link I just stumbled upon:
    http://scriptplayground.com/tutorials/as/Creating-Flash-Panels-for-Photoshop-using-Flash-CS4/


    There is also a Photoshop script forum somewhere that hosts plenty of usefull JS examples on how to do stuff Tech Artists usually want (normal mapping stuff, batch saving layers, ...). Just google for Photoshop scripting, should be in the higher ranks of the results.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    MoP : Paper book are always better when you want to stop computer and stay with your wife :) XD... Or when you wait in a Japanese hopsital several hours your turn, or if you prefer, when you go on Tokyo with bus travel of 10h! :D

    And this is also very usefull to add mark in a book for things you do not really need now but you know you will use it later! After that, you need to accept the Christmas Tree effect!!


    renderhjs : I am using JavaScript then there is not need to compile anything.
    Also Javascript can be attached to a hotkey.


    I just use the "Extended Script Toolkit" from Adobe and functions from Photoshop are already set in the application.
    Script I would like to do is first to make better my work time under Photoshop... I do not really have extra-ideas about new UI or extra tools.

    When working a *.js file, I just drag an drop it in Photoshop and it will test it. Very easy!


    Anyway!


    Just looking for some cool books with this paper technology!

    I already wrote down lot of very interesting functions from the the adobe documentation..
    But difficult to mark something in 294 pages PDF file... And the other one is about 87.
    Difficult to read on computer, sometime you do not remember when you was, because you do know it was at the end, beginning, etc...

    Meslcript documentation is better built! :D:D
  • Funky Bunnies
    Options
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    haha yeah MEL-script's documentation is pretty nice, I've found good documentation for extending Photoshop to be ridiculously rare so I'd be interested as well.

    I'm only using CS2 and CS3 so I'm not sure about the new CS4 stuff but aside from random blogs and sites that I'll come across I poke around the forums at PS-scripts.com whenever I run into a snag.
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    haha, print the pdf and use a highlighter? :) Most copy-shops will print that stuff for you, and bind it even!

    I've built a few extensions using Configurator, its really awesome. I haven't, nor am any good at JS, so i got nuthin there. My extent of what i've done is fixing the horrible Save Layers as... and Save Layer Comps As... scripts from adding _#### to everything, and appending other prefixes and suffixes.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    @ Funky Bunnies : WOW! PS-scripts.com and research function is pretty coooool!!! lot of good tips here! Thanks!

    @ moose : oh yeah that's right I will ask price for it.
    About Configuration tool it will come with time...
    But this is first a hotkey workflow to speed up things!


    I just done my first *.js script! this is very cool!!!


    Before :

    - I work with my Psd file.
    - I keep open the texture file too.
    - If I want to save the Psd work on the texture file I had to run an Action command doing that :
    to duplicate psd file,
    to hide UV group,
    to flat the picture,
    to sharp with some options.
    to copy all the document,
    to close
    to paste and merge on the texture file,
    to save and select the psd file.

    Using a 2048x2048 file in CS4 was sometime freezing 2 or 3s time to do the process...


    After with the script :

    - I work with my psd file
    - If I want to save the texture file, I simply launch the script and it will directly create the png file in the right directory will all options I want following my worflow :D


    Conclusion :
    - It save the 2048x2048 texture from the memory used by photoshop...
    - script is more fast than the Action commands.
    - sama.van is happy and will try to work large texture file on his laptop.


    Here is the demo : [ame]http://www.youtube.com/watch?v=K5S_Ca734_k[/ame]
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    Photoshop scripting is definitely what I need to complete my workflow!

    Now I will attach that to the Unity work project!!

    Small update here :

    [ame]http://www.youtube.com/watch?v=x4GvtsDsqGY[/ame]
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    That script looks awesome sama.van!

    You can also have an action record the execution of a script, so you could include it in your other action!

    I'd love to have an extension/panel that let you:
    - set your saving dir
    - had a single button press/hotkey to save all groups (diffuse, spec, normal, mask,etc)
    - could have it read the group names, for custom groups: #name, #diffuse, #spec, or #d, #s, etc
    - allow for individual saving of groups.
    - set a texture output size for each file
    - set file type/compression settings

    I have 8 actions i use regularly -
    Save Diffuse, Spec, Normal, Mask (standard 1:1 save)
    Save Multi-part Diffuse, Spec, Normal, Mask (1:n files - ie 4096x2048 for 2 tex, or 4096x4096 for 3-4).

    In each action, for each new file, i have to set up where it goes, the export size, or if i even want to resize, etc. For the multipart i have to set how big the quads are to crop & save.

    I'd love to be able to have this contained in a nice neat extension!
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    @ Mose : Thank you!

    Ok I will try to find a way for these cool options! good ideas!
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    Update!

    I did the following points :

    - could have it read the group names, for custom groups: #name, #diffuse, #spec, or #d, #s, etc
    ----> basically the texture type doesn't mind. I will read the group name and keep the first 4 letters for the file name.

    - allow for individual saving of groups.
    ----> this is the problem... script can only do that for yet :D

    - set a texture output size for each file
    ----> Yup, just add the size in the name of each of your groups.
    Keep it minds this is like an history and you do not need to edit it again if you open the psd file one more time, etc...

    - set file type/compression settings
    ----> you can also add it in the group name. currently png, tga and jpg.
    About the compression setting, this is a different kind of setting for each type.
    There are many different kind of file type. Then I do not know yet how to edit the parameters for each type...
    If you know a good parameter configuration for a type, I kind edit it in my code...
    I am open to ideas...

    [ame]http://www.youtube.com/watch?v=-C0JpTIBy3s[/ame]


    Currently WIP :

    - set your saving dir :
    ----> I am trying to find an easy way it will keep history when you will close the psd file...
    But I am not sure yet because the directory can change depending of the type of texture...
    anyway, on progress. Image the artist want all diffuse in a file and all normal map in another files...

    - had a single button press/hotkey to save all groups (diffuse, spec, normal, mask,etc)
    ----> It will simply work on a multi selection. If you select 2 group it will export 2 texture, 3 groups : 3 textures, etc...
    Problem is I do not success to quiry a mulit damn selection... wtf.... :D... I am on it...


    - For the multipart i have to set how big the quads are to crop & save.
    ----> yup! script will simply detect the current selection and export it in the same way of the group.
    Artist could prepare a layer as "Selection Layer" then if he want to export a part of the texture, he only need to use the "magic Wand Tools" and launch the script.



    For the Mask channel, this is a difficult part.
    I can save it in a RGB file in the same way than I did...
    But we often add it as alpha channel on the diffuse or else...
    hmm... I do not know yet really what could be the workflow yet...
    All texture I export are simple RGB file with not alpha channel....
    I need a little more time to think about it!
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    to clarify what i meant by a mask texture - routinely i'll use a texture as a mask, with each mask contained within a single texture in each channel - so a 24bit tga has 3 masks, one for each channel. Within your group, you can double click it and set its channel - so ill have 3 groups within a "Mask" group, each representing a channel in the RGB image:

    #Mask
    #R
    - layers
    #G
    - layers
    #B
    - layers

    It is not an alpha or an additional channel, but just another group to save :)

    Those new additions look cool! Awesome to see it working! Few comments, for future implementation and progress:

    defining the properties as the group name is cool, but i wouldnt necessarily want the file name to have all of those properties. For a final version, it would be nice to append the file based on the group name as a suffix, or to replace a suffix (if possible). For example:

    Your psd is named WallTexture_Master.psd. You need to save your 3 files of Diffuse, Specular, and Normal, however you want them named WallTexture_D.tga, WallTexture_S.tga, WallTexture_N.tga. My thought would be that the script could replace _Master with the _D, _S, _N, _M, etc - whatever the group was called. In this case, you'd name your groups either Diffuse, or D, Spec or S, Normal or N, etc. Maybe its as easy as just using the first letter, or defining somewhere in an options list to have it use 1-4 letters?

    I have used some exensions that allow you to set properties and keep their values between uses - i'm pretty sure its possible. For this, you could have it set a default directory, say D:\Art, and you'd provide in an input box the path relative to the default: \character\dude\textures would be at D:\Art\character\dude\textures on your harddrive.

    @ texture compression, i think rarely an artist would use multiple texture compressions with the same asset, but I'm not certain of that. Having a global setting to save all textures in seems acceptable, and not necessary to define individually, although the option is nice!

    @ sizes: this does vary from texture to texture, but i think should be flexible and easy to edit based on working files vs. final assets. Most of the time i'll work on textures at full res, then scale them down after the fact for the final res. Other times, ill work with them at their target res for speed.

    All in all this is looking awesome :) would you be interested in continuing development as an extension/custom panel for CS4? I would be willing to test and help out too!
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    I wrote a script like this for a studio I worked at before. I've been meaning to write a new improved version from scratch that I could share with everyone.

    Competition! :P

    Cool stuff sama.van
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    update!

    I changed a little bit the workflow :

    - Parameters are not in the group name anymore. (because with time the name could be very long if we add new parameters....)

    - The name you will give to your group will be added on the file name. (Psdname + _ + groupName)

    - Now all the parameters are in a special group the script will create or update at each export.

    - Remember this :
    Give a name to your group "(Diffuse", "diff" or "D")
    The first time you will launch the script, it will create sub-layer in the configuration group will the default parameter.
    Once the script create it a first time, you can edit the parameter from the layers when you want. Be careful with the syntax!

    New functionality :
    - Directory choice for each group you want to export (It saves it in the preference group).
    - Possibility to export a selection when you launch the script.
    - More pop-up windows helping you to understand what happened and what you just exported.

    [ame]http://www.youtube.com/watch?v=J6gB6O_wJCs[/ame]


    @moose : Finally it doesn't change anything, isn't it?
    You are saying there are 4 groups in your psd and would like to export them separately in a different files. Correct?


    - "WallTexture_Master.psd"
    > I think you should delete the _Master because I am not sure everybody will do that... If it was for a company and everybody follow the same work-flow this is easy to do it... but once the tools will be done it could be good to release it on internet!

    -"I would be willing to test and help out too! "
    I added you to my MSN today. You can try it out the tools in private if you want :)


    @sinistergfx : hehe, I am more learning and started 3 days ago... but yeah I can accept the challenge!
    Seriously, what the boring business with the index of layers and layersSet when you want to find a layer? We can't get it from the name directly?

    Also in CS4, there are no function to query the a multi-selection in the layers window?
    I am using the "app.activeDocument.activeLayer.name" but there is nothing for a multi-selection >_<... WTF.....
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    @sama.van: It's been a couple years since I wrote the original. So, it's going to be like learning all over again; we're in the same boat. :P
    I used the same layer names method to store the options, too. I had been thinking about trying to find a more elegant way to do it, but I've found I like the simplicity and user editable -ness of the solution.
Sign In or Register to comment.