Jump to content
Sign in to follow this  
mikeyr

SOLVED --- get FileVersion in code

Recommended Posts

mikeyr

I am trying to get the version of ...Res_FileVersion to output to my screen OR my EXEs version but when I use FileGetVersion I always get AutoIT's version, I tried a variety of "stringname" and not found it yet :D

This is cut down but you get the idea, what I want is in the lower left corner to display is 0.91.0.4 and not 3.3.10

CODE
; *** Start added by AutoIt3Wrapper ***

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

; *** End added by AutoIt3Wrapper ***

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_Res_Fileversion=0.91.0.4

#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y

#AutoIt3Wrapper_Add_Constants=n

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GuiConstants.au3>

#include <GuiEdit.au3>

Opt("TrayIconHide", 1)

GUICreate("Map Drive", 280, 150)

GuiCtrlCreateLabel(filegetversion(@AutoItExe,"Fileversion"), 1, 137, 30, 15) ;try and keep this up to date so you can keep track of which version is out in the wild.

GuiCtrlCreateLabel("User name:", 20, 15, 60, 20)

$username_cf = GUICtrlCreateInput("", 90, 10, 180, 20)

GuiCtrlCreateLabel("Password:", 20, 40, 60, 20)

$password_cf = GUICtrlCreateInput("", 90, 40, 180, 20, $ES_PASSWORD)

$connect_cf = GUICtrlCreateButton("Connect!", 60, 80, 80, 25)

$cancel_cf = GUICtrlCreateButton("Cancel", 160, 80, 80, 25)

GUISetState()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE or $msg = $cancel_cf Then ExitLoop

Select

Case $msg = $connect_cf

Case $msg = $GUI_EVENT_CLOSE ;not needed anymore due to if clause above ?

ExitLoop

EndSelect

WEnd

Edited by mikeyr

Share this post


Link to post
Share on other sites
mikeyr

Isn't there a way to get this ? I am not sure what Forumer is trying to say because it is not giving the result I want (or I would not have asked for help :D )

My exe has the correct version and that is what I need to display, I often forget to update the version when i release the software so I want to get it and display it.

Maybe I was not clear the first time, what I want to display is VERSION 0.91.0.4 and NOT 3.3.1 from autoit version, the EXE has the correct version when I do a "properties" on it.

Edited by mikeyr

Share this post


Link to post
Share on other sites
Jos

Have you installed the full version of SciTE4AutoIt3?

That is required as that run AutoIt3Wrapper which does the Resource Update.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
mikeyr

Have you installed the full version of SciTE4AutoIt3?

I thought I had, pretty sure I did. In windows if I right-mouse click on my EXE it does give me version 0.9,etc... doesn't that mean that I have the full version and it did its thing ? I just reloaded the full version and got the same results...

********** EDIT SOLVED... when running from the Editor it gives you the AutoIT version, if you run FROM THE EXE it works, makes sense but I was running from the editor ************

Edited by mikeyr

Share this post


Link to post
Share on other sites
Jos

I thought I had, pretty sure I did. In windows if I right-mouse click on my EXE it does give me version 0.9,etc... doesn't that mean that I have the full version and it did its thing ? How would I check ? I was thinking that since Windows showed me the correct version that the EXE was correct. I have the full SciTEAutoIT3 install file here so I must have done it since the versions are changing in the EXE...will try a re-install right now, I really need this solved :D

I just copied your code into a script. compiled it and ran the output EXE.

This showed me the Version as defined in the Script.

You say that Explorer shows the correct version?

What OS are you running?

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
mikeyr

I just copied your code into a script. compiled it and ran the output EXE.

This showed me the Version as defined in the Script.

Yes, we typed in the answer at the same time, I have to run FROM the EXE to get the proper results, duh, it makes sense now that I think about it. I was running from the editor.

Now how do I mark this thread solved :D

Share this post


Link to post
Share on other sites
rajeshontheweb

If @Compiled Then
    $FileVersion = "Ver: " & filegetversion(@AutoItExe,"Fileversion")
Else
    $FileVersion = "Au3 Ver: " & filegetversion(@AutoItExe,"Fileversion")
EndIf


Opt("TrayIconHide", 1)

GUICreate("Map Drive", 280, 150)

GuiCtrlCreateLabel($FileVersion, 1, 137, 100, 15) ;try and keep this up to date so you can keep track of which version is out in the wild.

This will do the trick , and to mark solved , i just go to first post, edit it and add a tag [solved] to the title :-)

Though i dont use edit box, i have scanning functionality specific to few viruses, the version i would use is attached herewith. :-)

> Gives user the information which drives were scanned

> if the media is not mounted properly, or the drive is unavailable then user will be notified (typically media not properly inserted into card reader would make the user feel his card is free from autorun viruses- this is a common case i see now adays autorun viruses get distributed in ALL REMOVABLE MEDIA not just flash drives.. ( i know thats why u came up with this:D ) my bad ....<sorry>

_SCanforAutorun_inf.au3

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
mikeyr

I like your way of using the IF loop to verify I am doing it right, I tend to run a lot from the editor while testing, This will help me.

Thanks...

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×