Form code in PowerShell Studio 2014/2015

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
clum09
Posts: 149
Joined: Thu Apr 24, 2008 9:11 am

Form code in PowerShell Studio 2014/2015

Post by clum09 » Fri Feb 06, 2015 7:15 am

Hello,

I like to see PowerShell Studio can allow me to see the form code within the Editor.

This is because when I write the GUI application, I like to integrate a sub form within the main form so that the sub form is loaded before the main form loads.

I use the sub form as a splash screen before the main form loads.

Currently, I have to export the form code from PowerShell Studio and do my final editing within PrimalScript in order to combine the sub form into the main form which requires a lot of work.

I don't know the reason why the form code has to be encrypted within PowerShell Studio 2014/2015 to begin with. Pleas explain the reason why.

Thank you.

User avatar
SAPIEN Support Forums
Posts: 945
Joined: Wed Dec 03, 2014 2:26 pm

Form code in PowerShell Studio 2014/2015

Post by SAPIEN Support Forums » Fri Feb 06, 2015 7:16 am

This is an automated post. A real person will respond soon.

Thank you for posting, clum09.

Did you remember to include the following?
  • 1. Product, version and build (e.g. Product: PowerShell Studio 2014, Version & Build: 4.1.71. Version and build information can be found in the product's About box accessed by clicking the blue icon with the 'i' in the upper right hand corner of the ribbon.)
    2. Specify if you are running a 32 or 64 bit version
    3. Specify your operating system and if it is 32 or 64 bit.
    4. Attach a screenshot if your issue can be seen on the screen
    5. Attach a zip file if you have multiple files (crash reports, log entries, etc.) related to your issue.
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Form code in PowerShell Studio 2014/2015

Post by davidc » Fri Feb 06, 2015 9:45 am

You should never have to edit the generated code. You can accomplish this using a project or by placing your custom code in the script editor. Otherwise you are creating extra work for yourself everytime you change the GUI.

Please refer to the following articles:

http://www.sapien.com/blog/2014/08/05/p ... -controls/

http://www.sapien.com/blog/2013/10/01/p ... ing-forms/

The only way to see the code, is to export the GUI script in the Deploy tab.


David
David
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 149
Joined: Thu Apr 24, 2008 9:11 am

Re: Form code in PowerShell Studio 2014/2015

Post by clum09 » Fri Feb 06, 2015 10:00 am

David,

Why is form code within PowerShell Studio encrypted to begin with and at the same time why does PowerShell Studio allow the export of the form code?

Tell me how I can have two form codes in one single script file within PowerShell Studio 2014/2015 since the the code in PowerShell Studio is completely encrypted.

That is that point I am trying to make. I need to see the form code within PowerShell Studio so that I don't have to export the code from PowerShell Studio to PrimalScript to combine the two form codes (one sub form and one main form) and do my final touch of the code.

Will PowerShell Studio allow me to create two forms within one editor?

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Form code in PowerShell Studio 2014/2015

Post by davidc » Fri Feb 06, 2015 10:45 am

PowerShell Studio's form script is not encrypted. What you are referring to is the recovery block. This allows you to recover your form, if you ever lose the original psf file.

You can disable this option in Options->Designer->Export->Embed recovery data in exported scripts.

If you scroll down the script, you will see the form code.

If you want to use multiple forms, you should use a project.
Depending on what you are doing, you can place your splash screen code in a separate ps1 file (or form) and call that it from your GUI script. Please refer to the second article.

You don't have to do it this way, but I'm just trying to save you time from having to modify an exported script over and over again.

David
David
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 149
Joined: Thu Apr 24, 2008 9:11 am

Re: Form code in PowerShell Studio 2014/2015

Post by clum09 » Fri Feb 06, 2015 9:29 pm

David,

I followed your instruction to reveal the form code by checking or unchecking the 'Embed recovery data in exported script' in the Options -> Designer within PowerShell Studio 2014/2015, but I cannot see the form code in either the Script tab or the Designer tab.

Where can I see the form code within PowerShell Studio 2014/2015?

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Form code in PowerShell Studio 2014/2015

Post by davidc » Sat Feb 07, 2015 3:48 pm

You must first export the script to see the generated code. Once you export the file, you can open it in the editor of your choosing.

If you open it in PowerShell Studio, just hit 'No' when it asks to open the original file.

David
David
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 149
Joined: Thu Apr 24, 2008 9:11 am

Re: Form code in PowerShell Studio 2014/2015

Post by clum09 » Mon Feb 09, 2015 12:16 pm

David,

What you said was to export the .psf file to a .ps1 file first.

Then re-open the this new .ps1 file within PowerShell Studio 2015 and answer the question "No" when it prompts me for the source file.

If I did that, I lost all my ability to edit the form within PowerShell Studio 2015 - I am working with the .ps1 file directly within PowerShell Studio 2015 instead.

Why did people want to go through such a hassle to create the form and export and then import it back to work with the .ps1 file?

I like to see PowerShell Studio be able to see the form code from the .psf file to start with - not the .ps1 file since loading the .ps1 will not have the ability to see the Designer tab in PowerShell Studio.

Having the ability to see the form code within the Designer tab allows me to add a sub form within the main form and the control the behavior of the forms right within PowerShell Studio instead of another script editor.

Currently whitin PowerShell Studio Desinger tab, the form code cannot be seen.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Form code in PowerShell Studio 2014/2015

Post by davidc » Mon Feb 09, 2015 3:01 pm

My whole point is you should not to edit the exported script. You asked how to see the code and I provided you with the steps.

The GUI to script is a one-way process. Therefore you can't edit the generated code and import it back into the designer. This one of the many reasons we do not display the script. In addition, the generated code is has been tested and verified to work as is.

If you want to add custom code, such as call another form, you can add that code directly in the script editor or use a project to handle multiple GUIs. The script in the edit editor will be processed before the GUI form is displayed.

David
David
SAPIEN Technologies, Inc.