Access Script

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
This topic is 14 years and 3 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
doom969
Posts: 8
Last visit: Wed Jun 08, 2011 8:58 am

Access Script

Post by doom969 »

Hello,
Is there any way to access the complete script code in PrimalForm ? I know you can access parts of the script in the script tab but it seems you can only access certain parts. If you export the script to a ps1, you can see the complete script but then you cant reopen it and access the form designer...
I did a form and need to add script parameters. I cant do it right now unless i export to a ps1, bu then if i ever need to change something in the form i'll have to manually edit it in the code or start from scratch.

Any help ?
Thanks
Doom969
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Access Script

Post by Alexander Riedel »

Generally there should be no need to modify the generated code. Specifically since changes to that code would not be preserved anyway.

If you need to initialize any form fields this should be done in the load event handler of the specific form.

If you can be more specific on what you would need to change we can look closer into it.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
doom969
Posts: 8
Last visit: Wed Jun 08, 2011 8:58 am

Access Script

Post by doom969 »

Hello and thank you for your answer.

Like I said, i want to declare script parameters, so i'd need to access the first lines of the actual script. Lets say for example the script would have 2 exec modes : "./script config" and ./script execute".

Also, on an unrelated note, is there a way in the designer to design a 2nd form for the script ? Lets say i have a button to browse server and when i click on it i want to open a new form to check options and select the server and then click save and return to the main form with the data.

Thanks a lot
Doom969
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Access Script

Post by davidc »

I recommend creating a function with the params you need and calling it from the OnLoadForm Event (double click on Form in designer) and store the results into (script scope) variables.

As for the multiple forms, it
David
SAPIEN Technologies, Inc.
User avatar
doom969
Posts: 8
Last visit: Wed Jun 08, 2011 8:58 am

Access Script

Post by doom969 »

Thank you for your answers.
Have a nice day.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Access Script

Post by davidc »

A better alternative would be to use the Read-Host command, that way you needn't create a function to prompt for parameters.
David
David
SAPIEN Technologies, Inc.
User avatar
doom969
Posts: 8
Last visit: Wed Jun 08, 2011 8:58 am

Access Script

Post by doom969 »

Yeah, that doesn't really work for me because i wanted to have a script parameter named "execute" which would run the script unattended, reading value from the registry.
so if the script runs unattended i can prompt a user for the execute mode.
thanks
This topic is 14 years and 3 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.