Skip to content

Commit

Permalink
commands move to group folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rcktrncn committed Jul 31, 2021
1 parent 75d1419 commit c1db740
Show file tree
Hide file tree
Showing 199 changed files with 1,702 additions and 1,604 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public override void RunCommand(object sender)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(v_WebRequestURL.ConvertToUserVariable(sender));
request.Method = "GET";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
if (v_WebRequestCredentials == "Yes")
{
request.Credentials = CredentialCache.DefaultCredentials;
}

request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
if (v_WebRequestCredentials == "Yes")
{
request.Credentials = CredentialCache.DefaultCredentials;
}

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Stream dataStream = response.GetResponseStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,59 @@
using taskt.UI.Forms;

namespace taskt.Core.Automation.Commands
{
[Serializable]
[Attributes.ClassAttributes.Group("IE Browser Commands")]
[Attributes.ClassAttributes.Description("This command allows you to close the associated IE web browser")]
[Attributes.ClassAttributes.ImplementationDescription("This command implements the 'InternetExplorer' application object from SHDocVw.dll to achieve automation.")]
public class IEBrowserCloseCommand : ScriptCommand
{
[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the instance name")]
public string v_InstanceName { get; set; }

public IEBrowserCloseCommand()
{
this.CommandName = "IEBrowserCloseCommand";
this.SelectionName = "Close Browser";
this.CommandEnabled = true;
this.v_InstanceName = "";
{
[Serializable]
[Attributes.ClassAttributes.Group("IE Browser Commands")]
[Attributes.ClassAttributes.Description("This command allows you to close the associated IE web browser")]
[Attributes.ClassAttributes.ImplementationDescription("This command implements the 'InternetExplorer' application object from SHDocVw.dll to achieve automation.")]
public class IEBrowserCloseCommand : ScriptCommand
{
[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the instance name")]
public string v_InstanceName { get; set; }

public IEBrowserCloseCommand()
{
this.CommandName = "IEBrowserCloseCommand";
this.SelectionName = "Close Browser";
this.CommandEnabled = true;
this.v_InstanceName = "";
this.CustomRendering = true;
}

public override void RunCommand(object sender)
{
}

public override void RunCommand(object sender)
{
var engine = (Core.Automation.Engine.AutomationEngineInstance)sender;

var vInstance = v_InstanceName.ConvertToUserVariable(engine);

var browserObject = engine.GetAppInstance(vInstance);


var browserInstance = (SHDocVw.InternetExplorer)browserObject;
browserInstance.Quit();

engine.RemoveAppInstance(vInstance);
}


var browserInstance = (SHDocVw.InternetExplorer)browserObject;
browserInstance.Quit();

engine.RemoveAppInstance(vInstance);
}

public override List<Control> Render(frmCommandEditor editor)
{
base.Render(editor);

RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_InstanceName", this, editor));

if (editor.creationMode == frmCommandEditor.CreationMode.Add)
{
this.v_InstanceName = editor.appSettings.ClientSettings.DefaultBrowserInstanceName;
if (editor.creationMode == frmCommandEditor.CreationMode.Add)
{
this.v_InstanceName = editor.appSettings.ClientSettings.DefaultBrowserInstanceName;
}

return RenderedControls;
}

public override string GetDisplayValue()
{
return base.GetDisplayValue() + " [Instance Name: '" + v_InstanceName + "']";
}
}

public override string GetDisplayValue()
{
return base.GetDisplayValue() + " [Instance Name: '" + v_InstanceName + "']";
}
}

}
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml.Serialization;
using taskt.UI.CustomControls;
using taskt.UI.Forms;

namespace taskt.Core.Automation.Commands
{
[Serializable]
[Attributes.ClassAttributes.Group("IE Browser Commands")]
[Attributes.ClassAttributes.Description("This command allows you to create a new IE web browser session.")]
[Attributes.ClassAttributes.ImplementationDescription("This command implements the 'InternetExplorer' application object from SHDocVw.dll to achieve automation.")]
public class IEBrowserCreateCommand : ScriptCommand
{
[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the instance name")]
public string v_InstanceName { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Instance Tracking (after task ends)")]
[Attributes.PropertyAttributes.PropertyUISelectionOption("Forget Instance")]
[Attributes.PropertyAttributes.PropertyUISelectionOption("Keep Instance Alive")]
[Attributes.PropertyAttributes.InputSpecification("Specify if taskt should remember this instance name after the script has finished executing.")]
[Attributes.PropertyAttributes.SampleUsage("Select **Forget Instance** to forget the instance or **Keep Instance Alive** to allow subsequent tasks to call the instance by name.")]
[Attributes.PropertyAttributes.Remarks("Calling the **Close Browser** command or ending the browser session will end the instance. This command only works during the lifetime of the application. If the application is closed, the references will be forgetten automatically.")]
public string v_InstanceTracking { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the URL to navigate to")]
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
public string v_URL { get; set; }

public IEBrowserCreateCommand()
{
this.CommandName = "IEBrowserCreateCommand";
this.SelectionName = "Create Browser";
this.v_InstanceName = "";
this.CommandEnabled = true;
this.CustomRendering = true;
}

public override void RunCommand(object sender)
{
var engine = (Core.Automation.Engine.AutomationEngineInstance)sender;

var instanceName = v_InstanceName.ConvertToUserVariable(sender);

SHDocVw.InternetExplorer newBrowserSession = new SHDocVw.InternetExplorer();
try
{
newBrowserSession.Navigate(v_URL.ConvertToUserVariable(sender));
WaitForReadyState(newBrowserSession);
newBrowserSession.Visible = true;
}
catch (Exception ex) { }

//add app instance
engine.AddAppInstance(instanceName, newBrowserSession);

//handle app instance tracking
if (v_InstanceTracking == "Keep Instance Alive")
{
GlobalAppInstances.AddInstance(instanceName, newBrowserSession);
}

}

public static void WaitForReadyState(SHDocVw.InternetExplorer ieInstance)
{
try
{
DateTime waitExpires = DateTime.Now.AddSeconds(15);

do
{
System.Threading.Thread.Sleep(500);
}

while ((ieInstance.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) && (waitExpires > DateTime.Now));
}
catch (Exception ex) { }
}

public override List<Control> Render(frmCommandEditor editor)
{
base.Render(editor);

RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_InstanceName", this, editor));
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_URL", this, editor));

if (editor.creationMode == frmCommandEditor.CreationMode.Add)
{
this.v_InstanceName = editor.appSettings.ClientSettings.DefaultBrowserInstanceName;
}

return RenderedControls;
}

public override string GetDisplayValue()
{
return base.GetDisplayValue() + " [Instance Name: '" + v_InstanceName + "']";
}
}

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml.Serialization;
using taskt.UI.CustomControls;
using taskt.UI.Forms;

namespace taskt.Core.Automation.Commands
{
[Serializable]
[Attributes.ClassAttributes.Group("IE Browser Commands")]
[Attributes.ClassAttributes.Description("This command allows you to create a new IE web browser session.")]
[Attributes.ClassAttributes.ImplementationDescription("This command implements the 'InternetExplorer' application object from SHDocVw.dll to achieve automation.")]
public class IEBrowserCreateCommand : ScriptCommand
{
[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the instance name")]
public string v_InstanceName { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Instance Tracking (after task ends)")]
[Attributes.PropertyAttributes.PropertyUISelectionOption("Forget Instance")]
[Attributes.PropertyAttributes.PropertyUISelectionOption("Keep Instance Alive")]
[Attributes.PropertyAttributes.InputSpecification("Specify if taskt should remember this instance name after the script has finished executing.")]
[Attributes.PropertyAttributes.SampleUsage("Select **Forget Instance** to forget the instance or **Keep Instance Alive** to allow subsequent tasks to call the instance by name.")]
[Attributes.PropertyAttributes.Remarks("Calling the **Close Browser** command or ending the browser session will end the instance. This command only works during the lifetime of the application. If the application is closed, the references will be forgetten automatically.")]
public string v_InstanceTracking { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the URL to navigate to")]
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
public string v_URL { get; set; }

public IEBrowserCreateCommand()
{
this.CommandName = "IEBrowserCreateCommand";
this.SelectionName = "Create Browser";
this.v_InstanceName = "";
this.CommandEnabled = true;
this.CustomRendering = true;
}

public override void RunCommand(object sender)
{
var engine = (Core.Automation.Engine.AutomationEngineInstance)sender;

var instanceName = v_InstanceName.ConvertToUserVariable(sender);

SHDocVw.InternetExplorer newBrowserSession = new SHDocVw.InternetExplorer();
try
{
newBrowserSession.Navigate(v_URL.ConvertToUserVariable(sender));
WaitForReadyState(newBrowserSession);
newBrowserSession.Visible = true;
}
catch (Exception ex) { }

//add app instance
engine.AddAppInstance(instanceName, newBrowserSession);

//handle app instance tracking
if (v_InstanceTracking == "Keep Instance Alive")
{
GlobalAppInstances.AddInstance(instanceName, newBrowserSession);
}

}

public static void WaitForReadyState(SHDocVw.InternetExplorer ieInstance)
{
try
{
DateTime waitExpires = DateTime.Now.AddSeconds(15);

do
{
System.Threading.Thread.Sleep(500);
}

while ((ieInstance.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) && (waitExpires > DateTime.Now));
}
catch (Exception ex) { }
}

public override List<Control> Render(frmCommandEditor editor)
{
base.Render(editor);

RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_InstanceName", this, editor));
RenderedControls.AddRange(CommandControls.CreateDefaultInputGroupFor("v_URL", this, editor));

if (editor.creationMode == frmCommandEditor.CreationMode.Add)
{
this.v_InstanceName = editor.appSettings.ClientSettings.DefaultBrowserInstanceName;
}

return RenderedControls;
}

public override string GetDisplayValue()
{
return base.GetDisplayValue() + " [Instance Name: '" + v_InstanceName + "']";
}
}

}
Loading

0 comments on commit c1db740

Please sign in to comment.