165 lines
5.8 KiB
PowerShell
165 lines
5.8 KiB
PowerShell
#========================================================================
|
|
# Code Generated By: SAPIEN Technologies, Inc., PowerShell Studio 2012 v3.1.13
|
|
# Generated On: 12/18/2012 2:15 PM
|
|
# Generated By: James Vierra
|
|
# Organization: Designed Systems & Services
|
|
#========================================================================
|
|
#----------------------------------------------
|
|
#region Application Functions
|
|
#----------------------------------------------
|
|
function OnApplicationLoad {
|
|
#Note: This function is not called in Projects
|
|
#Note: This function runs before the form is created
|
|
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
|
|
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
|
|
#Important: Form controls cannot be accessed in this function
|
|
#TODO: Add snapins and custom code to validate the application load
|
|
|
|
return $true #return true for success or false for failure
|
|
}
|
|
function OnApplicationExit {
|
|
#Note: This function is not called in Projects
|
|
#Note: This function runs after the form is closed
|
|
#TODO: Add custom code to clean up and unload snapins when the application exits
|
|
|
|
$script:ExitCode = 0 #Set the exit code for the Packager
|
|
}
|
|
#endregion Application Functions
|
|
#----------------------------------------------
|
|
# Generated Form Function
|
|
#----------------------------------------------
|
|
function Call-Demo-WebBrowserCtl_pff {
|
|
#----------------------------------------------
|
|
#region Import the Assemblies
|
|
#----------------------------------------------
|
|
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
|
|
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
|
|
[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
|
|
[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
|
|
[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
|
|
[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
|
|
[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
|
|
#endregion Import Assemblies
|
|
#----------------------------------------------
|
|
#region Generated Form Objects
|
|
#----------------------------------------------
|
|
[System.Windows.Forms.Application]::EnableVisualStyles()
|
|
$form1 = New-Object 'System.Windows.Forms.Form'
|
|
$buttonGetElement = New-Object 'System.Windows.Forms.Button'
|
|
$webbrowser1 = New-Object 'System.Windows.Forms.WebBrowser'
|
|
$buttonOK = New-Object 'System.Windows.Forms.Button'
|
|
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
|
|
#endregion Generated Form Objects
|
|
#----------------------------------------------
|
|
# User Generated Script
|
|
#----------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$FormEvent_Load={
|
|
#TODO: Initialize Form Controls here
|
|
$webbrowser1.navigate("http://www.google.com")
|
|
}
|
|
|
|
$buttonGetElement_Click={
|
|
#TODO: Place custom script here
|
|
$el=$webbrowser1.Document.GetElementById('gstyle')
|
|
[System.Windows.Forms.MessageBox]::Show($el.InnerHtml)
|
|
|
|
}
|
|
|
|
# --End User Generated Script--
|
|
#----------------------------------------------
|
|
#region Generated Events
|
|
#----------------------------------------------
|
|
|
|
$Form_StateCorrection_Load=
|
|
{
|
|
#Correct the initial state of the form to prevent the .Net maximized form issue
|
|
$form1.WindowState = $InitialFormWindowState
|
|
}
|
|
|
|
$Form_Cleanup_FormClosed=
|
|
{
|
|
#Remove all event handlers from the controls
|
|
try
|
|
{
|
|
$buttonGetElement.remove_Click($buttonGetElement_Click)
|
|
$form1.remove_Load($FormEvent_Load)
|
|
$form1.remove_Load($Form_StateCorrection_Load)
|
|
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
|
|
}
|
|
catch [Exception]
|
|
{ }
|
|
}
|
|
#endregion Generated Events
|
|
#----------------------------------------------
|
|
#region Generated Form Code
|
|
#----------------------------------------------
|
|
#
|
|
# form1
|
|
#
|
|
$form1.Controls.Add($buttonGetElement)
|
|
$form1.Controls.Add($webbrowser1)
|
|
$form1.Controls.Add($buttonOK)
|
|
$form1.AcceptButton = $buttonOK
|
|
$form1.ClientSize = '520, 475'
|
|
$form1.FormBorderStyle = 'FixedDialog'
|
|
$form1.MaximizeBox = $False
|
|
$form1.MinimizeBox = $False
|
|
$form1.Name = "form1"
|
|
$form1.StartPosition = 'CenterScreen'
|
|
$form1.Text = "Form"
|
|
$form1.add_Load($FormEvent_Load)
|
|
#
|
|
# buttonGetElement
|
|
#
|
|
$buttonGetElement.Location = '50, 438'
|
|
$buttonGetElement.Name = "buttonGetElement"
|
|
$buttonGetElement.Size = '84, 24'
|
|
$buttonGetElement.TabIndex = 2
|
|
$buttonGetElement.Text = "Get Element"
|
|
$buttonGetElement.UseVisualStyleBackColor = $True
|
|
$buttonGetElement.add_Click($buttonGetElement_Click)
|
|
#
|
|
# webbrowser1
|
|
#
|
|
$webbrowser1.Location = '39, 127'
|
|
$webbrowser1.MinimumSize = '20, 20'
|
|
$webbrowser1.Name = "webbrowser1"
|
|
$webbrowser1.Size = '569, 385'
|
|
$webbrowser1.TabIndex = 1
|
|
#
|
|
# buttonOK
|
|
#
|
|
$buttonOK.Anchor = 'Bottom, Right'
|
|
$buttonOK.DialogResult = 'OK'
|
|
$buttonOK.Location = '433, 440'
|
|
$buttonOK.Name = "buttonOK"
|
|
$buttonOK.Size = '75, 23'
|
|
$buttonOK.TabIndex = 0
|
|
$buttonOK.Text = "OK"
|
|
$buttonOK.UseVisualStyleBackColor = $True
|
|
#endregion Generated Form Code
|
|
#----------------------------------------------
|
|
#Save the initial state of the form
|
|
$InitialFormWindowState = $form1.WindowState
|
|
#Init the OnLoad event to correct the initial state of the form
|
|
$form1.add_Load($Form_StateCorrection_Load)
|
|
#Clean up the control events
|
|
$form1.add_FormClosed($Form_Cleanup_FormClosed)
|
|
#Show the Form
|
|
return $form1.ShowDialog()
|
|
} #End Function
|
|
#Call OnApplicationLoad to initialize
|
|
if((OnApplicationLoad) -eq $true)
|
|
{
|
|
#Call the form
|
|
Call-Demo-WebBrowserCtl_pff | Out-Null
|
|
#Perform cleanup
|
|
OnApplicationExit
|
|
} |