public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string doc = settings["directory"]; string name = settings["app_name"] + ":" + settings["app_instance"]; ps.ApplicationClass app = new ps.ApplicationClass(); app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes string[] dirFiles = Directory.GetFiles(doc); //Get a list of files in that directory Object[] supportedTypes = (Object[])app.WindowsFileTypes; //Get a list of supported types Time.startTimer(name, "openDir"); foreach (string file in dirFiles) { string[] parse = file.Split('.'); string ext = parse[parse.Length - 1]; if (supportedTypes.Contains((Object)ext)) //Ensure the filetype is supported { app.Application.Load(file); } else Console.WriteLine("Could not load " + file + "\nType not supported"); } //WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired. Time.stopTimer(name, "openDir"); return hWnd; }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string path = settings["app_path"]; string[] str = path.Split('\\'); string name = settings["app_name"] + ":" + settings["app_instance"]; Process appProc = Process.Start(path); ps.ApplicationClass app = new ps.ApplicationClass(); Time.startTimer(name, "launch to ready"); Time.startTimer(name, "runtime"); WaitForRedraw(app); while (true) { if (au3.WinExists("Adobe Photoshop", "").Equals(1)) { break; } } string handle = au3.WinGetHandle("Adobe Photoshop", ""); Time.stopTimer(name, "launch to ready"); hWnd.handle = handle; hWnd.myProc = appProc; return hWnd; }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string name = settings["app_name"] + ":" + settings["app_instance"]; string act_name = settings["action_name"]; ps.ApplicationClass app = new ps.ApplicationClass(); app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes Time.startTimer(name, "action " + act_name); app.DoAction(act_name, settings["action_set"]); //Do action of name act_name in the set given. Time.stopTimer(name, "action " + act_name); return hWnd; }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string doc = settings["open"]; string name = settings["app_name"] + ":" + settings["app_instance"]; ps.ApplicationClass app = new ps.ApplicationClass(); app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes app.Application.Load(doc); Time.startTimer(name, "open"); WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired. Time.stopTimer(name, "open"); return hWnd; }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string doc = settings["input"]; string name = settings["app_name"] + ":" + settings["app_instance"]; ps.ApplicationClass app = new ps.ApplicationClass(); app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes string[] arr = new string[0]; Time.startTimer(name, "script"); app.DoJavaScript(settings["input_text"],arr,1); WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired. Time.stopTimer(name, "script"); return hWnd; }
private void MOG_ExportAllButton_Click(object sender, System.EventArgs e) { if (string.Compare(this.PhotoshopLabel.Text, "P.S. V.9") == 0) { try { ps.ApplicationClass app = new ps.ApplicationClass(); ps.Documents doc_arr = app.Documents; foreach (ps.Document doc in doc_arr) { ps.PhotoshopSaveOptionsClass psSaveOptions = new ps.PhotoshopSaveOptionsClass(); psSaveOptions.AlphaChannels = true; psSaveOptions.Annotations = true; psSaveOptions.Layers = true; psSaveOptions.SpotColors = true; string FullFilename = mTargetDir + "\\" + doc.Name; doc.SaveAs(FullFilename, psSaveOptions, true, ps.PsExtensionType.psUppercase); } } catch (Exception ex) { MOG_REPORT.ShowErrorMessageBox("Photoshop CS import", "Could not initialize a compatible link between MOG and your version of Photoshop\nMessage:" + ex.ToString()); return; } } else if (string.Compare(this.PhotoshopLabel.Text, "P.S. V.7") == 0) { try { MOG_Export export = new MOG_Export(); export.LaunchExportAll(mTargetDir); } catch (Exception ex) { MOG_REPORT.ShowErrorMessageBox("Photoshop 7 import", "Could not initialize a compatible link between MOG and your version of Photoshop\nMessage:" + ex.ToString()); return; } } }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string doc = settings["save"]; string name = settings["app_name"] + ":" + settings["app_instance"]; ps.ApplicationClass app = new ps.ApplicationClass(); ps.JPEGSaveOptionsClass options = new Photoshop.JPEGSaveOptionsClass(); app.DisplayDialogs = ps.PsDialogModes.psDisplayNoDialogs; //Do not display dialog boxes //Save image as a jpg. app.Application.ActiveDocument.SaveAs(doc,options,true, ps.PsExtensionType.psUppercase); Time.startTimer(name, "save"); WaitForRedraw(app); //Pauses while Photoshop refreshes. Unsure if this works as desired. Time.stopTimer(name, "save"); return hWnd; }
private void listView1_KeyDown(object sender, KeyEventArgs e) { ListView lvTemp = (ListView)sender; nomeRemovida = ""; if (e.KeyCode == Keys.Space) { if (lvTemp.SelectedItems.Count > 0) { fullScreen full = new fullScreen(); full = new fullScreen(); full.WindowState = FormWindowState.Maximized; full.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; full.Show(); full.exbirFullScreen(imagens, lvTemp.SelectedItems[0].ImageIndex); } } else if (e.KeyCode == Keys.Return) { if (lvTemp.SelectedItems.Count > 0) { try { ps.ApplicationClass app = new ps.ApplicationClass(); app.Open(lvTemp.SelectedItems[0].Name); System.Diagnostics.Process.Start("Photoshop.exe"); this.WindowState = FormWindowState.Minimized; } catch { } } //System.Diagnostics.Process.Start("Photoshop.exe", lvTemp.Items[i].Name); } else if (e.KeyCode == Keys.F7) { removerFotos(lvTemp); } }
public static ArrayList arquivosSelecionados() { try { ps.ApplicationClass app = new ps.ApplicationClass(); String Code = "var fileList;" + "if ( BridgeTalk.isRunning( 'bridge' ) ) {" + "var bt = new BridgeTalk();" + "bt.target = 'bridge';" + "bt.body = 'var theFiles = photoshop.getBridgeFileListForAutomateCommand();theFiles.toSource();';" + "bt.onResult = function( inBT ) { fileList = eval( inBT.body ); }" + "bt.onError = function( inBT ) { fileList = new Array(); }" + "bt.send(8);" + "bt.pump();" + "var timeOutAt = ( new Date() ).getTime() + 5000;" + "var currentTime = ( new Date() ).getTime();" + "while ( ( currentTime < timeOutAt ) && ( undefined == fileList ) ) {" + "bt.pump();" + "$.sleep( 100 );" + "currentTime = ( new Date() ).getTime();" + "}}" + "if ( undefined == fileList ) {" + "fileList = new Array();}" + "fileList = decodeURI(fileList.toString());"; String RC = app.DoJavaScript(Code, null, null); ArrayList list = new ArrayList(); list.AddRange(RC.Split(new char[] { ',' })); foreach (String s in list) { } return(list); } catch { MessageBox.Show("Abra o Photoshop"); return(null); } }
public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string name = settings["app_name"] + ":" + settings["app_instance"]; au3.Opt("WinTitleMatchMode", 4); au3.WinActivate("[HANDLE:" + hWnd.handle + "]", ""); ps.ApplicationClass app = new ps.ApplicationClass(); while (app.Documents.Count > 0) { app.ActiveDocument.Close(ps.PsSaveOptions.psDoNotSaveChanges); } app.Quit(); if (!hWnd.myProc.HasExited) { hWnd.myProc.CloseMainWindow(); hWnd.myProc.Close(); } Time.stopTimer(name, "runtime"); return hWnd; }