static public void Initialize() { if (Process.GetProcessesByName("Photoshop").Length > 0) { App = new Photoshop.Application(); var refApp = new ActionReference(); refApp.PutProperty(App.StringIDToTypeID("property"), App.StringIDToTypeID("tool")); refApp.PutEnumerated(App.StringIDToTypeID("application"), App.StringIDToTypeID("ordinal"), App.StringIDToTypeID("targetEnum")); AppDescriptor = App.ExecuteActionGet(refApp); var refDoc = new ActionReference(); refDoc.PutProperty(App.StringIDToTypeID("property"), App.StringIDToTypeID("zoom")); refDoc.PutEnumerated(App.StringIDToTypeID("document"), App.StringIDToTypeID("ordinal"), App.StringIDToTypeID("targetEnum")); DocumentDescriptor = App.ExecuteActionGet(refDoc); } else { App = null; } }
public void WaitForRedraw(ps.ApplicationClass app) { var eventWait = app.CharIDToTypeID("Wait"); var enumRedrawComplete = app.CharIDToTypeID("RdCm"); var typeState = app.CharIDToTypeID("Stte"); var keyState = app.CharIDToTypeID("Stte"); var desc = new ps.ActionDescriptor(); desc.PutEnumerated(keyState, typeState, enumRedrawComplete); app.ExecuteAction(eventWait, desc, ps.PsDialogModes.psDisplayNoDialogs); }
private void Isolate_Selection() { var idShw = app.CharIDToTypeID("Shw "); var desc68 = new ps.ActionDescriptor(); var idnull = app.CharIDToTypeID("null"); var list21 = new ps.ActionList(); var ref49 = new Photoshop.ActionReference(); var idLyr = app.CharIDToTypeID("Lyr "); var idOrdn = app.CharIDToTypeID("Ordn"); var idTrgt = app.CharIDToTypeID("Trgt"); ref49.PutEnumerated(idLyr, idOrdn, idTrgt); list21.PutReference(ref49); desc68.PutList(idnull, list21); var idTglO = app.CharIDToTypeID("TglO"); desc68.PutBoolean(idTglO, true); app.ExecuteAction(idShw, desc68, ps.PsDialogModes.psDisplayNoDialogs); }