Assistor PS analysis

 WeChat screenshot _20190806163246.png

Assistor PS:Save Your Valuable Time (save your precious time)

First look Assistor PS makes me feel amazing. It doesn't need to exist in the form of plug-ins, it can read layers, and annotate, cut, distance calculation and so on a series of black technology functions for each layer. So Anne couldn't help analyzing it.

 WeChat screenshot _20190806163744.png

The interface is very beautiful, and then there are a few buttons, originally wanted to directly find the button under the event, found not too easy to find, so changed a train of thought, find the hotkey corresponding events.

Decompile the following code

 GlobalHotKey.Register (hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D1).Pressed = OnHotKeyPressed; 
GlobalHotKey.Register (hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D2) = =.Pressed; = (f);

Then find the callback event.

 Switch (e.Key) 
{
default:
return; 
case GlobalHotKey.Keys.D1:
Tool.ExecutePosition (); 
break; 
case GlobalHotKey.Keys.D2:
Tool.ExecuteSize (;); 
break; 
case GlobalHotKey.Keys.D3:
Tool.ExecuteDistance (); 
break;; (E);; (E); "("); ";"; "("); "("); "

It is found that the author encapsulates some operations to view the Tool class.

 Public void ExecutePosition () 
{
this.AppendLog (LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Position, string.Empty, string.Empty); 
this. (ScriptProvider.Execute (string.Empty, V ())); (2), (1), ((1), (2), (1), ((2), (1), ((), ()); (2), (1, (2), (2), ((), (), ((), ()); (2); ( IstorLogType.LayerDescriptor_GuideBox, string.Empty, string.Empty); 
this. (ScriptProvider.Execute (ScriptMethodType.GuideBox, this. ())); 
}
public void ExecuteSnips () 
{
this.AppendLog (ExecuteSnips, x, P, R, d); (((x), ());}

Then there is a ScriptProvider, which contains some relatively good writing processes. In general, you can judge the type of your execution by ScriptMethodType, and then execute the JSX script of Photoshop.

ScriptMethodType type

 Public enum ScriptMethodType
{
Position, 
Size, 
Text, 
Distance, 
GuideBox, 
Snips, 
Description, 
Document, 
Guides, 
GuidesHCenter,

JSX script

  1. JSX.WIT.Photoshop.Application.jsx

  2. JSX.WIT.Photoshop.Common.jsx

  3. JSX.WIT.Photoshop.Document.jsx

  4. JSX.WIT.Photoshop.DrawingContext.jsx

  5. JSX.WIT.Photoshop.JSON.jsx

  6. JSX.WIT.Photoshop.Parameter.jsx

  7. JSX.WIT.Photoshop.Parser.jsx

  8. JSX.WIT.Photoshop.Polygons.jsx

  9. JSX.WIT.Photoshop.Processor.jsx

  10. JSX.WIT.Photoshop.Script.Capture.jsx

  11. JSX.WIT.Photoshop.Script.Distance.jsx

  12. JSX.WIT.Photoshop.Script.Export.jsx

  13. JSX.WIT.Photoshop.Script.GuideBox.jsx

  14. JSX.WIT.Photoshop.Script.Guides.jsx

  15. JSX.WIT.Photoshop.Script.GuidesClear.jsx

  16. JSX.WIT.Photoshop.Script.GuidesHCenter.jsx

  17. JSX.WIT.Photoshop.Script.GuidesVCenter.jsx

  18. JSX.WIT.Photoshop.Script.jsx

  19. JSX.WIT.Photoshop.Script.Position.jsx

  20. JSX.WIT.Photoshop.Script.Rounder.jsx

  21. JSX.WIT.Photoshop.Script.Size.jsx

  22. JSX.WIT.Photoshop.Script.Snips.jsx

  23. JSX.WIT.Photoshop.Script.Text.jsx

  24. JSX.WIT.Photoshop.Script.Tiler.jsx

You can see that the name is consistent with the ScriptMethodType custom type.

Part script source code

 function Photoshop() {
    
    
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putProperty(typeID("Prpr"), typeID("PbkO"));
    ref.putEnumerated(typeID("capp"), typeID("Ordn"), typeID("Trgt"));
    desc.putReference(typeID("null"), ref );
    
    var pdesc = new ActionDescriptor();
    pdesc.putEnumerated(typeID("performance"), typeID("performance"), typeID("accelerated"));    
    desc.putObject(typeID("T   "), typeID("PbkO"), pdesc );
    executeAction(typeID("setd"), desc, DialogModes.NO);
    
}
Photoshop.prototype.SetPanelVisibility = function(panelName, visible)
{
    try {
        var desc = new ActionDescriptor();
        var ref = new ActionReference(); 
        ref.putName( stringIDToTypeID( "classPanel" ), panelName ); 
        desc.putReference( charIDToTypeID( "null" ), ref ); 
        executeAction( stringIDToTypeID( visible ? "show" : "hide"), desc, DialogModes.NO );  
    }
    catch(ex)
    {
    }
        
 
}
Photoshop.prototype.SetLayersPanelVisibil 
}
Photoshop.prototype.GetActiveDocument = function (()) {
return new Document ({
return, new ());} (} (}); (2) = (()) (=); ("(") ");" ("" ")"; "(" "")); "(" "") ";" ("" ")" ("(")), "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" "")), "(" "")), "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(" ")", "(") "ity = function (visible) 
{
this.SetPanelVisibility ('panelid.static.layers', visible); Nce.putIdentifier (typeID ("Dcmn"), documentId); 
documentDescriptor.putReference (typeID ("null"), documentReference); 
executeAction (typeID ("SLCT"), 
executeAction);}; {} = (());}; {}; (=); (=); {};};



Assistor PS analysis


If there is no special explanation, the site will be original. Http://www.iwonmo.com/archives/1586.html )

Label: behavior analysis

Add new comments