topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday November 8, 2024, 5:37 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Make_versioninfo.ahk - Generate versioninfo.xml  (Read 9256 times)

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Make_versioninfo.ahk - Generate versioninfo.xml
« on: May 30, 2011, 05:10 AM »
Made a very simple script that you can use as part of the build process of your app, if it uses DcUpdater.

Purpose: Generate the DcUpdater's versioninfo.xml ready for uploading. You probably already store the product version somewhere, so just pass the product version to the app:

Call it as follows (example if your product version is 1.2.3.4):
Code: Text [Select]
  1. make_versioninfo.ahk 1.2.3.4

this will generate a _versioninfo.xml with today's date:
Code: Text [Select]
  1. <?xml version="1.0"?>
  2. <root>
  3.         <Program_Version>1.2.3.4</Program_Version>
  4.         <Program_Release_Month>05</Program_Release_Month>
  5.         <Program_Release_Day>30</Program_Release_Day>
  6.         <Program_Release_Year>2011</Program_Release_Year>
  7. </root>




Save the following text as versioninfo.xml:
Code: Text [Select]
  1. <?xml version="1.0"?>
  2. <root>
  3.         <Program_Version>$ProgramVersion$</Program_Version>
  4.         <Program_Release_Month>$ProgramReleaseMonth$</Program_Release_Month>
  5.         <Program_Release_Day>$ProgramReleaseDay$</Program_Release_Day>
  6.         <Program_Release_Year>$ProgramReleaseYear$</Program_Release_Year>
  7. </root>

Save the following code as make_versioninfo.ahk:
Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2. if 0 < 1
  3. {
  4.     MsgBox This script requires at least 1 incoming parameter(s) but it only received %0%.
  5.     ExitApp
  6. }
  7. FileRead, vf, versioninfo.xml
  8. FormatTime, ProgramReleaseMonth,, MM
  9. FormatTime, ProgramReleaseDay,, dd
  10. FormatTime, ProgramReleaseYear,, yyyy
  11.  
  12. StringReplace, vf, vf, $ProgramVersion$, %1%
  13. StringReplace, vf, vf, $ProgramReleaseMonth$, %ProgramReleaseMonth%
  14. StringReplace, vf, vf, $ProgramReleaseDay$, %ProgramReleaseDay%
  15. StringReplace, vf, vf, $ProgramReleaseYear$, %ProgramReleaseYear%
  16. FileDelete, _versioninfo.xml
  17. FileAppend,%vf%,_versioninfo.xml
« Last Edit: May 30, 2011, 05:18 AM by justice »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Make_versioninfo.ahk - Generate versioninfo.xml
« Reply #1 on: May 30, 2011, 05:58 AM »
very nice, thank you.  :up:

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: Make_versioninfo.ahk - Generate versioninfo.xml
« Reply #2 on: May 30, 2011, 06:19 AM »
I would have thought that everyone who needs this is happy to install AHK, but I'm happy to add the compiled exe to the zipfile if anyone is interested.