🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #1923

Re: JS: Add HSB Layer & Adjust - How?!

#1923
From: Mick_Murphy
Date: Tue, 06 Jul 2004 21:13
62 lines
3641 bytes
Steve,

Consider the SL as your friend. It generates a lot of weird looking code but it's very easy once you get your eye in. Some sample VB.NET code below which I dug up which might make it easier if you've never used the SL. Look for the lines in your JS code equivalent to the ones I've commented 'hue, 'saturation, and 'lightness and substitute variables.

Sub HSLAdjustmentLayer(ByVal hue As Integer, ByVal saturation As Integer, ByVal lightness As Integer)

Dim appref As New Photoshop.Application
        Dim docRef As Photoshop.Document
        appref.DisplayDialogs = Photoshop.PsDialogModes.psDisplayNoDialogs

If (appref.Documents.Count > 0) Then
            Dim id7 As Integer
            id7 = appref.CharIDToTypeID("Mk ")
            Dim desc3 As Photoshop.ActionDescriptor
            desc3 = CreateObject("Photoshop.ActionDescriptor")
            Dim id8 As Integer
            id8 = appref.CharIDToTypeID("null")
            Dim ref1 As Photoshop.ActionReference
            ref1 = CreateObject("Photoshop.ActionReference")
            Dim id9 As Integer
            id9 = appref.CharIDToTypeID("AdjL")
            Call ref1.PutClass(id9)
            Call desc3.PutReference(id8, ref1)
            Dim id10 As Integer
            id10 = appref.CharIDToTypeID("Usng")
            Dim desc4 As Photoshop.ActionDescriptor
            desc4 = CreateObject("Photoshop.ActionDescriptor")
            Dim id11 As Integer
            id11 = appref.CharIDToTypeID("Type")
            Dim desc5 As Photoshop.ActionDescriptor
            desc5 = CreateObject("Photoshop.ActionDescriptor")
            Dim id12 As Integer
            id12 = appref.CharIDToTypeID("Clrz")
            Call desc5.PutBoolean(id12, False)
            Dim id13 As Integer
            id13 = appref.CharIDToTypeID("Adjs")
            Dim list1 As Photoshop.ActionList
            list1 = CreateObject("Photoshop.ActionList")
            Dim desc6 As Photoshop.ActionDescriptor
            desc6 = CreateObject("Photoshop.ActionDescriptor")
            Dim id14 As Integer
            id14 = appref.CharIDToTypeID("H ")
            Call desc6.PutInteger(id14, hue) 'hue
            Dim id15 As Integer
            id15 = appref.CharIDToTypeID("Strt")
            Call desc6.PutInteger(id15, saturation) 'saturation
            Dim id16 As Integer
            id16 = appref.CharIDToTypeID("Lght")
            Call desc6.PutInteger(id16, lightness) 'lightness
            Dim id17 As Integer
            id17 = appref.CharIDToTypeID("Hst2")
            Call list1.PutObject(id17, desc6)
            Call desc5.PutList(id13, list1)
            Dim id18 As Integer
            id18 = appref.CharIDToTypeID("HStr")
            Call desc4.PutObject(id11, id18, desc5)
            Dim id19 As Integer
            id19 = appref.CharIDToTypeID("AdjL")
            Call desc3.PutObject(id10, id19, desc4)
            Call appref.ExecuteAction(id7, desc3, appref.DisplayDialogs)
        End If
    End Sub
Technical Details
Message-ID: <3bb4ecd4.2@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <3bb4ecd4.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,c854f12a138334c3
X-Google-Attributes: gidf5839,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Mick_Murphy@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.photoshop.scripting
Subject: Re: JS: Add HSB Layer & Adjust - How?!
Message-ID: <3bb4ecd4.2@webx.la2eafNXanI>
Date: Tue, 6 Jul 2004 14:13:53 -0700
References: <3bb4ecd4.-1@webx.la2eafNXanI>
Lines: 69
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit