HP Forums

Full Version: Automatically generating program from a template.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

Automatically generating program from a template.
Is it at all possible to automatically generate program from a template. Lets say, I want to make some kind of library for functions or for doing something on sets of equations. For the template it would require to do some "staff" and this would be the same repetitious task for all entries in the library.
I do not now if it is at all possible to write a program on HP Prime using some input parameters and the given template already present on HP Prime. The program written on HP Prime would have to do some "staff" on a copy of the template and then rename the copy of the template and store it as a user program to show it in the "User Catalog" under some library name. Thank you.

Cheers
You can using the Programs() command. You can use it to create a new program from a string.
Hello Han,

Yes, it works. Exactly what I needed. Thanks.

Cheers
Where is that documented?
I saw something on the Forum about Programs() but thought it just made a List of Program Names.
Don't see it in the User Guide.
It is documented in the HP Prime Help: type "Programs" and press Help.

[Image: 1d0in.png]
A little off topic, but how Programs and Notes aren't harmful functions like the "Flags" in the older hps? I mean I like having these functions but aren't they destroying the isolated-"App" concept?
Hello,

I have problem with generating program to work the way I want.
To make things clear I want to make the distinction between generating an generated programs.
The generated program is the output from "Programs()" that I want in my "User Catalog". Everything is fine and the candidate for generated prgm. is a string that I can manipulate using "REPLACE" to do some changes to dummy placeholder substrings depending on what I want. The "REPLACE" replaces substring with another substring and that is OK too. The "Programs("name"):="string" spits out the program but then there is a problem because sometimes in the generated program I need to have string(s) preserved, when the generated prgm. is not a string anymore. What I do not know how to do is: how do I replace inside a string (future generated prgm.) something with another substring that will remain string after passing through "Programs()" or to put it differently: how to stick a substring inside a string that will stay string (when the generated prgm. is not a string anymore). I need that because inside the generated program, when it is in "User Catalog" ready to be used I need to do some processing that can only be done with strings because that is how CAS programs work in HP Prime, I think.

Cheers
(01-18-2015 07:04 AM)John P Wrote: [ -> ]how to stick a substring inside a string that will stay string (when the generated prgm. is not a string anymore).

You can use "" inside double quotes to represent a single ".
Or use the string command. STRING("abc") -- this saves you from having to keep track of the double quotes.
Hello,

I will try "STRING(abc)" or "STRING("abc")" later on. I can do what I want with the prgm. but I have to edit it manually when changing something inside. I wanted to do it automatically passing some parameters to generating prgm. to stick in the generated prgm. but as of today I do not know how.

Doing """ quote inside double quot or double quot inside double quot """" does nor work. Thanks.

Cheers
(01-18-2015 02:17 PM)Han Wrote: [ -> ]Or use the string command. STRING("abc") -- this saves you from having to keep track of the double quotes.

Hello,

Yes, it works like a charm with STRING(some_name). When the string for the generated prgm. passes through "Programs("name_for_the_prgm"):=string;" whatever is inside STRING(some_name) stays as a string so the generated program has no problems.

Cheers
Reference URL's