Example #1
0
        public static void Main()
        {
            var window = new Window() //make sure the window is invisible
            {
                Width         = 0,
                Height        = 0,
                Left          = -2000,
                WindowStyle   = WindowStyle.None,
                ShowInTaskbar = false,
                ShowActivated = false,
            };

            window.Show();


            strButtonPressed = myActions.WindowBalloonMultipleControls(ref myListControlEntity, 140, 500, 0, 0, "NONE");
            if (strButtonPressed == "btnCancel")
            {
                myActions.MessageBoxShow("Okay button not pressed - Script Cancelled");
                goto myExit;
            }
        }
Example #2
0
        private void OpenLineInNotepad()
        {
            myActions.TypeText("{RIGHT}", 500);
            myActions.TypeText("{HOME}", 500);
            myActions.TypeText("+({END})", 500);
            myActions.TypeText("^(c)", 500);
            myActions.Sleep(500);
            string strCurrentLine = "";

            RunAsSTAThread(
                () => {
                strCurrentLine = myActions.PutClipboardInEntity();
            });
            List <string> myBeginDelim = new List <string>();
            List <string> myEndDelim   = new List <string>();

            myBeginDelim.Add("\"");
            myEndDelim.Add("\"");
            FindDelimitedTextParms delimParms = new FindDelimitedTextParms(myBeginDelim, myEndDelim);

            string myQuote = "\"";

            delimParms.lines[0] = strCurrentLine;


            myActions.FindDelimitedText(delimParms);
            int intLastSlash = delimParms.strDelimitedTextFound.LastIndexOf('\\');

            if (intLastSlash < 1)
            {
                myActions.MessageBoxShow("Could not find last slash in in EditPlusLine - aborting");
                return;
            }
            string strPathOnly     = delimParms.strDelimitedTextFound.SubstringBetweenIndexes(0, intLastSlash);
            string strFileNameOnly = delimParms.strDelimitedTextFound.Substring(intLastSlash + 1);
            string strFullFileName = delimParms.strDelimitedTextFound;

            myBeginDelim.Clear();
            myEndDelim.Clear();
            myBeginDelim.Add("(");
            myEndDelim.Add(",");
            delimParms          = new FindDelimitedTextParms(myBeginDelim, myEndDelim);
            delimParms.lines[0] = strCurrentLine;
            myActions.FindDelimitedText(delimParms);
            string strLineNumber = delimParms.strDelimitedTextFound;
            string strExecutable = @"C:\Program Files (x86)\Notepad++\notepad++.exe";
            string strContent    = strFullFileName;

            Process.Start(strExecutable, string.Concat("", strContent, ""));
            myActions.TypeText("^(g)", 2000);
            myActions.TypeText(strLineNumber, 500);
            myActions.TypeText("{ENTER}", 500);
            myActions.TypeText("^(f)", 500);

            string strFindWhatToUse = strFindWhat;
            string blockText        = strFindWhatToUse;

            strFindWhatToUse = "";
            char[] specialChars = { '{', '}', '(', ')', '+', '^' };

            foreach (char letter in blockText)
            {
                bool _specialCharFound = false;

                for (int i = 0; i < specialChars.Length; i++)
                {
                    if (letter == specialChars[i])
                    {
                        _specialCharFound = true;
                        break;
                    }
                }

                if (_specialCharFound)
                {
                    strFindWhatToUse += "{" + letter.ToString() + "}";
                }
                else
                {
                    strFindWhatToUse += letter.ToString();
                }
            }
            myActions.TypeText(strFindWhatToUse, 500);
            myActions.TypeText("{ENTER}", 500);
            myActions.TypeText("{ESC}", 500);
            boolStopEvent = false;
        }
        public MainWindow()
        {
            int  delay = 500;
            bool boolRunningFromHome = false;
            var  window = new Window() //make sure the window is invisible
            {
                Width         = 0,
                Height        = 0,
                Left          = -2000,
                WindowStyle   = WindowStyle.None,
                ShowInTaskbar = false,
                ShowActivated = false,
            };

            // Create a timer and set a two millisecond interval.

            aTimer.Interval = 2;

            // Alternate method: create a Timer with an interval argument to the constructor.
            //aTimer = new System.Timers.Timer(2000);

            // Create a timer with a two millisecond interval.
            aTimer = new System.Timers.Timer(2);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += OnTimedEvent;

            // Have the timer fire repeated events (true is the default)
            aTimer.AutoReset = true;

            // Start the timer
            aTimer.Enabled  = true;
            spaceBarPressed = false;

            window.Show();

            myActions.ScriptStartedUpdateStats();

            InitializeComponent();
            this.Hide();

            string strWindowTitle = myActions.PutWindowTitleInEntity();

            if (strWindowTitle.StartsWith("ExecuteWithBreakpointTrace"))
            {
                myActions.TypeText("%(\" \"n)", 1000); // minimize visual studio
            }

            myListControlEntity = new List <ControlEntity>();
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Heading;
            myControlEntity.ID           = "lbl";
            myControlEntity.Text         = "ExecuteWithBreakpointTrace";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType = ControlType.Label;
            myControlEntity.ID          = "lbl";
            myControlEntity.Text        = "" +
                                          "1. Click on visual studio to debug \r\n";
            myControlEntity.ToolTipx     = "";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.Width        = 272;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 0;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType = ControlType.Label;
            myControlEntity.ID          = "lbl";
            myControlEntity.Text        = "" +
                                          "2. Close this window to start debugging \r\n";
            myControlEntity.ToolTipx     = "";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.Width        = 312;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 0;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType = ControlType.Label;
            myControlEntity.ID          = "lbl";
            myControlEntity.Text        = "" +
                                          "3. PRESS Ctrl-Space to stop debugger \r\n";
            myControlEntity.ToolTipx     = "";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.Width        = 312;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 0;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());
            strButtonPressed = myActions.WindowMultipleControls(ref myListControlEntity, 300, 624, 0, 0);
            if (strButtonPressed == "btnCancel")
            {
                myActions.MessageBoxShow("Okay button not pressed - Script Cancelled");
                goto myExit;
            }

            // TODO: In IdealAutomateCore, create another PutAll override that does not ask if you want an alternative image when it cannot find image
            string firstLine         = "";
            string currentLine       = "";
            string currentLineNumber = "";
            string firstFileName     = "";
            string currFileName      = "";
            string firstLineNumber   = "";

            myActions.TypeText("{F11}", 1000); // compile program and go to first breakpoint
            int intCtr = 0;

TryToFindYellowArrow:
            intCtr++;
            ImageEntity myImage = new ImageEntity();

            if (boolRunningFromHome)
            {
                myImage.ImageFile = "Images\\imgYellowArrow.PNG";
            }
            else
            {
                myImage.ImageFile = "Images\\imgYellowArrow.PNG";
            }
            myImage.Sleep     = 200;
            myImage.Attempts  = 1;
            myImage.RelativeX = 10;
            myImage.RelativeY = 10;
            myImage.Tolerance = 60;

            int[,] myArray = myActions.PutAll(myImage);
            if (myArray.Length == 0 && intCtr < 50)
            {
                goto TryToFindYellowArrow;
            }
            if (myArray.Length == 0)
            {
                myActions.MessageBoxShow("I could not find image of YellowArrow");
            }
            else
            {
                // myActions.MessageBoxShow("Found Yellow Arrow");
            }
            myActions.TypeText("^(c)", delay);
            currentLine = myActions.PutClipboardInEntity();
            firstLine   = currentLine;
            LineOfCode myLine = new LineOfCode();

            myLine.TextOfCode = currentLine;

            // get line number
            myActions.TypeText("^(g)", delay);
            myActions.TypeText("^(a)", delay);
            myActions.TypeText("^(c)", delay);
            currentLineNumber = myActions.PutClipboardInEntity();
            firstLineNumber   = currentLineNumber;
            myLine.LineNumber = currentLineNumber;
            myActions.TypeText("{ESCAPE}", delay);

            // get filename
            myActions.TypeText("%(f)", delay);
            myActions.TypeText("a", delay);
            myActions.TypeText("^(c)", delay);
            currFileName    = myActions.PutClipboardInEntity();
            myLine.FileName = currFileName;
            firstFileName   = currFileName;
            myActions.TypeText("{ESCAPE}", delay);

            // add the line to list
            listExecutedCode.Add(myLine);
            LineOfCode prevLine = myLine;

GetNextLine:
            if (spaceBarPressed)
            {
                goto EndOfExecution;
            }
            // get next line
            myActions.TypeText("{F11}", delay); // next breakpoint
            myActions.TypeText("^(c)", delay);
            currentLine       = myActions.PutClipboardInEntity();
            myLine            = new LineOfCode();
            myLine.TextOfCode = currentLine;

            // get line number
            myActions.TypeText("^(g)", delay);
            myActions.TypeText("^(a)", delay);
            myActions.TypeText("^(c)", delay);
            currentLineNumber = myActions.PutClipboardInEntity();
            firstLineNumber   = currentLineNumber;
            myLine.LineNumber = currentLineNumber;
            myActions.TypeText("{ESCAPE}", delay);

            // get filename
            myActions.TypeText("%(f)", delay);
            myActions.TypeText("a", delay);
            myActions.TypeText("^(c)", delay);
            currFileName    = myActions.PutClipboardInEntity();
            myLine.FileName = currFileName;
            firstFileName   = currFileName;
            myActions.TypeText("{ESCAPE}", delay);

            // add the line to list
            listExecutedCode.Add(myLine);

            if (myLine != prevLine)
            {
                prevLine = myLine;
                goto GetNextLine;
            }
EndOfExecution:
            myActions.MessageBoxShow("Successfully Reached End of Execution");

            string strOutFile = @"C:\Data\ExecutedCode.txt";

            if (File.Exists(strOutFile))
            {
                File.Delete(strOutFile);
            }
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(strOutFile))
            {
                // Write list to text file so I can look at it
                foreach (LineOfCode item in listExecutedCode)
                {
                    file.WriteLine(item.FileName + " " + item.LineNumber + " " + item.TextOfCode);
                }
            }


            string strExecutable = @"C:\Windows\system32\notepad.exe";

            myActions.RunSync(strExecutable, strOutFile);


            // We found output completed and now want to copy the results
            // to notepad


myExit:
            aTimer.Enabled = false;
            aTimer.Stop();
            aTimer.Close();
            myActions.Sleep(1000);
            myActions.ScriptEndedSuccessfullyUpdateStats();
            Application.Current.Shutdown();
        }
Example #4
0
        public MainWindow()
        {
            bool boolRunningFromHome = false;
            var  window = new Window() //make sure the window is invisible
            {
                Width         = 0,
                Height        = 0,
                Left          = -2000,
                WindowStyle   = WindowStyle.None,
                ShowInTaskbar = false,
                ShowActivated = false,
            };

            window.Show();
            myActions = new Methods();
            myActions.ScriptStartedUpdateStats();

            string strSavedDomainName = myActions.GetValueByKey("DomainName");

            if (strSavedDomainName == "")
            {
                strSavedDomainName = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
            }
            InitializeComponent();
            this.Hide();


            listHotKeyRecords = new List <HotKeyRecord>();

            HotKeyRecord myHotKeyRecord = new HotKeyRecord();
            string       strHotKey      = "Ctrl+Alt+N";

            myHotKeyRecord.HotKeys        = strHotKey.Split('+');
            myHotKeyRecord.Executable     = @"OpenLineInNotepad";
            myHotKeyRecord.ExecuteContent = null;
            myHotKeyRecord.ScriptID       = 0;
            bool boolHotKeysGood = true;

            foreach (string myHotKey in myHotKeyRecord.HotKeys)
            {
                if (dictVirtualKeyCodes.ContainsKey(myHotKey))
                {
                    MessageBox.Show("Invalid hotkey: " + myHotKey);
                    boolHotKeysGood = false;
                }
            }
            if (boolHotKeysGood)
            {
                listHotKeyRecords.Add(myHotKeyRecord);
            }

            dictVirtualKeyCodes.Add("Ctrl", VirtualKeyCode.CONTROL);
            dictVirtualKeyCodes.Add("Alt", VirtualKeyCode.MENU);
            dictVirtualKeyCodes.Add("Shift", VirtualKeyCode.SHIFT);
            dictVirtualKeyCodes.Add("Space", VirtualKeyCode.SPACE);
            dictVirtualKeyCodes.Add("Up", VirtualKeyCode.UP);
            dictVirtualKeyCodes.Add("Down", VirtualKeyCode.DOWN);
            dictVirtualKeyCodes.Add("Left", VirtualKeyCode.LEFT);
            dictVirtualKeyCodes.Add("Right", VirtualKeyCode.RIGHT);
            dictVirtualKeyCodes.Add("A", VirtualKeyCode.VK_A);
            dictVirtualKeyCodes.Add("B", VirtualKeyCode.VK_B);
            dictVirtualKeyCodes.Add("C", VirtualKeyCode.VK_C);
            dictVirtualKeyCodes.Add("D", VirtualKeyCode.VK_D);
            dictVirtualKeyCodes.Add("E", VirtualKeyCode.VK_E);
            dictVirtualKeyCodes.Add("F", VirtualKeyCode.VK_F);
            dictVirtualKeyCodes.Add("G", VirtualKeyCode.VK_G);
            dictVirtualKeyCodes.Add("H", VirtualKeyCode.VK_H);
            dictVirtualKeyCodes.Add("I", VirtualKeyCode.VK_I);
            dictVirtualKeyCodes.Add("J", VirtualKeyCode.VK_J);
            dictVirtualKeyCodes.Add("K", VirtualKeyCode.VK_K);
            dictVirtualKeyCodes.Add("L", VirtualKeyCode.VK_L);
            dictVirtualKeyCodes.Add("M", VirtualKeyCode.VK_M);
            dictVirtualKeyCodes.Add("N", VirtualKeyCode.VK_N);
            dictVirtualKeyCodes.Add("O", VirtualKeyCode.VK_O);
            dictVirtualKeyCodes.Add("P", VirtualKeyCode.VK_P);
            dictVirtualKeyCodes.Add("Q", VirtualKeyCode.VK_Q);
            dictVirtualKeyCodes.Add("R", VirtualKeyCode.VK_R);
            dictVirtualKeyCodes.Add("S", VirtualKeyCode.VK_S);
            dictVirtualKeyCodes.Add("T", VirtualKeyCode.VK_T);
            dictVirtualKeyCodes.Add("U", VirtualKeyCode.VK_U);
            dictVirtualKeyCodes.Add("V", VirtualKeyCode.VK_V);
            dictVirtualKeyCodes.Add("W", VirtualKeyCode.VK_W);
            dictVirtualKeyCodes.Add("X", VirtualKeyCode.VK_X);
            dictVirtualKeyCodes.Add("Y", VirtualKeyCode.VK_Y);
            dictVirtualKeyCodes.Add("Z", VirtualKeyCode.VK_Z);
            // Create a timer and set a two millisecond interval.
            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Interval = 2;

            // Alternate method: create a Timer with an interval argument to the constructor.
            //aTimer = new System.Timers.Timer(2000);

            // Create a timer with a two millisecond interval.
            aTimer = new System.Timers.Timer(2);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += OnTimedEvent;

            // Have the timer fire repeated events (true is the default)
            aTimer.AutoReset = true;

            // Start the timer
            aTimer.Enabled = true;
DisplayFindTextInFilesWindow:
            int intRowCtr = 0;
            ControlEntity        myControlEntity     = new ControlEntity();
            List <ControlEntity> myListControlEntity = new List <ControlEntity>();
            List <ComboBoxPair>  cbp  = new List <ComboBoxPair>();
            List <ComboBoxPair>  cbp1 = new List <ComboBoxPair>();
            List <ComboBoxPair>  cbp2 = new List <ComboBoxPair>();
            List <ComboBoxPair>  cbp3 = new List <ComboBoxPair>();

            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Heading;
            myControlEntity.ID           = "lbl";
            myControlEntity.Text         = "Find Text In Files";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Label;
            myControlEntity.ID           = "lblFindWhat";
            myControlEntity.Text         = "FindWhat";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.Width        = 150;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());



            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType   = ControlType.ComboBox;
            myControlEntity.SelectedValue = myActions.GetValueByKey("cbxFindWhatSelectedValue");
            myControlEntity.ID            = "cbxFindWhat";
            myControlEntity.RowNumber     = intRowCtr;
            myControlEntity.ToolTipx      = "";
            //foreach (var item in alcbxFindWhat) {
            //    cbp.Add(new ComboBoxPair(item.ToString(), item.ToString()));
            //}
            //myControlEntity.ListOfKeyValuePairs = cbp;
            myControlEntity.ComboBoxIsEditable = true;
            myControlEntity.ColumnNumber       = 1;

            myControlEntity.ColumnSpan = 2;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());


            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Label;
            myControlEntity.ID           = "lblFileType";
            myControlEntity.Text         = "FileType";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.Width        = 150;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());


            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType   = ControlType.ComboBox;
            myControlEntity.SelectedValue = myActions.GetValueByKey("cbxFileTypeSelectedValue");
            myControlEntity.ID            = "cbxFileType";
            myControlEntity.RowNumber     = intRowCtr;
            myControlEntity.ToolTipx      = "Here is an example: *.*";
            //foreach (var item in alcbxFileType) {
            //    cbp1.Add(new ComboBoxPair(item.ToString(), item.ToString()));
            //}
            //myControlEntity.ListOfKeyValuePairs = cbp1;
            myControlEntity.ComboBoxIsEditable = true;
            myControlEntity.ColumnNumber       = 1;
            myControlEntity.ColumnSpan         = 2;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());


            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Label;
            myControlEntity.ID           = "lblExclude";
            myControlEntity.Text         = "Exclude";
            myControlEntity.Width        = 150;
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());


            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType        = ControlType.ComboBox;
            myControlEntity.SelectedValue      = myActions.GetValueByKey("cbxExcludeSelectedValue");
            myControlEntity.ID                 = "cbxExclude";
            myControlEntity.RowNumber          = intRowCtr;
            myControlEntity.ToolTipx           = "Here is an example: *.dll;*.exe;*.png;*.xml;*.cache;*.sln;*.suo;*.pdb;*.csproj;*.deploy";
            myControlEntity.ComboBoxIsEditable = true;
            myControlEntity.ColumnNumber       = 1;
            myControlEntity.ColumnSpan         = 2;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());


            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Label;
            myControlEntity.ID           = "lblFolder";
            myControlEntity.Text         = "Folder";
            myControlEntity.Width        = 150;
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType        = ControlType.ComboBox;
            myControlEntity.SelectedValue      = myActions.GetValueByKey("cbxFolderSelectedValue");
            myControlEntity.ID                 = "cbxFolder";
            myControlEntity.RowNumber          = intRowCtr;
            myControlEntity.ToolTipx           = @"Here is an example: C:\Users\harve\Documents\GitHub";
            myControlEntity.ComboBoxIsEditable = true;
            myControlEntity.ColumnNumber       = 1;
            myControlEntity.ColumnSpan         = 2;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.Button;
            myControlEntity.ID           = "btnSelectFolder";
            myControlEntity.Text         = "Select Folder...";
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 3;
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.CheckBox;
            myControlEntity.ID           = "chkMatchCase";
            myControlEntity.Text         = "Match Case";
            myControlEntity.Width        = 150;
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            string strMatchCase = myActions.GetValueByKey("chkMatchCase");

            if (strMatchCase.ToLower() == "true")
            {
                myControlEntity.Checked = true;
            }
            else
            {
                myControlEntity.Checked = false;
            }
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

            intRowCtr++;
            myControlEntity.ControlEntitySetDefaults();
            myControlEntity.ControlType  = ControlType.CheckBox;
            myControlEntity.ID           = "chkUseRegularExpression";
            myControlEntity.Text         = "UseRegularExpression";
            myControlEntity.Width        = 150;
            myControlEntity.RowNumber    = intRowCtr;
            myControlEntity.ColumnNumber = 0;
            myControlEntity.ColumnSpan   = 1;
            string strUseRegularExpression = myActions.GetValueByKey("chkUseRegularExpression");

            if (strUseRegularExpression.ToLower() == "true")
            {
                myControlEntity.Checked = true;
            }
            else
            {
                myControlEntity.Checked = false;
            }
            myListControlEntity.Add(myControlEntity.CreateControlEntity());

DisplayWindowAgain:
            string strButtonPressed = myActions.WindowMultipleControls(ref myListControlEntity, 300, 1200, 100, 100);

LineAfterDisplayWindow:
            if (strButtonPressed == "btnCancel")
            {
                myActions.MessageBoxShow("Okay button not pressed - Script Cancelled");
                goto myExit;
            }

            boolMatchCase            = myListControlEntity.Find(x => x.ID == "chkMatchCase").Checked;
            boolUseRegularExpression = myListControlEntity.Find(x => x.ID == "chkUseRegularExpression").Checked;

            strFindWhat = myListControlEntity.Find(x => x.ID == "cbxFindWhat").SelectedValue;
            //  string strFindWhatKey = myListControlEntity.Find(x => x.ID == "cbxFindWhat").SelectedKey;

            string strFileType = myListControlEntity.Find(x => x.ID == "cbxFileType").SelectedValue;
            //     string strFileTypeKey = myListControlEntity.Find(x => x.ID == "cbxFileType").SelectedKey;

            string strExclude = myListControlEntity.Find(x => x.ID == "cbxExclude").SelectedValue;
            //      string strExcludeKey = myListControlEntity.Find(x => x.ID == "cbxExclude").SelectedKey;

            string strFolder = myListControlEntity.Find(x => x.ID == "cbxFolder").SelectedValue;

            //     string strFolderKey = myListControlEntity.Find(x => x.ID == "cbxFolder").SelectedKey;
            myActions.SetValueByKey("chkMatchCase", boolMatchCase.ToString());
            myActions.SetValueByKey("chkUseRegularExpression", boolUseRegularExpression.ToString());
            myActions.SetValueByKey("cbxFindWhatSelectedValue", strFindWhat);
            myActions.SetValueByKey("cbxFileTypeSelectedValue", strFileType);
            myActions.SetValueByKey("cbxExcludeSelectedValue", strExclude);
            myActions.SetValueByKey("cbxFolderSelectedValue", strFolder);
            string settingsDirectory = "";

            if (strButtonPressed == "btnSelectFolder")
            {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                dialog.SelectedPath = myActions.GetValueByKey("LastSearchFolder");
                string str = "LastSearchFolder";


                System.Windows.Forms.DialogResult result = dialog.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK && Directory.Exists(dialog.SelectedPath))
                {
                    myListControlEntity.Find(x => x.ID == "cbxFolder").SelectedValue = dialog.SelectedPath;
                    myListControlEntity.Find(x => x.ID == "cbxFolder").SelectedKey   = dialog.SelectedPath;
                    myListControlEntity.Find(x => x.ID == "cbxFolder").Text          = dialog.SelectedPath;
                    myActions.SetValueByKey("LastSearchFolder", dialog.SelectedPath);
                    strFolder = dialog.SelectedPath;
                    myActions.SetValueByKey("cbxFolderSelectedValue", strFolder);
                    string strScriptName          = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
                    string fileName               = "cbxFolder.txt";
                    string strApplicationBinDebug = System.Windows.Forms.Application.StartupPath;
                    string myNewProjectSourcePath = strApplicationBinDebug.Replace("\\bin\\Debug", "");
                    settingsDirectory = GetAppDirectoryForScript(myActions.ConvertFullFileNameToScriptPath(myNewProjectSourcePath));
                    string    settingsPath = System.IO.Path.Combine(settingsDirectory, fileName);
                    ArrayList alHosts      = new ArrayList();
                    cbp = new List <ComboBoxPair>();
                    cbp.Clear();
                    cbp.Add(new ComboBoxPair("--Select Item ---", "--Select Item ---"));
                    ComboBox myComboBox = new ComboBox();


                    if (!File.Exists(settingsPath))
                    {
                        using (StreamWriter objSWFile = File.CreateText(settingsPath)) {
                            objSWFile.Close();
                        }
                    }
                    using (StreamReader objSRFile = File.OpenText(settingsPath)) {
                        string strReadLine = "";
                        while ((strReadLine = objSRFile.ReadLine()) != null)
                        {
                            string[] keyvalue = strReadLine.Split('^');
                            if (keyvalue[0] != "--Select Item ---")
                            {
                                cbp.Add(new ComboBoxPair(keyvalue[0], keyvalue[1]));
                            }
                        }
                        objSRFile.Close();
                    }
                    string strNewHostName          = dialog.SelectedPath;
                    List <ComboBoxPair> alHostx    = cbp;
                    List <ComboBoxPair> alHostsNew = new List <ComboBoxPair>();
                    ComboBoxPair        myCbp      = new ComboBoxPair(strNewHostName, strNewHostName);
                    bool boolNewItem = false;

                    alHostsNew.Add(myCbp);
                    if (alHostx.Count > 14)
                    {
                        for (int i = alHostx.Count - 1; i > 0; i--)
                        {
                            if (alHostx[i]._Key.Trim() != "--Select Item ---")
                            {
                                alHostx.RemoveAt(i);
                                break;
                            }
                        }
                    }
                    foreach (ComboBoxPair item in alHostx)
                    {
                        if (strNewHostName != item._Key && item._Key != "--Select Item ---")
                        {
                            boolNewItem = true;
                            alHostsNew.Add(item);
                        }
                    }

                    using (StreamWriter objSWFile = File.CreateText(settingsPath)) {
                        foreach (ComboBoxPair item in alHostsNew)
                        {
                            if (item._Key != "")
                            {
                                objSWFile.WriteLine(item._Key + '^' + item._Value);
                            }
                        }
                        objSWFile.Close();
                    }
                    goto DisplayWindowAgain;
                }
            }
            string strFindWhatToUse = "";
            string strFileTypeToUse = "";
            string strExcludeToUse  = "";
            string strFolderToUse   = "";

            if (strButtonPressed == "btnOkay")
            {
                if ((strFindWhat == "--Select Item ---" || strFindWhat == ""))
                {
                    myActions.MessageBoxShow("Please enter Find What or select Find What from ComboBox; else press Cancel to Exit");
                    goto DisplayFindTextInFilesWindow;
                }
                if ((strFileType == "--Select Item ---" || strFileType == ""))
                {
                    myActions.MessageBoxShow("Please enter File Type or select File Type from ComboBox; else press Cancel to Exit");
                    goto DisplayFindTextInFilesWindow;
                }
                if ((strExclude == "--Select Item ---" || strExclude == ""))
                {
                    myActions.MessageBoxShow("Please enter Exclude or select Exclude from ComboBox; else press Cancel to Exit");
                    goto DisplayFindTextInFilesWindow;
                }
                if ((strFolder == "--Select Item ---" || strFolder == ""))
                {
                    myActions.MessageBoxShow("Please enter Folder or select Folder from ComboBox; else press Cancel to Exit");
                    goto DisplayFindTextInFilesWindow;
                }



                strFindWhatToUse = strFindWhat;

                if (boolUseRegularExpression)
                {
                    strFindWhatToUse = strFindWhatToUse.Replace(")", "\\)").Replace("(", "\\(");
                }


                strFileTypeToUse = strFileType;



                strExcludeToUse = strExclude;


                strFolderToUse = strFolder;
            }


            strPathToSearch = strFolderToUse;

            strSearchPattern = strFileTypeToUse;

            strSearchExcludePattern = strExcludeToUse;

            strSearchText = strFindWhatToUse;

            strLowerCaseSearchText = strFindWhatToUse.ToLower();
            myActions.SetValueByKey("FindWhatToUse", strFindWhatToUse);

            System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
            st.Start();
            intHits = 0;
            int             intLineCtr;
            List <FileInfo> myFileList = TraverseTree(strSearchPattern, strPathToSearch);
            int             intFiles   = 0;

            matchInfoList = new List <MatchInfo>();
            //         myFileList = myFileList.OrderBy(fi => fi.FullName).ToList();
            Parallel.ForEach(myFileList, myFileInfo => {
                intLineCtr            = 0;
                boolStringFoundInFile = false;
                ReadFileToString(myFileInfo.FullName, intLineCtr, matchInfoList);
                if (boolStringFoundInFile)
                {
                    intFiles++;
                }
            });
            matchInfoList = matchInfoList.Where(mi => mi != null).OrderBy(mi => mi.FullName).ThenBy(mi => mi.LineNumber).ToList();
            List <string> lines = new List <string>();

            foreach (var item in matchInfoList)
            {
                lines.Add("\"" + item.FullName + "\"(" + item.LineNumber + "," + item.LinePosition + "): " + item.LineText.Length.ToString() + " " + item.LineText.Substring(0, item.LineText.Length > 5000 ? 5000 : item.LineText.Length));
            }


            string strApplicationBinDebug1 = System.Windows.Forms.Application.StartupPath;
            string myNewProjectSourcePath1 = strApplicationBinDebug1.Replace("\\bin\\Debug", "");

            settingsDirectory = GetAppDirectoryForScript(myActions.ConvertFullFileNameToScriptPath(myNewProjectSourcePath1));
            using (FileStream fs = new FileStream(settingsDirectory + @"\MatchInfo.txt", FileMode.Create)) {
                StreamWriter file = new System.IO.StreamWriter(fs, Encoding.Default);

                file.WriteLine(@"-- " + strSearchText + " in " + strPathToSearch + " from " + strSearchPattern + " excl  " + strSearchExcludePattern + " --");
                foreach (var item in matchInfoList)
                {
                    file.WriteLine("\"" + item.FullName + "\"(" + item.LineNumber + "," + item.LinePosition + "): " + item.LineText.Substring(0, item.LineText.Length > 5000 ? 5000 : item.LineText.Length));
                }
                int intUniqueFiles = matchInfoList.Select(x => x.FullName).Distinct().Count();
                st.Stop();
                // Get the elapsed time as a TimeSpan value.
                TimeSpan ts = st.Elapsed;
                // Format and display the TimeSpan value.
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                   ts.Hours, ts.Minutes, ts.Seconds,
                                                   ts.Milliseconds / 10);
                file.WriteLine("RunTime " + elapsedTime);
                file.WriteLine(intHits.ToString() + " hits");
                // file.WriteLine(myFileList.Count().ToString() + " files");
                file.WriteLine(intUniqueFiles.ToString() + " files with hits");
                file.Close();


                // Get the elapsed time as a TimeSpan value.
                ts = st.Elapsed;
                // Format and display the TimeSpan value.
                elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                            ts.Hours, ts.Minutes, ts.Seconds,
                                            ts.Milliseconds / 10);
                Console.WriteLine("RunTime " + elapsedTime);
                Console.WriteLine(intHits.ToString() + " hits");
                // Console.WriteLine(myFileList.Count().ToString() + " files");
                Console.WriteLine(intUniqueFiles.ToString() + " files with hits");
                Console.ReadLine();
                string strExecutable = @"C:\Program Files (x86)\Notepad++\notepad++.exe";
                string strContent    = settingsDirectory + @"\MatchInfo.txt";
                Process.Start(strExecutable, string.Concat("", strContent, ""));
                myActions.ScriptEndedSuccessfullyUpdateStats();
                myActions.MessageBoxShow("RunTime: " + elapsedTime + "\n\r\n\rHits: " + intHits.ToString() + "\n\r\n\rFiles with hits: " + intUniqueFiles.ToString() + "\n\r\n\rPut Cursor on line and\n\r press Ctrl+Alt+N\n\rto view detail page. ");
            }


            if (strButtonPressed == "btnOkay")
            {
                strButtonPressed = myActions.WindowMultipleControlsMinimized(ref myListControlEntity, 300, 1200, 100, 100);
                myActions.ScriptStartedUpdateStats();
                goto LineAfterDisplayWindow;
            }


myExit:
            int myExecCount = myActions.GetValueByKeyAsInt("ScriptTotalExecutions");

            myExecCount--;
            myActions.SetValueByKey("ScriptTotalExecutions", myExecCount.ToString());
            Application.Current.Shutdown();
        }