marabunta Posted July 17, 2015 Share Posted July 17, 2015 expandcollapse popupHello, 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> $Path='C:\test.dll' ConsoleWrite(_FileInUse($Path) & @CR) Func _FileInUse($sFile) Local $hFile = _WinAPI_CreateFile($sFile, 2, 2, 0) If $hFile Then _WinAPI_CloseHandle($hFile) Return 0 EndIf Local $Error = _WinAPI_GetLastError() Switch $Error Case 32 ; ERROR_SHARING_VIOLATION Return 1 Case Else Return SetError($Error, 0, 0) EndSwitch 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 GetFileVersion() Result: >Running:(3.3.14.0):C:\autoit3.exe "C:\test\fileinuse.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 0 "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 comment Share on other sites More sharing options...
Developers Jos Posted July 17, 2015 Developers Share Posted July 17, 2015 (edited) The stuff between brackets is an explanation so the function should be:FileGetVersion($Path, $FV_PRODUCTNAME)-or-FileGetVersion($Path, "ProductName")Jos Edited July 17, 2015 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 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