la cosa strana ´´e che a tutti funziona.. tranne a lui..
comunque in timertick c´´e questo:
codice:private void timer1_Tick(object sender, EventArgs e) { //label3.Text = currentstep.ToString(); label2.Text = GetActiveWindowTitle(); // label3.Text = revitApp.Application.Language.ToString(); label12.Text = currentview.ToString() + " of " + myArr.Length.ToString() + " views rendered..."; if (currentstep == 0) { label1.Text = "Waiting start..."; string MainString = GetActiveWindowTitle(); if (MainString.Length > 17) { //string NewString = MainString.Remove(18, MainString.Length-1); string SearchString = "Autodesk Revit 2013"; int FirstChr = MainString.IndexOf(SearchString); if (FirstChr == 0) { label6.Text = "Rendering started! Please don't click ANYWHERE!"; currentstep = 1; } } } else if (currentstep == 1) { checkBox1.Enabled = false; label1.Text = "Loading view..."; loadview(); currentstep = 101; } else if (currentstep == 101) { InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_R); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_R); currentstep = 102; } else if (currentstep == 102) { string windowname = null; if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.German) { windowname = "Rendern"; } else if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.English_USA) { windowname = "Rendering"; } else { windowname = "Rendering"; } IntPtr ip = FindWindowByCaption(0, windowname); SetForegroundWindow(ip); currentstep = 2; } else if (currentstep == 2) { label1.Text = "Starting rendering..."; currentstep = 3; } else if (currentstep == 3) { //InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.TAB); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_R); //InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 4; } else if (currentstep == 4) { if (GetActiveWindowTitle() == "Render-Fortschritt" || GetActiveWindowTitle() == "Rendering Progress") { label1.Text = "Rendering..."; currentstep = 5; } } else if (currentstep == 5) { if (GetActiveWindowTitle() == "Rendern" || GetActiveWindowTitle() == "Rendering") { if (checkBox2.Checked == true) { label1.Text = "Saving image to project..."; currentstep = 601; } else { if (checkBox3.Checked == true) { currentstep = 611; } if (checkBox4.Checked == true) { currentstep = 621; } else { currentstep = 700; } } } } else if (currentstep == 601) { if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.German) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_P); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 602; } else if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.English_USA) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_V); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 602; } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_V); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 602; } } else if (currentstep == 602) { InputSimulator.SimulateKeyPress(VirtualKeyCode.EXECUTE); if (checkBox3.Checked == true) { currentstep = 611; } else if (checkBox4.Checked == true) { currentstep = 621; } else { currentstep = 700; } } else if (currentstep == 611) { if (checkBox3.Checked == true) { label1.Text = "Saving JPG to projectfolder..."; currentstep = 612; } else { if (checkBox4.Checked == true) { currentstep = 621; } else { currentstep = 700; } } } else if (currentstep == 612) { if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.German) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 613; } else if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.English_USA) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 613; } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 613; } } else if (currentstep == 613) { DateTime dt = DateTime.Now; InputSimulator.SimulateTextEntry(System.IO.Path.GetDirectoryName(Doc.PathName) + "\\" + myArr[currentview].ToString() + " " + String.Format("{0:yyyy_MM_dd HH.mm.ss}", dt) + ".jpg"); InputSimulator.SimulateKeyPress(VirtualKeyCode.EXECUTE); if (checkBox4.Checked == true) { currentstep = 621; } else { currentstep = 700; } } else if (currentstep == 621) { if (checkBox2.Checked == true) { label1.Text = "Saving PNG to projectfolder..."; currentstep = 622; } else { currentstep = 700; } } else if (currentstep == 622) { if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.German) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 623; } else if (revitApp.Application.Language == Autodesk.Revit.ApplicationServices.LanguageType.English_USA) { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 623; } else { InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_X); InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT); currentstep = 623; } } else if (currentstep == 623) { DateTime dt = DateTime.Now; InputSimulator.SimulateTextEntry(System.IO.Path.GetDirectoryName(Doc.PathName) + "\\" + myArr[currentview].ToString() + " " + String.Format("{0:yyyy_MM_dd HH.mm.ss}", dt) + ".png"); InputSimulator.SimulateKeyPress(VirtualKeyCode.EXECUTE); currentstep = 700; } else if (currentstep == 700) { InputSimulator.SimulateKeyPress(VirtualKeyCode.ESCAPE); if (checkBox1.Checked == true) { currentstep = 631; } else { currentstep = 9; } } else if (currentstep == 631) { if (checkBox1.Checked == true) { label1.Text = "Saving project..."; currentstep = 632; } else { currentstep = 9; } } else if (currentstep == 632) { InputSimulator.SimulateKeyPress(VirtualKeyCode.LMENU); InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_2); currentstep = 633; } else if (currentstep == 633) { currentstep = 9; } else if (currentstep == 9) { currentview += 1; if (currentview > myArr.Length - 1) { currentstep = 10; System.Windows.Forms.MessageBox.Show("Rendering finished!", "Rendering finished!", System.Windows.Forms.MessageBoxButtons.OK); } else { label1.Text = "Next view..."; currentstep = 1; } } else if (currentstep == 10) { this.Close(); } }

Rispondi quotando