just write your own custombuildaction. easy peasy: follow the simple syntax of the custombuildaction directive, run cmd.exe, have cmd.exe run a .bat file.
i've done it. the only trick in your case will be to grep the version id from your .b4a project source. it's there. once you have that, you can echo it to your version.txt file. hint: the whole thing takes place from your project's objects folder. the way compiletime.jar works is to save compiletime.txt to your assets folder. it does that by using ..\files\compiletime.txt. that's your clue.