none
Loading a Child Powershell form from a Parent Powershell form RRS feed

  • Question

  • Hi Scripting Guy, 

    Many of my searches regarding the Powershell scripting ended up in your forum.. Thanks a lot !!!. 

    I have moved from CLI scripting to GUI Scripting now. 

    I am trying to develop a Powershell form and I am stuck. Hope you can help. 

    Here is the situation :

    I am building a parent form which will have some set of buttons, while clicking the buttons it should load another form with some different controls on it. 

    I managed to accomplish this task using the Sapien Powershell Studio, but it is a trial version and could not completely serve my purpose. I am now using the Admin Script Editor for creating the forms, but as in Sapien Powershell Studio there is no option called Projects which will connect multiple forms in to a single entity. 

    Need your help.

    1. Pls let me know how to load a new form via a button Click in generic Windows Powershell forms or using the Admin Script editor, either way will be happy to continue my task... 

    Thanks in advance. 

    Regards,

    Sheik.

    Thursday, May 7, 2015 4:04 PM

Answers

All replies

  • Put form in separate file or function and just call it.  There is no trick as it is just another script.

    Sapien uses a function name Call_FormName so just typing that in opens the form.


    \_(ツ)_/

    Thursday, May 7, 2015 4:14 PM
  • Hi Jrv,

    Thanks for your advice...

    I tried putting the form in a separate function and it works perfectly. I am afraid that the script might be slow after putting a lot of boxes inside the new form... As of now, I have moved one step closer to my goal...

    Could you please explain your suggestion about calling the separate file- how to do that with an example. I used the same function as below in Sapien Powershell studio (after creating a project) and it works fine, but when I try in Powershell its not recognizing the filename.

        if ((Call-TestService_psf) -eq "OK")
        {
            $formServiceHealthMonitor_Load
        }

    If I can call the file, it will be easier for me rather than writing the new form controls thru script.

    Regards,

    Sheik. 

    Friday, May 8, 2015 4:18 AM
  • Just put the script in a separate file and call it.  Do you know how to call a script file?

    \_(ツ)_/

    Friday, May 8, 2015 5:46 AM
  • No Jrv. Could you please advice?
    Sunday, May 10, 2015 3:10 AM
  • We call a script file in PowerShell like this:

    c:\temp\myscript.ps1

    It is that easy.


    \_(ツ)_/

    Sunday, May 10, 2015 3:18 AM
  • Great. !!!.Thanks for your advice Jrv.

    Monday, May 11, 2015 4:23 AM