[置顶] 一些网站

PHP

PhpBug:https://bugs.php.net/

Zend Framework:https://www.phpfans.net/manu/ZF/

JavaScript

JavaScript图表:https://echarts.baidu.com/examples/

mescroll 下拉控件:http://www.mescroll.com/

Promises:http://wiki.commonjs.org/wiki/Promises

Android

Apk在线反编译:http://www.javadecompilers.com/apk/

Adb:http://adbshell.com/downloads

AI

TensorFlow 国内:http://www.tensorfly.cn/tfdoc/get_started/introduction.html

TensorFlow 官网:https://tensorflow.google.cn/

游戏

Cocos 引擎:http://docs.cocos.com/creator/manual/zh/


小说更新

gh_11d136296ec9_258.jpg

查询完小说,点击更新。有红色徽章的代表有更新。

Assistor PS 分析

微信截图_20190806163246.png

Assistor PS  :Save Your Valuable Time (节省你的宝贵时间)

初看Assistor PS让我觉得惊为天人,不需要以插件的形式存在就可以进行读取图层,并且为每个图层进行标注,裁剪,距离计算等等一系列比较黑科技的功能。于是安奈不住分析一下。

微信截图_20190806163744.png

界面做的很漂亮,然后有几个按钮,本来想直接找按钮底下的事件,发现不是太好找,于是换了个思路,查找热键对应的事件。

反编译找到如下代码

GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D1).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D2).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D3).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.D4).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.Q).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.W).Pressed = OnHotKeyPressed;
GlobalHotKey.Register(hwndSource.Handle, ModifierKeys.Alt, GlobalHotKey.Keys.E).Pressed = OnHotKeyPressed;

然后找到回调事件

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;
    case GlobalHotKey.Keys.D4:
        Tool.ExecuteText();
    break;
    case GlobalHotKey.Keys.Q:
        Tool.ExecuteGuideBox();
    break;
    case GlobalHotKey.Keys.W:
        Tool.ExecuteSnips();
    break;
    case GlobalHotKey.Keys.A:
        Tool.ExecuteDescription();
    break;
}

发现作者是将一些操作封装了一下,查看这个Tool类。

public void ExecutePosition()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Position, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.Position, this.()));
}
public void ExecuteSize()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Size, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.Size, this.()));
}
public void ExecuteText()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Text, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.Text, this.()));
}
public void ExecuteDistance()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Distance, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.Distance, this.()));
}
public void ExecuteGuideBox()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_GuideBox, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.GuideBox, this.()));
}
public void ExecuteSnips()
{
    this.AppendLog(LogType.Information, LogSubType.Execute, AssistorLogType.LayerDescriptor_Snips, string.Empty, string.Empty);
    this.(ScriptProvider.Execute(ScriptMethodType.Snips, this.()));
}

然后有一个ScriptProvider,这里面有一些比较好的进程之间的写法,总的来说,通过ScriptMethodType判断你的执行操作类型,然后执行Photoshop的JSX脚本。

ScriptMethodType类型

public enum ScriptMethodType
{
    Position,
    Size,
    Text,
    Distance,
    GuideBox,
    Snips,
    Description,
    Document,
    Guides,
    GuidesHCenter,
    GuidesVCenter,
    GuidesClear,
    Rounder,
    Tiler,
    Capture
}

JSX脚本

  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

可以发现名字和ScriptMethodType自定义类型是一致的。

部分脚本源码

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.SetLayersPanelVisibility = function(visible)
{
    this.SetPanelVisibility('panelid.static.layers', visible);    
}
Photoshop.prototype.GetActiveDocument = function(){
    return new Document(this, this.GetActiveDocumentId());        
    
};
Photoshop.prototype.GetActiveDocumentId = function(){
    try {        
        var documentReference = new ActionReference();
        documentReference.putProperty(typeID("Prpr"), typeID("DocI"));
        documentReference.putEnumerated(typeID("Dcmn"), typeID("Ordn"), typeID("Trgt"));
        var documentDescriptor = executeActionGet(documentReference);
        return documentDescriptor.getInteger(typeID("DocI"));    
    }
    catch(ex) {
        return -1;        
    }
};
Photoshop.prototype.SetActiveDocument = function(document) {
    
    this.SetActiveDocumentFromId(document.DocumentId);
};
Photoshop.prototype.SetActiveDocumentFromId = function(documentId) {
    
    var documentDescriptor = new ActionDescriptor();
    var documentReference = new ActionReference();
    documentReference.putIdentifier(typeID("Dcmn"), documentId);
    documentDescriptor.putReference(typeID("null"), documentReference);
    executeAction(typeID("slct"), documentDescriptor, DialogModes.NO);
};
Photoshop.prototype.GetRulerUnits = function() {
    return preferences.rulerUnits; 
};
Photoshop.prototype.SetRulerUnits = function (rulerUnits) {
    preferences.rulerUnits = rulerUnits;
};
Photoshop.prototype.GetTypeUnits = function () {
    return preferences.typeUnits;
};
Photoshop.prototype.SetTypeUnits = function (typeUnits) {
    preferences.typeUnits = typeUnits;
};