Can Templates store #AT embed locations and add code (template or clarion source) to the stored #AT embed location?

So I’m aware of this thread and the Embed info template. Template to add correct template embeded point - ClarionHub

What I wanted to do was store the #AT(%EmbedIdentifier) identified from using the #Embed Info template inside a template using a button multi(%list), inline and then at generation time, cycle through all the %list entries and populate the embed points with whatever else is stored in the multi(%list).

Is this possible?

I don’t believe you can do that.
You can use one template to write out to another .tpw or .tpl file. Basically, use a template to write another template.

That’s an interesting question. It’s a one-way operation:

Your template can sense which embed it’s in during generation, and I suppose it could write out some type of repository listing those. Later interactions with #PROMPTs could read that saved information and present it as a series of choices.

It definitely can’t be done without a generation phase, so definitely a cart-before-the-horse scenario. At least two passes will always be required.

So I tried something last night which I wondered if it would work but it didnt so the fall back plan is to now try what you are suggesting, but now I’ve to get into redirection file editing & management ie copy it into the app’s folder which has opened up other possibilities that I might explore to tackle another age old problem of adding embeds to the shipping templates or 3rd party without modifying the original. This will probably mean having an app template sub folder and an app class sub folder.

#! This doesnt work, it wants the #EndIF before the #AT
#!For(%ABCEmbedsList)
#!IF(%ABCEmbedsSection='#Application')
    #!AT(%(Evaluate(%ABCEmbedsProcedureAT)))
#! %(Evaluate(%ABCEmbedsProcedureAT)
    #!IF(%ABCEmbedsAction=1)
#!SendDebugMessage
    #!Else
#!Special Embed Code
    #!EndIF
#!EndAT
#!EndIF
#!EndFor

The embed info template threw up an interesting behaviour which is you have to drop to source to see the “final cut” so to speak and thats when I discovered I can then interact with other template symbols from SV & 3rd party templates so I was exploring what else I could get this to do over and above what I’ve already discovered, but for this particular problem its not worked, so now I’ve got to dive into the redirection file to discover what errors it throws and what takes precedence, when I start copying things, using the same name in a app subfolder and things like that.

These will probably explain more quickly than words what I’ll be getting the templates to do.
I cant find a template symbol to say the registry is readonly, so I have a work around as this will force the programmer to close the app and then reload the new templates that have been generated by this template.


You cant use the hash symbol in a drop but you can in the default.
Wont work
#Prompt('Section',Drop('#Application|#Module|#Procedure')),%ABCEmbedsSection,Default('#Procedure')
Will work
#Prompt('Section',Drop('Application|Module|Procedure')),%ABCEmbedsSection,Default('Procedure')


Embed code has to be either additional valid template code or valid Clarion (or any other language) source code.

And then using a variation of the Embed Info template to get the embed info out and into the template. At this point, I’m also debating whether to make it possible to add our own embed points to any template beit shipping or 3rd party so this might spawn and become its own template in its own right.

The templates can be very arcane, and no one really knows how they work in their entirety (not even Soft Velocity). You’re trying to stretch the functionality well beyond what it was intended to do, and I strongly suspect you won’t achieve your goal.

I dont know until I try if it will, I cant see any reason for it to not work because its not that arcane.

Edit.

So the C6 IDE uses the property.clw to find the 16bit hex address to load some of the IDE code.
If you took the property.clw file out of the libsrc folder it will throw an error message 3 times but will still load.
There are Props:xyz listed in this file which dont exist in the help docs, eg prop:licence
The equates.clw has a line in it to include the property.clw file.
If the equates.clw is missing, the ide fails to load, but as long as a blank property.clw exists the ide will still load.
Likewise the IDE will load and complain if the C60ee.red file is missing.

Through deduction alone its possible to work out whats going on with the templates.

Anyway I’ve got a handle on the IDE loading order so it is possible to create a project folder or app file specific template registry along with a project folder or app file specific redirection file.

It also means my template can now modify any other template for the purpose of adding new embed points, and new class methods/properties if required on a project folder or app file specific basis if I want to leave the shipping stuff as it is.

This also means its possible to do version control with 3rd party template & class addons and roll back if need be easily. This works in C6, need to test it in C11 as there are changes there and the build version to factor in.

Edit2
I should add simply removing the c60ee.red file from the \bin folder and then loading the ide is what started all of this off and then its a case of following the breadcrumbs :grinning:

1 Like