0
我使用Photoshop CS4,當我使用Adobe腳本來檢查此屬性時,我得到未定義。我如何訪問Photoshop中文檔的加載漸變以通過腳本操作它們(例如,修改漸變停止,刪除漸變...)?Photoshop activeDocument.gradients屬性
我使用Photoshop CS4,當我使用Adobe腳本來檢查此屬性時,我得到未定義。我如何訪問Photoshop中文檔的加載漸變以通過腳本操作它們(例如,修改漸變停止,刪除漸變...)?Photoshop activeDocument.gradients屬性
我知道這是一個古老的職位,而且不會出現上在Photoshop refrence guide.However梯度性質的任何信息......
與上一個空白640x640圖像的使用scriptlistner簡單前景到背景的梯度,我們得到這樣的:
// =======================================================
var id148 = charIDToTypeID("Grdn");
var desc24 = new ActionDescriptor();
var id149 = charIDToTypeID("From");
var desc25 = new ActionDescriptor();
var id150 = charIDToTypeID("Hrzn");
var id151 = charIDToTypeID("#Pxl");
desc25.putUnitDouble(id150, id151, 639.000000); //x1
var id152 = charIDToTypeID("Vrtc");
var id153 = charIDToTypeID("#Pxl");
desc25.putUnitDouble(id152, id153, 0.000000); //y1
var id154 = charIDToTypeID("Pnt ");
desc24.putObject(id149, id154, desc25);
var id155 = charIDToTypeID("T ");
var desc26 = new ActionDescriptor();
var id156 = charIDToTypeID("Hrzn");
var id157 = charIDToTypeID("#Pxl");
desc26.putUnitDouble(id156, id157, 639.000000); //x2
var id158 = charIDToTypeID("Vrtc");
var id159 = charIDToTypeID("#Pxl");
desc26.putUnitDouble(id158, id159, 639.000000); //y2
var id160 = charIDToTypeID("Pnt ");
desc24.putObject(id155, id160, desc26);
var id161 = charIDToTypeID("Type");
var id162 = charIDToTypeID("GrdT");
var id163 = charIDToTypeID("Lnr ");
desc24.putEnumerated(id161, id162, id163);
var id164 = charIDToTypeID("UsMs");
desc24.putBoolean(id164, true);
var id165 = charIDToTypeID("Grad");
var desc27 = new ActionDescriptor();
var id166 = charIDToTypeID("Nm ");
desc27.putString(id166, "Foreground to Background"); // name of the gradient
var id167 = charIDToTypeID("GrdF");
var id168 = charIDToTypeID("GrdF");
var id169 = charIDToTypeID("CstS");
desc27.putEnumerated(id167, id168, id169);
var id170 = charIDToTypeID("Intr");
desc27.putDouble(id170, 4096.000000);
var id171 = charIDToTypeID("Clrs");
var list5 = new ActionList();
var desc28 = new ActionDescriptor();
var id172 = charIDToTypeID("Type");
var id173 = charIDToTypeID("Clry");
var id174 = charIDToTypeID("FrgC");
desc28.putEnumerated(id172, id173, id174);
var id175 = charIDToTypeID("Lctn");
desc28.putInteger(id175, 0);
var id176 = charIDToTypeID("Mdpn");
desc28.putInteger(id176, 50);
var id177 = charIDToTypeID("Clrt");
list5.putObject(id177, desc28);
var desc29 = new ActionDescriptor();
var id178 = charIDToTypeID("Type");
var id179 = charIDToTypeID("Clry");
var id180 = charIDToTypeID("BckC");
desc29.putEnumerated(id178, id179, id180);
var id181 = charIDToTypeID("Lctn");
desc29.putInteger(id181, 4096);
var id182 = charIDToTypeID("Mdpn");
desc29.putInteger(id182, 50);
var id183 = charIDToTypeID("Clrt");
list5.putObject(id183, desc29);
desc27.putList(id171, list5);
var id184 = charIDToTypeID("Trns");
var list6 = new ActionList();
var desc30 = new ActionDescriptor();
var id185 = charIDToTypeID("Opct");
var id186 = charIDToTypeID("#Prc");
desc30.putUnitDouble(id185, id186, 100.000000);
var id187 = charIDToTypeID("Lctn");
desc30.putInteger(id187, 0);
var id188 = charIDToTypeID("Mdpn");
desc30.putInteger(id188, 50);
var id189 = charIDToTypeID("TrnS");
list6.putObject(id189, desc30);
var desc31 = new ActionDescriptor();
var id190 = charIDToTypeID("Opct");
var id191 = charIDToTypeID("#Prc");
desc31.putUnitDouble(id190, id191, 100.000000);
var id192 = charIDToTypeID("Lctn");
desc31.putInteger(id192, 4096);
var id193 = charIDToTypeID("Mdpn");
desc31.putInteger(id193, 50);
var id194 = charIDToTypeID("TrnS");
list6.putObject(id194, desc31);
desc27.putList(id184, list6);
var id195 = charIDToTypeID("Grdn");
desc24.putObject(id165, id195, desc27);
executeAction(id148, desc24, DialogModes.NO);
不幸的是,它不是隻喊你需要通過名稱梯度一樣容易,你可能會更好使用與scriptlistner所需的梯度記錄。
This post對您也可能有用