tonycst Posted January 23, 2018 Share Posted January 23, 2018 (edited) $Version = "day/month/year/time" I want to update this every single time script is executed, so i wont have to edit it manually each time i compile it. Any easy way of doing it ? Any way to do it once i hit F5 to run the script so i wont forget to update it ? For example $Version = "01/01/2018 15:00" thanks ! Edited January 23, 2018 by tonycst Link to comment Share on other sites More sharing options...
rcmaehl Posted January 23, 2018 Share Posted January 23, 2018 $Version = @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" @MIN My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
tonycst Posted January 23, 2018 Author Share Posted January 23, 2018 (edited) Why didnt i think of that ? Oh wait. Isnt it because when script is compiled and ran, it will show CURRENT date and time instead the date and time the script was compiled ? I need that date/time to be static and reflect the date/time script was compiled. Not when complied script runs Edited January 23, 2018 by tonycst Link to comment Share on other sites More sharing options...
rcmaehl Posted January 23, 2018 Share Posted January 23, 2018 Don't think it works for compiling, but I haven't tested. However, if I ever forget change the version number for compiling, I just use Reshack to update the VersionInfo of the compiled program My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
tonycst Posted January 23, 2018 Author Share Posted January 23, 2018 Yeah, i could do that. But who's gonna look at the file properties to know the version ? Most people want the version displayed somewhere or at the very least, in the tray menu where i have it. oh well. Link to comment Share on other sites More sharing options...
iamtheky Posted January 23, 2018 Share Posted January 23, 2018 3 minutes ago, tonycst said: But who's gonna look at the file properties to know the version ? ummm, the script could? $version = FileGetTime(@ScriptFullPath , 1 , 1) msgbox(0, '' , "This exe was created on " & $version) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
tonycst Posted January 23, 2018 Author Share Posted January 23, 2018 (edited) That would also work but it would reflect the file time/date, not the version of the script. I guess without manually entering it in there nothing going to work. It would be nice if Wrapper had option to add Ver:3.3.1.2 or what ever directly into the file as a variable. That would really help. Edited January 23, 2018 by tonycst Link to comment Share on other sites More sharing options...
BrewManNH Posted January 23, 2018 Share Posted January 23, 2018 Look in the Scite Help file, under #autoit3wrapper settings. You can set the version of the compiled exe there. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tonycst Posted January 23, 2018 Author Share Posted January 23, 2018 The only thing i found that makes some sense to use was #AutoIt3Wrapper_Versioning_Parameters= But am not sure how that works nor what variable will it create that i can reference with my script. Can you give me a clue ? Help file did not give example on that. Also above that, i found ; %longdate% = PC date in long date format %time% = PC timeformat as variables recognized by scite, but i have no clue how to implement them into the script. Link to comment Share on other sites More sharing options...
jchd Posted January 23, 2018 Share Posted January 23, 2018 You can use the #AutoIt3Wrapper_Run_Before directive to specify an external script which would edit the content of a constant in the source file. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2018 Developers Share Posted January 23, 2018 (edited) 12 minutes ago, tonycst said: Also above that, i found ; %longdate% = PC date in long date format %time% = PC timeformat as variables recognized by scite, but i have no clue how to implement them into the script. Strait from the SciTE4AutoIt3 Helpfile page "Directives available": ; you can use the following variables: ; %AutoItVer% which will be replaced with the version of AutoIt3 ; %date% = PC date in short date format ; %longdate% = PC date in long date format ; %time% = PC timeformat ; eg: #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% Doesn't that answer your question? I hope you do have the full SciTE4AutoIt3 installer installed or else all of this isn't available. Jos Edited January 23, 2018 by Jos Earthshine 1 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...
Earthshine Posted January 23, 2018 Share Posted January 23, 2018 I am so doing this. Thanks 👍 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
iamtheky Posted January 23, 2018 Share Posted January 23, 2018 (edited) 2 hours ago, tonycst said: That would also work but it would reflect the file time/date which was literally the first line of this thread, right? and the example in the first thread that wanted a variable called $version to equal day month year time... Edited January 23, 2018 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
tonycst Posted January 25, 2018 Author Share Posted January 25, 2018 On 1/23/2018 at 1:55 PM, iamtheky said: which was literally the first line of this thread, right? and the example in the first thread that wanted a variable called $version to equal day month year time... Kinda, but not really. Its been more then once where i get files across the internet that say "Created today....." so i dont want to get that information from the file properties, i need that information from the code. Using second script to set that information into the main script (run before/after settings in compiler) is the way to go i guess. Link to comment Share on other sites More sharing options...
tonycst Posted January 25, 2018 Author Share Posted January 25, 2018 I came up with this: #include <File.au3> $Version = "1.0" $File = FileOpenDialog("", @ScriptDir& "\", "script (*.au3)") $Array = FileReadToArray ($File) $Lines = 0 For $i = 0 To UBound($Array) - 1 Assign ("Lines",$Lines+1) If StringInStr ($Array[$i],"$Version") > 0 Then _FileWriteToLine ($File,$Lines,'$Version = "1.1"',True) FileClose ($File) Exit ;so it will not write anywhere else. EndIf Next Enough to get started i guess. It would be much safer to have $Version variable placed at the very top of the script as a general rule, so that you would know exactly what line needs to be modified. Otherwise this will search entire file and replace entire line as soon as it finds word $Version it in. Could cause trouble if not used correctly. Someone want to simplify it maybe or make it better ? I am sure its not the best way to do it, but its just a way that i can somewhat understand. 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