Build Number [Question]!
#8

I have written a code to help you :


Code:
@ECHO OFF
TITLE Compilation
:: Replace "Source.pwn" in the line below with the name of your Pawn script file. 
SET FileName="Source.pwn"
(
    ECHO.Option Explicit
    ECHO.Dim Fso, Text, x
    ECHO.ReDim Lines^(0^)
    ECHO.Set Fso = CreateObject^("Scripting.FileSystemObject"^)
    ECHO.Set Text = Fso.OpenTextFile^(%FileName%^)
    ECHO.While Not Text.AtEndOfStream
    ECHO.    x = Text.Line - 1
    ECHO.    ReDim Preserve Lines^(x^)
    ECHO.    Lines^(x^) = Text.ReadLine^(^)
    ECHO.    If InStr^(Lines^(x^), "const BuildNumber = "^) = 1 Then
    ECHO.        Lines^(x^) = "const BuildNumber = " ^& CInt^(Mid^(Lines^(x^), 21, Len^(Lines^(x^)^) - 21^)^) + 1 ^& ";"
    ECHO.    End If 
    ECHO.Wend
    ECHO.Text.Close^(^)
    ECHO.Fso.DeleteFile^(%FileName%^)
    ECHO.Set Text = Fso.CreateTextFile^(%FileName%^)
    ECHO.For Each x In Lines
    ECHO.    Text.WriteLine^(x^)
    ECHO.Next
    ECHO.Text.Close^(^)
) > Modify.vbs
CSCRIPT //NOLOGO Modify.vbs
DEL Modify.vbs
PAWNCC %FileName%
PAUSE > NUL

Save this as a batch file and put it in the same folder of pawncc.exe .



Then move your Pawn script file to that folder and add this to the top of it:


pawn Code:
const BuildNumber = 1;

The value of that constant will be increased by 1 and the compilation will happen each time you run the batch file .



I hope that I have helped .
Reply


Messages In This Thread
Build Number [Question]! - by Glint - 28.09.2012, 05:57
Re: Build Number [Question]! - by zDevon - 28.09.2012, 06:03
Re: Build Number [Question]! - by Joe Staff - 28.09.2012, 06:39
Re: Build Number [Question]! - by Calgon - 28.09.2012, 06:53
Re: Build Number [Question]! - by Glint - 28.09.2012, 06:53
Re: Build Number [Question]! - by Vince - 28.09.2012, 09:17
Re: Build Number [Question]! - by Glint - 28.09.2012, 09:30
Re: Build Number [Question]! - by rjjj - 28.09.2012, 13:34
Re: Build Number [Question]! - by Glint - 28.09.2012, 15:17
Re: Build Number [Question]! - by Sniper Kitty - 28.09.2012, 15:24
Re: Build Number [Question]! - by Y_Less - 28.09.2012, 16:09
Re: Build Number [Question]! - by Sniper Kitty - 28.09.2012, 17:02
Re: Build Number [Question]! - by Y_Less - 28.09.2012, 17:12
Re: Build Number [Question]! - by Sniper Kitty - 28.09.2012, 17:15
Re: Build Number [Question]! - by Glint - 28.09.2012, 17:52
Re: Build Number [Question]! - by rjjj - 29.09.2012, 04:31
Re: Build Number [Question]! - by Glint - 29.09.2012, 05:24
Re: Build Number [Question]! - by zgintasz - 29.09.2012, 08:43
Re: Build Number [Question]! - by Y_Less - 29.09.2012, 09:43
Re: Build Number [Question]! - by rjjj - 29.09.2012, 12:29
Re: Build Number [Question]! - by Mauzen - 29.09.2012, 15:03
Re: Build Number [Question]! - by Glint - 29.09.2012, 16:24

Forum Jump:


Users browsing this thread: 7 Guest(s)