Why does the AppGen complain about Section headers when I use #Include('SomeFile.ext')?

Tags: #<Tag:0x00007f224a8a78c0>

So when I add
#Include('SomeFile.EXT')
to a template (tpw or tpl) it doesnt matter, when I load an app before it loads the appgen I get a message saying
Error:Expected a Section Header

The only reference to section header is in the main language help doc
Include('filename.ext','Section Header')

Any one know?

TIA

Perhaps if you look at another #INCLUDE statement, then look at the top of the TPW that’s referenced by the #INCLUDE, you could glean what’s expected?

What are you hinting at? What should I look for?

Look at the start of the files #INCLUDE(d) by CW.TPL or ABCHAIN.TPL and you’ll see that the first non-comment line has to be a section header like
#CODE or
#PROCEDURE or
#MODULE or
#CONTROL etc

1 Like

I think I’ve figured it out. I found this in the help docs:
#Append('filename'),Section('GlobalEmbeds')

#Section('GlobalEmbeds')
#EndSection

So where I had been using
#Include('filename.tpw'),Once
I changed that for
#Append('filename.tpw'),Section('GlobalEmbeds')

and then in the filename.tpw file I have
#Section(‘GlobalEmbeds’)
#At(blah)
#EndAt
#EndSection

and I’m not getting any errors when the appgen loads.

You see when you look up #Include in the C11 help docs, there is zero mention of #Append or #Section/#EndSection, but the #Append appears to be the same as #Include('Filename.tpw'),Once from what I can tell, and then just wrap the template code in Filename.tpw with the #Section/#EndSection and so far it works in my limited tests. :grinning:

#APPEND and #INCLUDE are used for completely different purposes.
#INCLUDE adds template code that’s used by the AppGen
#APPEND adds source code that’s added to that generated by the templates

1 Like

Well the section of template that was causing the error msg to appear when loading the appgen was:
#At / #EndAt

#Section('GlobalEmbeds')
#AT(%GlobalMap),Once
#Call(%grpGlobalMapEmbed )
#Call(%grpGlobalProcedure )
#EndAt

#AT(%BeforeInitializingGlobalObjects),PRIORITY(1),Once
#Call(%grpBeforeInitializingGlobalObjects )
#EndAT

#At(%AfterKillingGlobalObjects),Priority(5000),Once
#Call(%grpKillingGlobalObjectsEmbed )
#EndAt

#At(%AfterKillingGlobalObjects),Last,Once
#Call(%grpGlobalProcedureCode )
#EndAt

#AT(%DataSection),PRIORITY(1303),Once
#Call(%grpDataSection )
#ENDAT
#EndSection

Edit

The only examples of #Append in the shipping templates are things like this:

#APPEND('PBDY.$$$'),SECTION
#EMBED(%AfterAPPENDStatement),HIDE
#REMOVE('PBDY.$$$')

Technically though, the #AT / #EndAt could be considered in the source file, would you agree?

Well to add to this, so thanks to #RunDll OutputDebugStringA I can now see that even though no errors are thrown, the code in the section shown above doesnt get called.

So in this instance, I can not detach these #At/#EndAt template code from the #Extension #Sheet and put them in a separate .tpw.

So that might well still explain why there is no link with #Include and #Append in the help docs.

It is very information having the outputdebugstringa working though

[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #EXTENSION(IS_MessagesToDebugViewLocal,'IS Send Messages to DebugView'),Procedure
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Prepare
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Group(%grpPrepareCodeTemplate)
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #EndPrepare
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #AT(%DataSection),Where(%ProcedureTemplate = 'Window'),PRIORITY(1303),Once 
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Group(%grpDataSection)
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #AT(%AdditionalDebugHooks),Where(%ProcedureTemplate = 'Window'),PRIORITY(4000) 
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Group(%grpAdditionalDebugHooks)
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #AT(%ProcedureRoutines),Where(%ProcedureTemplate = 'Window') 
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Group(%grpLocalProcedureCode)
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #AT(%LocalDataAfterClasses),Where(%ProcedureTemplate = 'Window') 
[716] LanguageTranslator Langu080.clw BrwCommand 06/05/2022 00:57:50 #Group(%grpLocalProcedureMap)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #AT(%BeforeInitializingGlobalObjects),PRIORITY(1),Once 
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpBeforeInitializingGlobalObjects)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpDebugViewImageName)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpDbgVwCommandSwitches)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpMakeDebugLogFolder)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpProgramStart)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #At(%AfterKillingGlobalObjects),Last,Once 
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpGlobalProcedureCode)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #AT(%GlobalMap),Once 
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpGlobalMapEmbed)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #IF(%SleepDelay[100] > 0 and %SleepDelayModule[1] = %True)
[716] LanguageTranslator LanguageTranslator.clw BrwCommand 06/05/2022 00:57:51 #Group(%grpGlobalProcedure)

AFAIK ONCE isn’t valid as a parameter of the #AT command and you seem to be using it all over?
ONCE is only valid as a parameter of the #INCLUDE command (templates) or INCLUDE (source)

Just curious, where in the docs is written about “ONCE” modifier of #INCLUDE?

Thats possible, this is why I’ve been trying to get the outputdebugstringa to work for months, to find out what works and what doesnt.

#Call doesnt work in some situations which I’ve only been to find out since getting this debugview api to work yesterday. Its surprising how much stuff on this computer doesnt work.

Its why I shut my company down years ago, too much hacking which I’ve been witnessing since I first got online in the dialup days in the 90’s and the police dont want nothing to do with it, they deny the evidence put before them.

Because the computer hacking is so bad in the UK, I take all docs, including the MS website api’s (MSDN) with a pinch of salt, because it changes and its easy to change docs, its harder to change the program code.

I was warned decades ago, if I dont want to be hacked dont put any computer online, I was also shown what to look for without any programs how to spot when Windows has been hacked and I see it all the time on this computer.