Codeblocks uses squirrel for scripting:
http://squirrel-lang.org/ it is close to lua, but with c like syntax.
You can run one line scripts with the script console: View->scrip console. In the bottom line you can enter commands, or running a .script file.
In your case i would run a script file with this content:
local arr =
[
"File 1.c",
"File 1.h",
"File 2.c",
"File 2.h"
];
local project = GetProjectManager().GetActiveProject();
foreach(i, fi in arr)
{
Log(_T(fi));
for(i = 0; i < project.GetBuildTargetsCount(); ++i)
GetProjectManager().AddFileToProject( _T(fi), project, i);
};
GetProjectManager().SaveProject(project);
Log(_T("Import finished"));
Edit: For the above script all files have to exist and be in the same folder as the project but you can use relative paths and absolute paths. To read a txt file ask or read the squirrel documentation
Edit2: The files are getting added to all targets of the project