Overblog Suivre ce blog
Editer la page Administration Créer mon blog
/ / /

Ce script pemret de visualiser tous les évènements survenant dans l'utilisation de photoshop , comme ouvrir ou fermer un document, changer d'outil , etc...

Pour l'activer il suffit de le lancer "Fichier/Scripts/Parcourir".

Pour le désactiver,aler dans "Fichier/Scripts/Gestionnaire d'Evenements" et décocher la case "Activer...".  

 

/****************************************************
  EVENT VIEWER
 ****************************************************
 Just execute the script to install it for wanted events.
 BEWARE of PRINT : Bug in event manager
 ****************************************************
 30/05/2010 Habaki V1r02 : Add auto install
 02/05/2010 Habaki V1r01 : Creation
 ****************************************************/
var ScriptName = "Event Viewer, (c) Habaki 2010";
var Verbose = 1;

// Events to catch
//var EventStNames = new Array("select", "open");
var EventStNames = new Array("all");
var EventCharNames = new Array('ntfy');

var ScriptFilePath = $.fileName;

var sTc = function(v) { return(app.typeIDToCharID(app.stringIDToTypeID(v)));};
/*--------------------------------------------------*
 Num to String (enumeration value)
 *--------------------------------------------------*/
function NumSt(Num)
{
  var St = app.typeIDToStringID(Num);
  if (St) return("\"" + St + "\"");
  St = app.typeIDToCharID(Num);
  if (St) return("'" + St + "'");
  return(String(Num));
}
/*--------------------------------------------------*
 ID to String
 *--------------------------------------------------*/
function IDSt(ID)
{
  var St = app.typeIDToStringID(ID);
  if (St) return("\"" + St + "\"");
  return("'" + app.typeIDToCharID(ID) + "'");
}
/*--------------------------------------------------*
 Print Action Reference to string
 *--------------------------------------------------*/
function AR_PrintSt(AR, Margin)
{
  var St = Margin;
  var Form;
  var ValSt, FormSt, ValClass, ValClassc;
 
  AR.getName();
  Form = AR.getForm();
  ValClass = app.typeIDToStringID(AR.getDesiredClass());
  ValClassc = app.typeIDToCharID(AR.getDesiredClass());
 
  if (Form == ReferenceFormType.CLASSTYPE) {
    FormSt = "Class";
    ValSt = ValClass;
  }
  else
  if (Form == ReferenceFormType.ENUMERATED) {
    FormSt = "Enumerated";
    Type = AR.getEnumeratedType();
    Val  = AR.getEnumeratedValue();
    ValSt = "(Type=" + IDSt(Type)
          + ", Val=" + NumSt(Val)
          + ")";
  }
  else
  if (Form == ReferenceFormType.IDENTIFIER) {
    FormSt = "Identifier";
    ValSt  = IDSt(AR.getIdentifier());
  }
  else
  if (Form == ReferenceFormType.INDEX) {
    FormSt = "Index";
    ValSt  = String(AR.getIndex());
  }
  else
  if (Form == ReferenceFormType.NAME) {
    FormSt = "Name";
    ValSt = "\"" + AR.getName() + "\"";
  }
  else
  if (Form == ReferenceFormType.OFFSET) {
    FormSt = "Offset";
    ValSt = String(AR.getOffset());
  }
  else
  if (Form == ReferenceFormType.PROPERTY) {
    FormSt = "Property";
    ValSt = IDSt(AR.getProperty());
  }
  else {
    FormSt = "??";
    ValSt = "??";
  }
 
  St += "Class=" + ValClass
     //+ "('" + ValClassc + "')" // CharID
     + ", " + FormSt + "=" + ValSt
     ;
  return(St);
}
/*--------------------------------------------------*
 Print Descriptor to string
 *--------------------------------------------------*/
function DS_PrintSt(DS, Key, Margin)
{
  var Val;
  var TypeSt = "?";
  var ValSt = "?";
  var Type = DS.getType(Key);
 
  if (Type == DescValueType.ALIASTYPE) {
    TypeSt = "Path";
    ValSt = DS.getPath(Key);
  }
  else
  if (Type == DescValueType.BOOLEANTYPE) {
    TypeSt = "Boolean";
    ValSt = DS.getBoolean(Key);
  }
  else
  if (Type == DescValueType.CLASSTYPE) {
    TypeSt = "Class";
    Type = DS.getClass(Key);
    ValSt = IDSt(Type);
  }
  else
  if (Type == DescValueType.DOUBLETYPE) {
    TypeSt = "Double";
    ValSt = String(DS.getDouble(Key));
  }
  else
  if (Type == DescValueType.ENUMERATEDTYPE) {
    TypeSt = "Enumerated";
    Type = DS.getEnumerationType(Key);
    Val  = DS.getEnumerationValue(Key);
    ValSt = "Type=" + IDSt(Type)
          + ", Val=" + NumSt(Val)
          ;
  }
  else
  if (Type == DescValueType.INTEGERTYPE) {
    TypeSt = "Integer";
    ValSt = String(DS.getInteger(Key));
  }
  else
  if (Type == DescValueType.LISTTYPE) {
    TypeSt = "List";
    Val = DS.getList(Key);
    ValSt = "\r"
          + AL_PrintSt(Val, Margin + "    ")
          ;
  }
  else
  if (Type == DescValueType.OBJECTTYPE) {
    TypeSt = "Object";
    Type = DS.getObjectType(Key);
    Val = DS.getObjectValue(Key);
    ValSt = "Type=" + IDSt(Type) + ",\r"
          + AD_PrintSt(Val, Margin + "    ")
          ;
  }
  else
  if (Type == DescValueType.RAWTYPE) {
    TypeSt = "Raw";
    ValSt = DS.getData(Key);
    //ValSt = "Len="+ ValSt.length + ", Data={" + DS.getData(Key) + "}";
    ValSt = "Len="+ ValSt.length + ", Data={" + "..." + "}";
  }
  else
  if (Type == DescValueType.REFERENCETYPE) {
    TypeSt = "Reference";
    Val = DS.getReference(Key);
    ValSt = AR_PrintSt(Val, "");
  }
  else
  if (Type == DescValueType.STRINGTYPE) {
    TypeSt = "String";
    ValSt = "\"" + DS.getString(Key) + "\"";
  }
  else
  if (Type == DescValueType.UNITDOUBLE) {
    TypeSt = "UnitDouble";
    Type = DS.getUnitDoubleType(Key);
    ValSt = "Type=" + IDSt(Type)
          + ", Val=" + String(DS.getUnitDoubleValue(Key))
          ;
  }
  else {
    TypeSt = "Type";
    ValSt = DS.getType(Key);
  }
  return(TypeSt + "(" + ValSt + ")");
}
/*--------------------------------------------------*
 Print Action List to string
 *--------------------------------------------------*/
function AL_PrintSt(AL, Margin)
{
  var Key;
  var St = "";
 
  for (Key=0;Key < AL.count; Key++) {
    St += Margin + "[" + String(Key) + "]:"
        + DS_PrintSt(AL, Key, Margin)
        ;
    if (Key == AL.count-1) St += "\r";
    else                   St += ",\r"
  } // for
  St += Margin;
  return(St);
}
/*--------------------------------------------------*
 Print Action Descriptor to string
 *--------------------------------------------------*/
function AD_PrintSt(AD, Margin)
{
  var i;
  var St = "";
  var Key;
 
  for (i=0;i < AD.count; i++) {
    Key  = AD.getKey(i);
    St += Margin + "Key[" + String(i) + "]:" + IDSt(Key)
       + " = "
       + DS_PrintSt(AD, Key, Margin)
       ;
    if (i == AD.count-1) St += "\r";
    else                 St += ",\r"
  } // for
  St += Margin;
  return(St);
}
/*--------------------------------------------------*
   Parse an event
 arguments[0] : ActionDescriptor
 arguments[1] : Event typeID
 arguments[2..] : ?
 *--------------------------------------------------*/
try {
  if (arguments.length < 2) {
    //alert("arguments.length=" + arguments.length, ScriptName);
    alert("INSTALLATION", ScriptName);
    try{
      app.notifiers.removeAll;
      for (i=0;i < EventStNames.length; i++) {
        app.notifiers.add(sTc(EventStNames[i]), new File(ScriptFilePath));
      }
      for (i=0;i < EventCharNames.length; i++) {
        app.notifiers.add(EventCharNames[i], new File(ScriptFilePath));
      }
      app.notifiersEnabled = true;
    } catch (e) {}
    throw(0);
  }
 
  var AD        = arguments[0];
  var EventName = app.typeIDToStringID(arguments[1]);
  var St;
 
  St = EventName + " \r";
  St += AD_PrintSt(AD, "");
  // Other args
  for (i=2;i < arguments.length; i++){
    St += "Arg[" + String(i) + "]=" + String(arguments[i]);
  }
 
  if (Verbose) alert(St, ScriptName);
 
} catch(ex) {
  if (ex) alert(ex.message, ScriptName)
}
/*--------------------------------------------------*/

Partager cette page

Repost 0
Published by