Jump to content

Recommended Posts

Posted (edited)

I've started to write some scripts with LUA to have more comfort with AutoIt in SciTE.

Here I've a script to print by saving scripts everytime an time stamp and if you want, it makes an backup of the current file too with increasing version number automatically.

The version number is used as: 'v main.sub', i.e. 'v 1.5' or 'v 2.13'.

You can use this for .au3 and .lua scripts. At the moment I'm using following time stamps, with or without version number (starting at 'v 0.1'):

autoit:

#Region - TimeStamp
; 2011-05-17 10:34:30   v 0.1
#EndRegion - TimeStamp
lua:

-- TIME_STAMP   2011-05-17 00:17:03   v 1.0

(Thanks to i2c for his time stamp version, that gives me the idea to work with LUA. Parts of them are included in my solution.)

Whats why I have it made? - I think it is useful to save different steps by develope a program. So you can go back to a special point and create another solution from this.

The backups are stored as following:

You give an root folder [VER_DIR] for version backups with an entry in SciTEUser.properties. The path has to write without quotation and without trailing backslash!

With the word: Default - the current scriptfolder are used, with: no - no backup will created, only time stamp print.

Version backup requires time stamp. Your SciTEUser.properties should include following:

#~ Save with TimeStamp Y/N (1/0) - Requires '1' if version backup are wanted
SetTimeStamp.au3=1
SetTimeStamp.lua=0
#~ Path for saving version backups [VER_DIR]: (Path/Deafult/no)
#~ IMPORTANT:   Don't write path inside quotation!
#~              NO trailing backslash!
#~  Default = create subfolder in current script folder
#~      foldername: VER_DIR\BUVer_FILENAME.EXT\
#~      filename:   \FILENAME[Version-Number].EXT
#~  no     = don't increase version number, don't save backup (only time stamp will print)
Version.Path.au3=$(SciteDefaultHome)\VersionBackup\AU3
Version.Path.lua=no

So you get this structure:

VER_DIR\BUVer_FILENAME.EXT\FILENAME[Version-Number].EXT

(BUVer_ as mnemonic for: BackUpVer_)

i.e.

..\SciTE\VersionBackup\BUVer_test.au3\test[0.1].au3

..\SciTE\VersionBackup\BUVer_test.au3\test[0.2].au3

..\SciTE\VersionBackup\BUVer_test.au3\test[0.3].au3

..\SciTE\VersionBackup\BUVer_test.au3\test[1.0].au3

..\SciTE\VersionBackup\BUVer_test1.au3\test1[0.1].au3

..\SciTE\VersionBackup\BUVer_test1.au3\test1[0.2].au3

..\SciTE\VersionBackup\BUVer_test1.au3\test1[1.0].au3

..\SciTE\VersionBackup\BUVer_test1.au3\test1[1.1].au3

You can decide before you save your script (don't forget: run script will save before too):

- at first time to save
    with an asterisk at first position in editor: no backup from this file will created
    time stamp without version number are set
- every other time
    set a marker behind 'v 0.1' of the current version number 
    (or behind the time, if is no version set until now)
    markers are:    v   subversion number increase ('v 0.1' ==> 'v 0.2')
                    V   mainversion number increase, subversion number set to '0'
                        ('v 0.6' ==> 'v 1.0')
                    n   versionnumber are used as given, may changed by hand for 
                        version jump, create backup with this given number 
                        (takes no effect, if is no version set until now)

Everytime you want, you make an backup by setting a marker. All the other time only the time stamp will changed.

Here my file "AutoStampSaveVersion.lua"

  Reveal hidden contents

Put this file in your folder: "..\SciTE\LUA\"

The file in attachement has suffix ".txt" (can't upload .lua), you must change this to ".lua".

You must instruct your SciTE, that this file is to load. This happens in your: "..\SciTE\LUA\SciTEStartup.lua".

This is my:

  Reveal hidden contents

One point:

To create folder, i use CMD. So it pops up for a short moment the CMD-window. I have no way found to hide this. If anyone has an idea to solve this - thats welcome.

Lua scripts are running inside SciTE, but if you want to test some lua scripts in SciTE User Interface and want to run them wit "F5", you need "lua.exe / luac.exe" and must change pathes for them in your "lua.properties" (at the end of the file):

# compatible with LuaBinaries for Lua 5.1; will work on both platforms.
#~ command.compile.*.lua=luac5.1 -o "$(FileName).luc" "$(FileNameExt)"
command.compile.*.lua="C:\Program Files\Lua\5.1\luac.exe" -o "$(FileName).luc" "$(FileNameExt)"
# Lua 5.1
#~ command.go.*.lua=lua5.1 "$(FileNameExt)"
command.go.*.lua="C:\Program Files\Lua\5.1\lua.exe" "$(FileNameExt)"
# Lua 4.0
#command.go.*.lua=Lua-4.0.exe -c -f "$(FileNameExt)"

AutoStampSaveVersion.txt

Edited by BugFix

Best Regards BugFix  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...