A few weeks ago I posted a thread on a build number implementation for your project in this thread
http://www.b4x.com/android/forum/th...-your-projects-compilation.32823/#post-191560
Please read the above thread before trying to understand the following additions.
I have now extended this to having a changelog file (history file of changes made) as well. Most developers want to keep track of what has changed between versions/builds and perhaps allow user to view changelog.
My script has been extended as below
var fst, f, fileCount;
var ForReading = 1, ForWriting = 2, ForAppending =8;
var filebuild = "D:\\Software development ANDROID\\bzPlayer\\Files\\mybuild.txt";
var filechangelog = "D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var command ="Notepad.exe D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var wshell = WScript.CreateObject("wscript.Shell")
var myresult, myok=1;
var mylog
var mycrlf="\n\r"
fst = new ActiveXObject("Scripting.FileSystemObject");
//create file if its not found
if (! fso.FileExists(filebuild))
{
f = fst.openTextFile(filebuild, ForWriting, true);
f.Write("0");
f.Close();
}
f = fst.openTextFile(filebuild, ForReading);
fileCount = parseInt(f.ReadAll());
//make sure the input is a whole number
if (isNaN(fileCount))
{
fileCount = 0;
}
fileCount = fileCount + 1;
f = fst.oenTextFile(filebuild, ForWriting, true);
f.Write(fileCount);
f.Close();
myresult= wshell.Popup("Do you wish to update CHANGE LOG", 3, "Program Change log", 65);
if (myresult == myok)
{
if (! fso.FileExists(filechangelog))
{
f = fst.openTextFile(filechangelog, ForWriting, true);
f.Write(" Build " + fileCount);
f.Close();
}
else
{
f = fst.openTextFile(filechangelog, ForAppending, true);
f.Write(mycrlf + mycrlf + " Build " + fileCount + mycrlf + mycrlf );
f.write("================================================= " + mycrlf + mycrlf);
f.Close();
}
wshell.run (command);
WScript.Sleep(100);
wshell.AppActivate("Notepad");
WScript.Sleep(100);
wshell.SendKeys("^{END}");
}
A small popup window occurs when you start compilation of your project and allows user access to a Notepad type text file to edit a changelog. If user waits 3 seconds the dialog disappears and program execution occurs. (so be fast to click if you want to enter some information... )
The Changelog can be any format the user wants but I use a simple layout as shown below
Build 148
=================================================
First public release of myProgram
Build 171
=================================================
- fixed bug with GUI and small screens
- fixed big with divide by zero
- fixed bug with user input
Build 192
=================================================
- added better screen size choices
- added user buttons for settings
- fixed bug with making coffee
The Notepad window automatically goes to end of file where the script has added a couple of lines with the current build number and then a separator line of "=" signs.
Obviously by changing the script file you could even start a full Word processor or whatever and have a more sophisticated changelog.
http://www.b4x.com/android/forum/th...-your-projects-compilation.32823/#post-191560
Please read the above thread before trying to understand the following additions.
I have now extended this to having a changelog file (history file of changes made) as well. Most developers want to keep track of what has changed between versions/builds and perhaps allow user to view changelog.
My script has been extended as below
var fst, f, fileCount;
var ForReading = 1, ForWriting = 2, ForAppending =8;
var filebuild = "D:\\Software development ANDROID\\bzPlayer\\Files\\mybuild.txt";
var filechangelog = "D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var command ="Notepad.exe D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var wshell = WScript.CreateObject("wscript.Shell")
var myresult, myok=1;
var mylog
var mycrlf="\n\r"
fst = new ActiveXObject("Scripting.FileSystemObject");
//create file if its not found
if (! fso.FileExists(filebuild))
{
f = fst.openTextFile(filebuild, ForWriting, true);
f.Write("0");
f.Close();
}
f = fst.openTextFile(filebuild, ForReading);
fileCount = parseInt(f.ReadAll());
//make sure the input is a whole number
if (isNaN(fileCount))
{
fileCount = 0;
}
fileCount = fileCount + 1;
f = fst.oenTextFile(filebuild, ForWriting, true);
f.Write(fileCount);
f.Close();
myresult= wshell.Popup("Do you wish to update CHANGE LOG", 3, "Program Change log", 65);
if (myresult == myok)
{
if (! fso.FileExists(filechangelog))
{
f = fst.openTextFile(filechangelog, ForWriting, true);
f.Write(" Build " + fileCount);
f.Close();
}
else
{
f = fst.openTextFile(filechangelog, ForAppending, true);
f.Write(mycrlf + mycrlf + " Build " + fileCount + mycrlf + mycrlf );
f.write("================================================= " + mycrlf + mycrlf);
f.Close();
}
wshell.run (command);
WScript.Sleep(100);
wshell.AppActivate("Notepad");
WScript.Sleep(100);
wshell.SendKeys("^{END}");
}
A small popup window occurs when you start compilation of your project and allows user access to a Notepad type text file to edit a changelog. If user waits 3 seconds the dialog disappears and program execution occurs. (so be fast to click if you want to enter some information... )
The Changelog can be any format the user wants but I use a simple layout as shown below
Build 148
=================================================
First public release of myProgram
Build 171
=================================================
- fixed bug with GUI and small screens
- fixed big with divide by zero
- fixed bug with user input
Build 192
=================================================
- added better screen size choices
- added user buttons for settings
- fixed bug with making coffee
The Notepad window automatically goes to end of file where the script has added a couple of lines with the current build number and then a separator line of "=" signs.
Obviously by changing the script file you could even start a full Word processor or whatever and have a more sophisticated changelog.