Jump to content

Recommended Posts


I just did as I understood this:https://www.autoitscript.com/autoit3/docs/functions/FileGetVersion.htm
I am wrong, but the examplanation is also bad.

#Include <WinAPI.au3>
#include <MsgBoxConstants.au3>


ConsoleWrite(_FileInUse($Path) & @CR)

Func _FileInUse($sFile)

    Local $hFile = _WinAPI_CreateFile($sFile, 2, 2, 0)

    If $hFile Then
        Return 0

    Local $Error = _WinAPI_GetLastError()

    Switch $Error
            Return 1
        Case Else
            Return SetError($Error, 0, 0)
EndFunc   ;==>_FileIsUses

Func GetFileVersion()
    ; Retrieve the file version of the AutoIt executable.
    Local $sFileVersion = FileGetVersion($Path, $FV_PRODUCTNAME ("ProductName"))

    ; Display the file version. This should be equal to @AutoItVersion.
    MsgBox($MB_SYSTEMMODAL, "", $sFileVersion)
EndFunc   ;==>Example



>Running:(\autoit3.exe "C:\test\fileinuse.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\test\fileinuse.au3" (30) : ==> Variable cannot be accessed in this manner.:
Local $sFileVersion = FileGetVersion($Path, $FV_PRODUCTNAME ("ProductName"))
Local $sFileVersion = FileGetVersion($Path, $FV_PRODUCTNAME ^ ERROR
->21:24:15 AutoIt3.exe ended.rc:1
+>21:24:15 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 0.4797


Link to post
Share on other sites
  • Developers

The stuff between brackets is an explanation so the function should be:

FileGetVersion($Path, $FV_PRODUCTNAME)


FileGetVersion($Path, "ProductName")


Edited by 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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...