Esempio n. 1
0
        public frmScriptEngine(string pathToFile, frmScriptBuilder builderForm)
        {
            filePath     = pathToFile;
            callBackForm = builderForm;
            InitializeComponent();

            //get engine settings
            engineSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;


            //setup logging
            taskt.Core.Logging.Setup("Script Execution Log");

            //define log appender
            var appenders = log.Logger.Repository.GetAppenders().OfType <FileAppender>().FirstOrDefault();

            //set log mode
            if (engineSettings.EnableDiagnosticLogging)
            {
                appenders.Threshold = log4net.Core.Level.Debug;
            }
            else
            {
                appenders.Threshold = log4net.Core.Level.Off;
            }


            createMissingVariables = engineSettings.CreateMissingVariablesDuringExecution;

            LogInfo("taskt Engine Loaded");
            LogInfo("Selected Script: " + pathToFile);


            advancedDebug = engineSettings.ShowAdvancedDebugOutput;

            if (advancedDebug)
            {
                lstSteppingCommands.Show();
                lblMainLogo.Show();
                pbBotIcon.Hide();
                lblAction.Hide();
            }
            else
            {
                lstSteppingCommands.Hide();
                lblMainLogo.Hide();
                pbBotIcon.Show();
                lblAction.Show();
            }


            //apply debug window setting
            if (!engineSettings.ShowDebugWindow)
            {
                this.Visible = false;
                this.Opacity = 0;
            }
        }
Esempio n. 2
0
        //events and methods
        #region Form Events/Methods
        public frmScriptEngine(string pathToFile, frmScriptBuilder builderForm, List <Core.Script.ScriptVariable> variables = null, bool blnCloseWhenDone = false)
        {
            InitializeComponent();

            if (variables != null)
            {
                Variables = variables;
            }

            CloseWhenDone = blnCloseWhenDone;

            //set callback form
            callBackForm = builderForm;

            //set file
            this.filePath = pathToFile;

            //get engine settings
            engineSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;

            //determine whether to show listbox or not
            advancedDebug = engineSettings.ShowAdvancedDebugOutput;

            //if listbox should be shown
            if (advancedDebug)
            {
                lstSteppingCommands.Show();
                lblMainLogo.Show();
                pbBotIcon.Hide();
                lblAction.Hide();
            }
            else
            {
                lstSteppingCommands.Hide();
                lblMainLogo.Hide();
                pbBotIcon.Show();
                lblAction.Show();
            }


            //apply debug window setting
            if (!engineSettings.ShowDebugWindow)
            {
                this.Visible = false;
                this.Opacity = 0;
            }

            //add hooks for hot key cancellation
            GlobalHook.HookStopped += new EventHandler(OnHookStopped);
            GlobalHook.StartEngineCancellationHook(engineSettings.CancellationKey);
        }
Esempio n. 3
0
        public frmScriptEngine(string pathToFile, frmScriptBuilder builderForm)
        {
            Core.Client.EngineBusy = true;

            filePath     = pathToFile;
            callBackForm = builderForm;
            InitializeComponent();

            //get engine settings
            engineSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;



            createMissingVariables = engineSettings.CreateMissingVariablesDuringExecution;



            LogInfo("taskt Engine Loaded");
            LogInfo("Selected Script: " + pathToFile);



            advancedDebug = engineSettings.ShowAdvancedDebugOutput;

            if (advancedDebug)
            {
                lstSteppingCommands.Show();
                lblMainLogo.Show();
                pbBotIcon.Hide();
                lblAction.Hide();
            }
            else
            {
                lstSteppingCommands.Hide();
                lblMainLogo.Hide();
                pbBotIcon.Show();
                lblAction.Show();
            }


            //apply debug window setting
            if (!engineSettings.ShowDebugWindow)
            {
                this.Visible = false;
                this.Opacity = 0;
            }
        }
Esempio n. 4
0
        public frmScriptEngine(string pathToFile, frmScriptBuilder builderForm)
        {
            filePath     = pathToFile;
            callBackForm = builderForm;
            InitializeComponent();

            //get engine settings
            engineSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;


            //setup logging
            taskt.Core.Logging.Setup("Script Execution Log");

            //define log appender
            var appenders = log.Logger.Repository.GetAppenders().OfType <FileAppender>().FirstOrDefault();

            //set log mode
            if (engineSettings.EnableDiagnosticLogging)
            {
                appenders.Threshold = log4net.Core.Level.Debug;
            }
            else
            {
                appenders.Threshold = log4net.Core.Level.Off;
            }

            LogInfo("taskt Engine Loaded");
            LogInfo("Selected Script: " + pathToFile);

            //apply debug window setting
            if (!engineSettings.ShowDebugWindow)
            {
                this.Visible = false;
                this.Opacity = 0;
            }
        }
Esempio n. 5
0
 public frmSettings(frmScriptBuilder sender)
 {
     scriptBuilderForm = sender;
     InitializeComponent();
 }
Esempio n. 6
0
        private void lstScriptActions_DoubleClick(object sender, EventArgs e)
        {
            if (lstScriptActions.SelectedItems.Count != 1)
            {
                return;
            }


            //bring up edit mode to edit the action
            ListViewItem selectedCommandItem = lstScriptActions.SelectedItems[0];


            //set selected command from the listview item tag object which was assigned to the command
            var currentCommand = (Core.AutomationCommands.ScriptCommand)selectedCommandItem.Tag;


            //check if editing a sequence
            if (currentCommand is Core.AutomationCommands.SequenceCommand)
            {
                if (editMode)
                {
                    MessageBox.Show("Embedding Sequence Commands within Sequence Commands not yet supported.");
                    return;
                }


                //get sequence events
                Core.AutomationCommands.SequenceCommand sequence = (Core.AutomationCommands.SequenceCommand)currentCommand;
                frmScriptBuilder newBuilder = new frmScriptBuilder();

                //append to new builder
                foreach (var cmd in sequence.v_scriptActions)
                {
                    newBuilder.lstScriptActions.Items.Add(CreateScriptCommandListViewItem(cmd));
                }


                //apply editor style format
                newBuilder.ApplyEditorFormat();

                //if data has been changed
                if (newBuilder.ShowDialog() == DialogResult.OK)
                {
                    //create updated list
                    List <Core.AutomationCommands.ScriptCommand> updatedList = new List <Core.AutomationCommands.ScriptCommand>();

                    //update to list
                    for (int i = 0; i < newBuilder.lstScriptActions.Items.Count; i++)
                    {
                        var command = (Core.AutomationCommands.ScriptCommand)newBuilder.lstScriptActions.Items[i].Tag;
                        updatedList.Add(command);
                    }

                    //apply new list to existing sequence
                    sequence.v_scriptActions = updatedList;

                    //update label
                    selectedCommandItem.Text = sequence.GetDisplayValue();
                }
            }
            else
            {
                //create new command editor form
                UI.Forms.frmCommandEditor editCommand = new UI.Forms.frmCommandEditor();

                //creation mode edit locks form to current command
                editCommand.creationMode = UI.Forms.frmCommandEditor.CreationMode.Edit;

                //create clone of current command so databinding does not affect if changes are not saved
                editCommand.selectedCommand = Core.Common.Clone(currentCommand);;

                //set variables
                editCommand.scriptVariables = this.scriptVariables;

                //show edit command form and save changes on OK result
                if (editCommand.ShowDialog() == DialogResult.OK)
                {
                    selectedCommandItem.Tag  = editCommand.selectedCommand;
                    selectedCommandItem.Text = editCommand.selectedCommand.GetDisplayValue(); //+ "(" + cmdDetails.SelectedVariables() + ")";
                    selectedCommandItem.SubItems.Add(editCommand.selectedCommand.GetDisplayValue());
                }
            }
        }
Esempio n. 7
0
        //events and methods
        #region Form Events/Methods
        public frmScriptEngine(string pathToFile, frmScriptBuilder builderForm, Logger engineLogger, List <ScriptVariable> variables = null,
                               List <ScriptElement> elements = null, bool blnCloseWhenDone = false, bool isDebugMode = false)
        {
            InitializeComponent();

            ScriptEngineLogger = engineLogger;

            IsDebugMode = isDebugMode;

            if (variables != null)
            {
                _scriptVariableList = variables;
            }

            if (elements != null)
            {
                _scriptElementList = elements;
            }

            CloseWhenDone = blnCloseWhenDone;

            //set callback form
            CallBackForm = builderForm;

            //set file
            FilePath = pathToFile;

            //get engine settings
            _engineSettings = new ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;

            if (isDebugMode)
            {
                _engineSettings.ShowDebugWindow         = true;
                _engineSettings.ShowAdvancedDebugOutput = true;
            }

            //determine whether to show listbox or not
            _advancedDebug = _engineSettings.ShowAdvancedDebugOutput;

            //if listbox should be shown
            if (_advancedDebug)
            {
                lstSteppingCommands.Show();
                lblMainLogo.Show();
                pbBotIcon.Hide();
                lblAction.Hide();
            }
            else
            {
                lstSteppingCommands.Hide();
                lblMainLogo.Hide();
                pbBotIcon.Show();
                lblAction.Show();
            }

            //apply debug window setting
            if (!_engineSettings.ShowDebugWindow)
            {
                Visible = false;
                Opacity = 0;
            }

            //add hooks for hot key cancellation
            GlobalHook.HookStopped += new EventHandler(OnHookStopped);
            GlobalHook.StartEngineCancellationHook(_engineSettings.CancellationKey);
        }