Form code PowerShell Studio?

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 9 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
ath@adm.ku.dk
Posts: 2
Last visit: Tue May 20, 2014 2:58 am

Form code PowerShell Studio?

Post by ath@adm.ku.dk »

Hey,

In the powershell studio 2014 trial version I have, the form code is encrypted in the .PSF file?
Is there anyway to se the code I create with the GUI in powershell studio 2014?

Kind Regards Alex
User avatar
Ferdinand Rios
Posts: 373
Last visit: Fri Sep 16, 2022 1:24 pm

Re: Form code PowerShell Studio?

Post by Ferdinand Rios »

In the Deploy Tab there is an EXPOT option that you can use to export it to a PS1 file. This will show you all of the code (and have huge chunks of binary data in it as well.)

You cannot change this ps1 file and then reimport that into PowerShell Studio. All changes must be made in the PowerShell Studio designer.
F.G. Rios
User avatar
ath@adm.ku.dk
Posts: 2
Last visit: Tue May 20, 2014 2:58 am

Re: Form code PowerShell Studio?

Post by ath@adm.ku.dk »

Yes this is the powershell script.
But this is not the form code generated by the GUI.

In earlier versions it was possible to see the form code.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Form code PowerShell Studio?

Post by Alexander Riedel »

I am not sure what you mean. It is perfectly visible just as in previous versions.
PowerShell Code
Double-click the code block to select all.
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: 146955d8-cf65-4f57-b48b-473e05bc8669
# Source File: testdialog.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
cRUAAB+LCAAAAAAABADdWFtv2jAYfZ+0/xDlYU8RkIRLq0EkoKs0tV0rYN3eJsf5AK+OjRynJfv1
cy6wtbTEyQaqKiSUhPNdz/EXm/4EML8HkZwhiQx1ERHOBqZjeu/fGUb/WpAFYYieEwpfUAiehEgG
BFG+aKyieb+5A8jN/J+ApSGTFQzMaRJJCBvfCAv4Q9Q45yLMvy3juZ8s47bIot1opR/LGMdUxgIG
DGIpELWMm9inBF9AMuN3wAZ+r4c6uNO1T902tE5OTYOpVAbmXPmzTQMvCQ2EwpljzqTgNMqrU4ne
CL4CIZPCYIgxrOQolpKzDUahJjAHZY+hgPkZ4PrCNJobR82Npxc8jykBJqfkF5iec9K2DKfrlBql
/RhxEYCYyoQqy3OyhuAsa3+p8RVak1DFG/G1MkQ0gnITwqqapJybXtboUuxUIiFveEQkSds7Vg1R
lWEBwEptZ7CWKicVZxf66V55KnCXHAU5Lnv6I73vN7PrDbxcnLkADi7PXEbuPoHuNuKSY5T3zz7t
WEZvV0UvkVSE08DnMu0p944OfIb8zywApZmuDjpjUj+ZrxHckihGNFsDI4TvxpxyYXozET+jz2ZO
7ysl26lPdtcy2rtrbD/ZOuKoTXanItk6ybwpsve+evaT3bMMuyrZOvjaZLcrkq2TzKHJHi8B36l3
2cHpxmkgn6/rj3Kn0iTfxtNm3G6lWw4tEreUawkko7xKPm+O9PojXZHerk66/kyvQ7qO98ekv4ax
fnTS6492p9Jk38Y7KOk63h+T/hrG+1Hf5elhrwrjQ4aXaa0jrqzVSXdCFkup0bT8cDeBSGVretcX
GiZP9g2O06u4cdCKUnvn0NIW1wcUrj5qJfMP0np8M4wiCJUMINpgiyeJV8jqCjG0gFCdHxvDWFGZ
tfqPvFxdebm2P3dPOl0UuN02uGrzvI30NHIYYS4o8f+DiPdEOdCyKY94JtADYYs6sVruvDPvzW07
6LSQi0pjHaceJNFRAn0P6XEKIkItEC6SKYh7gqGWLKpS1RhzAUcpr6hKDQlV2gFq297mU6Xf/Psv
Vu83eGJMxXEVAAA=#>
#endregion
#========================================================================
# Code Generated By: SAPIEN Technologies, Inc., PowerShell Studio 2014 v4.1.47
# Generated On: 5/20/2014 3:16 AM
# Generated By: 
# Organization: 
#========================================================================
#----------------------------------------------
#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 modules 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 modules when the application exits
	
	$script:ExitCode = 0 #Set the exit code for the Packager
}

#endregion Application Functions

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-testdialog_psf {

	#----------------------------------------------
	#region Import the Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load('mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
	[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')
	[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
	#endregion Import Assemblies

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object 'System.Windows.Forms.Form'
	$button3 = New-Object 'System.Windows.Forms.Button'
	$button2 = New-Object 'System.Windows.Forms.Button'
	$button1 = New-Object 'System.Windows.Forms.Button'
	$checkbox3 = New-Object 'System.Windows.Forms.CheckBox'
	$checkbox2 = New-Object 'System.Windows.Forms.CheckBox'
	$checkbox1 = New-Object 'System.Windows.Forms.CheckBox'
	$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
		
	}
	
	# --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
		{
			$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.SuspendLayout()
	#
	# form1
	#
	$form1.Controls.Add($button3)
	$form1.Controls.Add($button2)
	$form1.Controls.Add($button1)
	$form1.Controls.Add($checkbox3)
	$form1.Controls.Add($checkbox2)
	$form1.Controls.Add($checkbox1)
	$form1.Controls.Add($buttonOK)
	$form1.AcceptButton = $buttonOK
	$form1.ClientSize = '284, 262'
	$form1.FormBorderStyle = 'FixedDialog'
	$form1.MaximizeBox = $False
	$form1.MinimizeBox = $False
	$form1.Name = "form1"
	$form1.StartPosition = 'CenterScreen'
	$form1.Text = "Form"
	$form1.add_Load($FormEvent_Load)
	#
	# button3
	#
	$button3.Location = '195, 72'
	$button3.Name = "button3"
	$button3.Size = '75, 23'
	$button3.TabIndex = 6
	$button3.Text = "button3"
	$button3.UseVisualStyleBackColor = $True
	#
	# button2
	#
	$button2.Location = '196, 41'
	$button2.Name = "button2"
	$button2.Size = '75, 23'
	$button2.TabIndex = 5
	$button2.Text = "button2"
	$button2.UseVisualStyleBackColor = $True
	#
	# button1
	#
	$button1.Location = '197, 11'
	$button1.Name = "button1"
	$button1.Size = '75, 23'
	$button1.TabIndex = 4
	$button1.Text = "button1"
	$button1.UseVisualStyleBackColor = $True
	#
	# checkbox3
	#
	$checkbox3.Location = '12, 72'
	$checkbox3.Name = "checkbox3"
	$checkbox3.Size = '104, 24'
	$checkbox3.TabIndex = 3
	$checkbox3.Text = "checkbox3"
	$checkbox3.UseVisualStyleBackColor = $True
	#
	# checkbox2
	#
	$checkbox2.Location = '12, 42'
	$checkbox2.Name = "checkbox2"
	$checkbox2.Size = '104, 24'
	$checkbox2.TabIndex = 2
	$checkbox2.Text = "checkbox2"
	$checkbox2.UseVisualStyleBackColor = $True
	#
	# checkbox1
	#
	$checkbox1.Location = '12, 11'
	$checkbox1.Name = "checkbox1"
	$checkbox1.Size = '104, 24'
	$checkbox1.TabIndex = 1
	$checkbox1.Text = "checkbox1"
	$checkbox1.UseVisualStyleBackColor = $True
	#
	# buttonOK
	#
	$buttonOK.Anchor = 'Bottom, Right'
	$buttonOK.DialogResult = 'OK'
	$buttonOK.Location = '197, 227'
	$buttonOK.Name = "buttonOK"
	$buttonOK.Size = '75, 23'
	$buttonOK.TabIndex = 0
	$buttonOK.Text = "&OK"
	$buttonOK.UseVisualStyleBackColor = $True
	$form1.ResumeLayout($false)
	#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-testdialog_psf | Out-Null
	#Perform cleanup
	OnApplicationExit
}
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Form code PowerShell Studio?

Post by Alexander Riedel »

Why are you so concerned about seeing the form code anyway?
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 9 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.