0 Replies Latest reply on Aug 15, 2011 11:05 AM by DreamzGirl

    Solidfill and textkey properties of a textlayer

    DreamzGirl

      Hi all,

       

      I have written a script to extract all the properties of a layer and below is the code. I am having an issue with 2 similar text layers. If anyone could guide me then it would be great.

       

      Issue - I have 2 text layers in a PSD file. Both these layers have color white and they have same color overlay blending options and color used in this is also white. So visually you will not find any difference unless the text content of the layer. But when I want to read the color value using the script that is I am reading the solidfill property, I am getting different values for both these layers. These 2 layers have same values for all properties except the solid fill-color and textkey. I want to know how these can impact a layer and is there another property which is causing this.

       

      Layer 1
      ----------
      Text - "2"
      color - (255,255,255) which is white
      coloroverlay color - white
      solid fill - color - (48.00,48.00,48.00) which is grey
      Textkey - missing (layer does not have this key)

       

      Layer 2
      ----------
      Text - "6"
      color - (255,255,255) which is white
      coloroverlay color - white
      solid fill - color - (255,255,255) which is white
      Textkey - textKey - Txt (psObjectType) = {{textKey = 6 ^ paragraphStyleRange = ....... TOO HUGE TO BE INCLUDED

       


      Script
      ----------

       

      Function Main()


      Dim al As Photoshop.ArtLayer = psDoc.ActiveLayer
      ref = GetActionRef(al)
      LSD = GetActionDesc(ref)
      If (Not LSD Is Nothing) Then
      For i = 0 To LSD.Count - 1
      Dim k As Integer = LSD.GetKey(i) 'get the key at index
      LSDList = LSDList + tSID(k) + " - " + tCID(k) + " (" + LSD.GetType(k).ToString + ") = " + GetStyleValue(k, LSD).ToString +
      Next
      MessageBox.Show(LSDList)
      End If

       

      End Main

      ---------

       

      Public Function GetStyleValue(ByVal intStyleKey As Integer, ByVal AD As Photoshop.ActionDescriptor) As String

      Dim objVal As String = ""
      Dim key_type = AD.GetType(intStyleKey)

       

      Try
      If (key_type = Photoshop.PsDescValueType.psObjectType) Then
      Dim subAD As Photoshop.ActionDescriptor = AD.GetObjectValue(intStyleKey)
      If (tSID(intStyleKey) = "color") Then
      Dim dblRed As Double
      Dim dblGrain As Double
      Dim dblBlue As Double

       

       

      If (subAD.HasKey(sTID("red"))) Then
      dblRed = subAD.GetUnitDoubleValue(sTID("red"))
      End If
      If (subAD.HasKey(sTID("grain"))) Then
      dblGrain = subAD.GetUnitDoubleValue(sTID("grain"))
      End If
      If (subAD.HasKey(sTID("blue"))) Then
      dblBlue = subAD.GetUnitDoubleValue(sTID("blue"))
      End If
      'objVal(0) = "string"
      objVal = "(" + dblRed.ToString + "," + dblGrain.ToString + "," + dblBlue.ToString + ")"
      Else
      'objVal(0) = "hash"
      Dim hashTemp As Hashtable = GetAllEffects(subAD)
      Dim strEffects As String = ConvertHash2String(hashTemp)
      objVal = "{{" + strEffects + "}}"
      End If

       

      ElseIf (key_type = Photoshop.PsDescValueType.psEnumeratedType) Then
      objVal = "(" + tSID(AD.GetEnumerationType(intStyleKey)) + "," + tSID(AD.GetEnumerationValue(intStyleKey)) + ")"
      ElseIf (key_type = Photoshop.PsDescValueType.psStringType) Then
      objVal = AD.GetString(intStyleKey)

       

      ElseIf (key_type = Photoshop.PsDescValueType.psListType) Then
      Dim actionlistTemp As Photoshop.ActionList = AD.GetList(intStyleKey)
      Dim hashTemp As Hashtable = GetActionList(actionlistTemp)
      Dim strEffects As String = ConvertListItemHash2String(hashTemp)
      objVal = "[" + strEffects + "]"
      Else
      objVal = AD.GetUnitDoubleValue(intStyleKey)
      End If
      Catch ex As Exception
      DisplayText("Following exception occured : " + ex.Message + Environment.NewLine)
      End Try

       

      GetStyleValue = objVal
      End Function