maniootek Posted May 13, 2020 Share Posted May 13, 2020 Is it possible to put some version number in script and auto increment every time when Scite run command "Go" ? Link to comment Share on other sites More sharing options...
Subz Posted May 13, 2020 Share Posted May 13, 2020 Only when you compile, you could write a value to registry or file which read/writes the version. Link to comment Share on other sites More sharing options...
maniootek Posted May 13, 2020 Author Share Posted May 13, 2020 (edited) Ok I see. I will share my story why I need it. I never compile my scripts to exe because my scripts are shared via google drive with others. If I would use compiled exe file then I would have problems with synchronization when I want to modify it as some others could use that file at the time. This is why I use some exe launcher instead which use AutoIt3.exe and au3 file as a parameter to run. This way I always can modify au3 file without synchronization issues. For now I use variable "Global $g_ScripVersion = 1.0" but I forget to increase it when I making some changes Edited May 13, 2020 by maniootek Link to comment Share on other sites More sharing options...
Subz Posted May 13, 2020 Share Posted May 13, 2020 After you've made changes, just compile the script, it will change the version number in the script, you then just upload the au3 script to Google Drive. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=1.0.0.1 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Link to comment Share on other sites More sharing options...
maniootek Posted May 13, 2020 Author Share Posted May 13, 2020 9 minutes ago, Subz said: After you've made changes, just compile the script, it will change the version number in the script, you then just upload the au3 script to Google Drive. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=1.0.0.1 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Yes I know this option and I have tried it but it's not what I mean. This way I have to remember to compile a script that I never normally do. Link to comment Share on other sites More sharing options...
Subz Posted May 13, 2020 Share Posted May 13, 2020 Don't really understand since if others run the script it will also auto increment the count, the only way I can think of doing it, would be something like: Global $g_ScripVersion = 1.1 _VersionUpdate() Func _VersionUpdate() If @UserName = "maniootek" Then ;~ Backup your script first FileCopy(@ScriptFullPath, @ScriptDir & "\Backup\" & @YEAR & @MON & @MDAY & "_" & @ScriptName, 9) ;~ Replace the version number $sScript = StringReplace(FileRead(@ScriptFullPath), "$g_ScripVersion = " & Round($g_ScripVersion, 1), "$g_ScripVersion = " & Round($g_ScripVersion + .1, 1)) ;~ Open the Script FileOpen(@ScriptFullPath, 2) ;~ Rewrite the updated Script FileWrite(@ScriptFullPath, $sScript) FileClose(@ScriptFullPath) EndIf EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted May 13, 2020 Developers Share Posted May 13, 2020 Something like this could do that for you: #AutoIt3Wrapper_Icon=test.gif #AutoIt3Wrapper_Res_Fileversion=1.2.3.11 OnAutoItExitRegister("Update_Version") ConsoleWrite("...end of script" & @CRLF) Func Update_Version() $ToTalFile = FileRead(@ScriptFullPath) $CurVersion = StringRegExpReplace($ToTalFile, '(?ims).*?#AutoIt3Wrapper_Res_Fileversion\h*?=\h*?(\S*).*+', '$1') $verseg = StringSplit($CurVersion, ".") $NewVersion = "" For $x = 1 To $verseg[0] ; add 1 to last number in version If $x = $verseg[0] Then $verseg[$x] += 1 If $x > 1 Then $NewVersion &= "." $NewVersion &= $verseg[$x] Next $ToTalFile = StringRegExpReplace($ToTalFile, '(?i)#AutoIt3Wrapper_Res_Fileversion\h*?=\h*?' & $CurVersion, '#AutoIt3Wrapper_Res_Fileversion=' & $NewVersion) $H_Outf = FileOpen(@ScriptFullPath, 2) FileWrite($H_Outf, $ToTalFile) FileClose($H_Outf) EndFunc ;==>Update_Version Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
maniootek Posted May 14, 2020 Author Share Posted May 14, 2020 22 hours ago, Subz said: Don't really understand since if others run the script it will also auto increment the count Yes, you are right. This is why I am looking for other solution than you and @Jos suggested. Users who use my scripts don't use Scite but the launcher. I am also using scripts with the launcher. I want increase the script version only when I modify the code with Scite for example. Link to comment Share on other sites More sharing options...
Subz Posted May 14, 2020 Share Posted May 14, 2020 If you noticed my script, uses your username to update the code, so if someone else ran it, it wouldn't update, this could also be added to Jos solution. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 14, 2020 Developers Share Posted May 14, 2020 21 minutes ago, maniootek said: Yes, you are right. This is why I am looking for other solution than you and @Jos suggested. Users who use my scripts don't use Scite but the launcher. I am also using scripts with the launcher. I want increase the script version only when I modify the code with Scite for example. Just add a test to the logic for something that identifies it is you ... this really can't be that hard. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
maniootek Posted May 14, 2020 Author Share Posted May 14, 2020 As I stated, I am also using that launcher I mentioned before. Your solution will update script version each time I use the script. Link to comment Share on other sites More sharing options...
Danp2 Posted May 14, 2020 Share Posted May 14, 2020 Maybe you could check the parent process that launched Autoit. If your launcher app, do nothing. If Scite, then increment your script version. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
maniootek Posted May 14, 2020 Author Share Posted May 14, 2020 22 minutes ago, Danp2 said: Maybe you could check the parent process that launched Autoit. If your launcher app, do nothing. If Scite, then increment your script version. I know what you mean. This is good idea. Later I will check it Link to comment Share on other sites More sharing options...
Developers Jos Posted May 14, 2020 Developers Share Posted May 14, 2020 As I said... 4 hours ago, Jos said: this really can't be that hard. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now