StephenAberle Posted June 13, 2012 Share Posted June 13, 2012 I use the #AutoIt3Wrapper_Res_Fileversion and #AutoIt3Wrapper_Res_FileVersion_AutoIncrement compiler directives and find them very useful. Is there a way that I can determine the AutoIt3Wrapper_Res_FileVersion value at runtime from within the script? I recognize that if I'm running a compiled .EXE I can get the version number by using FileGetVersion(@ScriptFullPath), but I want to be able to find this value whether I'm running script or an EXE. I would think it should be available, since it's sitting right there in the script; I just don't know how to read it. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 13, 2012 Share Posted June 13, 2012 You'd have to set a variable inside the script that is set to the current version. You'd have to manually update this variable every time your script's version is changed. 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...
StephenAberle Posted June 13, 2012 Author Share Posted June 13, 2012 I thought of that, but it defeats the purpose of the #AutoIt3Wrapper_Res_FileVersion_AutoIncrement directive. There's gotta be a way... I'm going to investigate using the #AutoIt3Wrapper_Run_Before directive together with the %fileversion% variable to store this information somewhere -- an INI file or the Registry or something. Still too kludgy for my liking. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 13, 2012 Share Posted June 13, 2012 I'm pretty sure that the #AutoIt3Wrapper_Run_Before directive is only acted on when you're compiling the script, not when you're running it from SciTE. 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...
someone Posted June 13, 2012 Share Posted June 13, 2012 Kinda messy....but just an idea. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=test.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=test #AutoIt3Wrapper_Res_Fileversion=1.0.0.2 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If @Compiled = 1 Then ;filegetversion... $ver = FileGetVersion(@ScriptFullPath) MsgBox(0, "Version", "Version " & $ver) Else $file = FileOpen(@ScriptFullPath, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringInStr($line, "#AutoIt3Wrapper_Res_Fileversion=") Then $ver = StringRight($line, 7) MsgBox(0, "Version", "Version " & $ver) ExitLoop EndIf ;MsgBox(0, "Line read:", $line) WEnd FileClose($file) EndIf BrewManNH 1 While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Popular Post AdmiralAlkex Posted June 13, 2012 Popular Post Share Posted June 13, 2012 IniRead() anyone? #cs [FileVersion] #ce #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=1.0.0.2 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** MsgBox(0, "Version:", _GetVersion()) Func _GetVersion() If @Compiled Then Return FileGetVersion(@AutoItExe) Else Return IniRead(@ScriptFullPath, "FileVersion", "#AutoIt3Wrapper_Res_Fileversion", "0.0.0.0") EndIf EndFunc AdamUL, TrevorPearson, someone and 2 others 5 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
someone Posted June 13, 2012 Share Posted June 13, 2012 hehe...thats funny I was wondering if you could use IniRead..very cool good to know. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd 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