Index: scripts/jenkins/_get-version.bat
===================================================================
diff -u
--- scripts/jenkins/_get-version.bat	(revision 0)
+++ scripts/jenkins/_get-version.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,67 @@
+@echo off
+
+rem Script retrieves version information from version.h file
+
+setlocal ENABLEDELAYEDEXPANSION
+
+rem Detect current Major.Minos versions
+set _ver_cmd=type "%WORKSPACE%\src\common\version.h"
+
+for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION1 "') do set _MajorVersion=%%a
+if errorlevel 1 (
+	echo Problem with retrieving _MajorVersion.
+	exit /b 1
+)
+
+if "!_MajorVersion!" == "" (
+	echo Can't get the major version.
+	exit /b 1
+)
+
+set _ver_cmd=type "%WORKSPACE%\src\common\version.h"
+for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION2 "') do set _MinorVersion=%%a
+if errorlevel 1 (
+	echo Problem with retrieving _MinorVersion.
+	exit /b 1
+)
+if "!_MinorVersion!" == "" (
+	echo Can't get the minor version.
+	exit /b 1
+)
+
+set _ver_cmd=type "%WORKSPACE%\src\common\version.h"
+for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION3 "') do set _BuildVersion=%%a
+if errorlevel 1 (
+	echo Problem with retrieving _BuildVersion.
+	exit /b 1
+)
+if "!_BuildVersion!" == "" (
+	echo Can't get the build version.
+	exit /b 1
+)
+
+set _ver_cmd=type "%WORKSPACE%\src\common\version.h"
+for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION4 "') do set _DetailVersion=%%a
+if errorlevel 1 (
+	echo Problem with retrieving _DetailVersion.
+	exit /b 1
+)
+if "!_DetailVersion!" == "" (
+	echo Can't get the detail version.
+	exit /b 1
+)
+
+set _ver_cmd=type "%WORKSPACE%\src\common\version.h"
+for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION "') do set _TextVersion=%%a
+if errorlevel 1 (
+	echo Problem with retrieving _TextVersion.
+	exit /b 1
+)
+if "!_TextVersion!" == "" (
+	echo Can't get the detail version.
+	exit /b 1
+)
+
+endlocal & call SET CHMajorVersion=%_MajorVersion%& SET CHMinorVersion=%_MinorVersion%& SET CHBuildVersion=%_BuildVersion%& SET CHDetailVersion=%_DetailVersion%& SET CHTextVersion=%_TextVersion:"=%
+
+echo Detected version %CHMajorVersion%.%CHMinorVersion%.%CHBuildVersion%.%CHDetailVersion% (%CHTextVersion%)
Index: scripts/jenkins/_replace_version.vbs
===================================================================
diff -u
--- scripts/jenkins/_replace_version.vbs	(revision 0)
+++ scripts/jenkins/_replace_version.vbs	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,36 @@
+Const ForReading = 1
+Const ForWriting = 2
+
+strOldFileName = Wscript.Arguments(0)
+strNewFileName = Wscript.Arguments(1)
+strMajor = WScript.Arguments(2)
+strMinor = WScript.Arguments(3)
+strSVN = WScript.Arguments(4)
+strCustom = WScript.Arguments(5)
+strTextVersion = WScript.Arguments(6)
+
+' Validate parameters
+if strOldFileName = "" or strNewFileName = "" or strMajor = "" or strMinor = "" or strSVN = "" or strCustom ="" or strTextVersion="" then
+	WScript.echo "Missing input parameters"
+	return 1
+end if
+
+Set objFSO = CreateObject("Scripting.FileSystemObject")
+
+' Read the source file
+Set objFile = objFSO.OpenTextFile(strOldFileName, ForReading)
+
+strText = objFile.ReadAll
+objFile.Close
+
+' Replace the text
+strText = Replace(strText, "{major_version}", strMajor)
+strText = Replace(strText, "{minor_version}", strMinor)
+strText = Replace(strText, "{svn_version}", strSVN)
+strText = Replace(strText, "{custom_version}", strCustom)
+strText = Replace(strText, "{text_version}", strTextVersion)
+
+' And write the text
+Set objFile = objFSO.OpenTextFile(strNewFileName, ForWriting)
+objFile.WriteLine strText
+objFile.Close
Index: scripts/jenkins/prepare-installer-package.bat
===================================================================
diff -u
--- scripts/jenkins/prepare-installer-package.bat	(revision 0)
+++ scripts/jenkins/prepare-installer-package.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,8 @@
+@echo off
+
+SET OutDir=%WORKSPACE%\Output
+mkdir "%OutDir%"
+
+call "%WORKSPACE%\scripts\jenkins\_get-version.bat" || exit /b 1
+
+"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "%WORKSPACE%\scripts\setup.iss" /o"%OutDir%"
Index: scripts/jenkins/prepare-portable-package.bat
===================================================================
diff -u
--- scripts/jenkins/prepare-portable-package.bat	(revision 0)
+++ scripts/jenkins/prepare-portable-package.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,46 @@
+@echo off
+
+rem Script prepares the portable CH package after build
+
+SET TmpDir=%WORKSPACE%\temp\chzip-%BUILD_NUMBER%
+SET OutDir=%WORKSPACE%\Output
+
+SET VSInstallDirX86=C:\Program Files (x86)\Microsoft Visual Studio 12.0
+
+mkdir "%TmpDir%"
+mkdir "%OutDir%"
+
+call "%WORKSPACE%\scripts\jenkins\_get-version.bat" || exit /b 1
+
+xcopy "%WORKSPACE%\bin\release\ch.exe" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\License.txt" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\chext.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libicpf32u.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libchcore32u.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libictranslate32u.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\ictranslate.exe" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\sqlite3_32.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%WORKSPACE%\scripts\portable_config\ch.xml" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\VC\redist\x86\Microsoft.VC120.CRT\*" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\VC\redist\x86\Microsoft.VC120.MFC\*" "%TmpDir%\32bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\Common7\IDE\Remote Debugger\x86\dbghelp.dll" "%TmpDir%\32bit\" || exit /B 1
+xcopy /E /I "%WORKSPACE%\bin\release\help" "%TmpDir%\32bit\help" || exit /B 1
+xcopy /E /I "%WORKSPACE%\bin\release\langs" "%TmpDir%\32bit\langs" || exit /B 1
+
+xcopy "%WORKSPACE%\bin\release\ch64.exe" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\License.txt" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\chext64.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libicpf64u.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libchcore64u.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\libictranslate64u.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\ictranslate64.exe" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\bin\release\sqlite3_64.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%WORKSPACE%\scripts\portable_config\ch.xml" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\VC\redist\x64\Microsoft.VC120.CRT\*" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\VC\redist\x64\Microsoft.VC120.MFC\*" "%TmpDir%\64bit\" || exit /B 1
+xcopy "%VSInstallDirX86%\Common7\IDE\Remote Debugger\x64\dbghelp.dll" "%TmpDir%\64bit\" || exit /B 1
+xcopy /E /I "%WORKSPACE%\bin\release\help" "%TmpDir%\64bit\help" || exit /B 1
+xcopy /E /I "%WORKSPACE%\bin\release\langs" "%TmpDir%\64bit\langs" || exit /B 1
+
+cd %TmpDir%
+"C:\Program Files\7-Zip\7z.exe" a -tzip "%OutDir%\ch-portable-%CHTextVersion%.zip" 32bit 64bit
Index: scripts/jenkins/prepare-source-package.bat
===================================================================
diff -u
--- scripts/jenkins/prepare-source-package.bat	(revision 0)
+++ scripts/jenkins/prepare-source-package.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,8 @@
+@echo off
+
+SET OutDir=%WORKSPACE%\Output
+mkdir "%OutDir%"
+
+call "%WORKSPACE%\scripts\jenkins\_get-version.bat" || exit /b 1
+
+"C:\Program Files\7-Zip\7z.exe" a "%WORKSPACE%\Output\chsrc-%CHTextVersion%.zip" -tzip -x!".git" -x!"temp" -x!"Output" "%WORKSPACE%\*"
Index: scripts/jenkins/prepare-symbols-package.bat
===================================================================
diff -u
--- scripts/jenkins/prepare-symbols-package.bat	(revision 0)
+++ scripts/jenkins/prepare-symbols-package.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,8 @@
+@echo off
+
+SET OutDir=%WORKSPACE%\Output
+mkdir "%OutDir%"
+
+call "%WORKSPACE%\scripts\jenkins\_get-version.bat" || exit /b 1
+
+"C:\Program Files\7-Zip\7z.exe" a "%WORKSPACE%\Output\chsymbols-%CHTextVersion%.zip" -tzip "%WORKSPACE%\bin\release\*.pdb"
Index: scripts/jenkins/update-code-version.bat
===================================================================
diff -u
--- scripts/jenkins/update-code-version.bat	(revision 0)
+++ scripts/jenkins/update-code-version.bat	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -0,0 +1,22 @@
+@echo off
+
+rem Script updates the version.h file based on the jenkins build parameters
+setlocal ENABLEDELAYEDEXPANSION
+
+rem Detect current Major.Minos versions
+call "%WORKSPACE%\scripts\jenkins\_get-version.bat"
+
+rem Detect new version type
+if "%GIT_TAG_NAME%" == "" (
+	rem internal build
+	SET _CHStrVersion=%CHMajorVersion%.%CHMinorVersion%git-%GIT_COMMIT:~-6%
+) else (
+	rem tagged build
+	SET _CHStrVersion=%GIT_TAG_NAME%
+)
+
+echo String version: %_CHStrVersion%
+echo Numeric ver: %CHMajorVersion%.%CHMinorVersion%.%BUILD_NUMBER%.0
+
+echo Changing version
+cscript //NoLogo "%WORKSPACE%\scripts\jenkins\_replace_version.vbs" "%WORKSPACE%\src\common\version.h.template" "%WORKSPACE%\src\common\version.h" %CHMajorVersion% %CHMinorVersion% %BUILD_NUMBER% 0 %_CHStrVersion%
Index: src/common/version.h
===================================================================
diff -u -rbd0d5d6ccc8b9e1552ee9c229f256517663cdcfe -r4ed6512d73cd1b444f83afdefe9a986b6ca9de90
--- src/common/version.h	(.../version.h)	(revision bd0d5d6ccc8b9e1552ee9c229f256517663cdcfe)
+++ src/common/version.h	(.../version.h)	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -11,7 +11,7 @@
 // Version of program
 #define PRODUCT_VERSION1 1
 #define PRODUCT_VERSION2 40
-#define PRODUCT_VERSION3 724
+#define PRODUCT_VERSION3 0
 #define PRODUCT_VERSION4 0
 
 #if SETUP_COMPILER != 1
@@ -23,7 +23,7 @@
 	#define PRODUCT_NUMERIC_VERSION STRINGIZE2(PRODUCT_VERSION1) L"." STRINGIZE2(PRODUCT_VERSION2) L"." STRINGIZE2(PRODUCT_VERSION3) L"." STRINGIZE2(PRODUCT_VERSION4)
 #endif
 
-#define PRODUCT_VERSION "1.40internal-svn724"
+#define PRODUCT_VERSION "1.40internal-current"
 
 #if SETUP_COMPILER != 1
 	#define SHELLEXT_PRODUCT_FULL_VERSION SHELLEXT_PRODUCT_NAME " " PRODUCT_VERSION
Index: src/common/version.h.template
===================================================================
diff -u -r21366e09d0e7c859bca57b3e7abdf9eb89dfba82 -r4ed6512d73cd1b444f83afdefe9a986b6ca9de90
--- src/common/version.h.template	(.../version.h.template)	(revision 21366e09d0e7c859bca57b3e7abdf9eb89dfba82)
+++ src/common/version.h.template	(.../version.h.template)	(revision 4ed6512d73cd1b444f83afdefe9a986b6ca9de90)
@@ -14,6 +14,15 @@
 #define PRODUCT_VERSION3 {svn_version}
 #define PRODUCT_VERSION4 {custom_version}
 
+#if SETUP_COMPILER != 1
+	#define PRODUCT_FULL_NUMERIC_VERSION ((unsigned long long)PRODUCT_VERSION1) << 48 | ((unsigned long long)PRODUCT_VERSION2) << 32 | ((unsigned long long)PRODUCT_VERSION3) << 16 | ((unsigned long long)PRODUCT_VERSION4)
+
+	#define STRINGIZE2(a) STRINGIZE(a)
+	#define STRINGIZE(a) L#a
+
+	#define PRODUCT_NUMERIC_VERSION STRINGIZE2(PRODUCT_VERSION1) L"." STRINGIZE2(PRODUCT_VERSION2) L"." STRINGIZE2(PRODUCT_VERSION3) L"." STRINGIZE2(PRODUCT_VERSION4)
+#endif
+
 #define PRODUCT_VERSION "{text_version}"
 
 #if SETUP_COMPILER != 1
@@ -25,8 +34,9 @@
 #endif
 
 // copyright information
-#define COPYRIGHT_INFO	"Copyright (C) 2001-2014 J�zef Starosczyk"
-#define PRODUCT_SITE	"http://www.copyhandler.com"
-#define CONTACT_INFO	"http://www.copyhandler.com/contact"
+#define COPYRIGHT_INFO	"Copyright (C) 2001-2016 J�zef Starosczyk"
+#define PRODUCT_SITE		"http://www.copyhandler.com"
+#define UPDATE_CHECK_LINK	"https://www.copyhandler.com/update-check"
+#define CONTACT_INFO		"http://www.copyhandler.com/contact"
 
 #endif