guinness Posted November 7, 2011 Share Posted November 7, 2011 (edited) This is a proof of concept for the Trac Ticket #1631. It was requesting a native AutoIt function that could find the filepath of a handle returned by FileOpen. The suggestion of the API GetFinalPathNameByHandle was bounced around, but this can only work when using _WinAPI_CreateFile/Ex.This example is not implying that the request is either good nor bad and since I'm not a Dev it's not my responsibility to decide otherwise. What I can do is show that with a bit of lateral thinking the concept can be put into practice by using just native code.Is there a huge requirement to change alot of existing code?>> No, FileOpen becomes _FileOpen.So how does it work?>> Simple. Please see below.The syntax for _FileOpen & _FileClose are exactly the same as their counterparts, the only difference is the data that is passed to _FileOpen is stored in an Array which is then used as reference when finding the filepath of a handle.As I've mentioned this is a proof of concept UDF, so any suggestions or improvements are welcomed, but probably won't be implemented. Thanks.UDF: Save as _FileNameByHandle.au3expandcollapse popup#include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _FileNameByHandle ; AutoIt Version : v3.3.2.0 or higher ; Language ......: English ; Description ...: Find a filepath using the handle returned by _FileOpen. This can only be achieved by using the internal functions _FileOpen & _FileClose. ; Note ..........: This won't work with the handle returned by FileOpen & GetFinalPathNameByHandle won't work with FileOpen either. ; Author(s) .....: guinness ; Remarks .......: This is a workaround for the Trac Ticket: http://www.autoitscript.com/trac/autoit/ticket/1631 ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= #include <Constants.au3> ; #GLOBAL VARIABLES# ================================================================================================= Global Enum $__hFileHandleHWnd, $__sFileHandlePath, $__iFileHandleMode, $__iFileHandleMax Global $__vFileHandleAPI[2][$__iFileHandleMax] = [[1, $__iFileHandleMax, 1],[-1, -1, -1]] ; #CURRENT# ===================================================================================================================== ; _FileClose: Opens a file for reading or writing. ; _FileNameByHandle: Retrieves the final path of the specified file. ; _FileOpen: Closes a previously opened file. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __FileGetFreeIndex ......; Retrieve the index Int of the array to write the new data to. ; =============================================================================================================================== Func _FileClose($hHandle) _FileNameByHandle($hHandle) Local $iIndex = @extended If $iIndex = -1 Then Return SetError(1, 0, 0) EndIf Local $iReturn = FileClose($hHandle) For $i = 0 To $__vFileHandleAPI[0][1] - 1 $__vFileHandleAPI[$iIndex][$i] = -1 Next Return $iReturn EndFunc ;==>_FileClose Func _FileNameByHandle($hHandle) For $i = 1 To $__vFileHandleAPI[0][0] If $__vFileHandleAPI[$i][$__hFileHandleHWnd] = $hHandle Then Return SetExtended($i, $__vFileHandleAPI[$i][$__sFileHandlePath]) EndIf Next Return SetError(1, -1, '') EndFunc ;==>_FileNameByHandle Func _FileOpen($sFilePath, $iFlag = $FO_READ) Local $iIndex = 0 For $i = 1 To $__vFileHandleAPI[0][0] If $__vFileHandleAPI[$i][$__sFileHandlePath] = $sFilePath Then Switch Int((BitAND($iFlag, $FO_APPEND) Or BitAND($iFlag, $FO_OVERWRITE))) Case 0 If $__vFileHandleAPI[$iIndex][$__iFileHandleMode] = $FO_READ Then ExitLoop EndIf Case 1 If $__vFileHandleAPI[$iIndex][$__iFileHandleMode] = $FO_APPEND Then ExitLoop EndIf EndSwitch Return $__vFileHandleAPI[$i][$__hFileHandleHWnd] EndIf Next $iIndex = __FileGetFreeIndex() $__vFileHandleAPI[$iIndex][$__hFileHandleHWnd] = FileOpen($sFilePath, $iFlag) If $__vFileHandleAPI[$iIndex][$__hFileHandleHWnd] = -1 Then Return SetError(1, 0, -1) EndIf $__vFileHandleAPI[$iIndex][$__sFileHandlePath] = $sFilePath $__vFileHandleAPI[$iIndex][$__iFileHandleMode] = Int(BitAND($iFlag, $FO_APPEND) Or BitAND($iFlag, $FO_OVERWRITE)) ; 1 = Write mode or 0 = Read mode. Return $__vFileHandleAPI[$iIndex][$__hFileHandleHWnd] EndFunc ;==>_FileOpen ; #INTERNAL_USE_ONLY#============================================================================================================ Func __FileGetFreeIndex() For $i = 1 To $__vFileHandleAPI[0][0] If $__vFileHandleAPI[$i][$__hFileHandleHWnd] = -1 Then Return $i EndIf Next If ($__vFileHandleAPI[0][0] + 1) >= $__vFileHandleAPI[0][2] Then $__vFileHandleAPI[0][2] = Ceiling(($__vFileHandleAPI[0][0] + 1) * 1.5) ReDim $__vFileHandleAPI[$__vFileHandleAPI[0][2]][$__vFileHandleAPI[0][1]] EndIf $__vFileHandleAPI[0][0] += 1 For $i = 0 To $__vFileHandleAPI[0][1] - 1 $__vFileHandleAPI[$__vFileHandleAPI[0][0]][$i] = -1 Next Return $__vFileHandleAPI[0][0] EndFunc ;==>__FileGetFreeIndexExample use of UDF:#include '_FileNameByHandle.au3' Local $hFileOpen = _FileOpen(@ScriptFullPath, 0) ; Open the file in reading mode. ConsoleWrite('The return value of the native function FileOpen was: ' & $hFileOpen & @CRLF) ; Debug line. MsgBox($MB_SYSTEMMODAL, '_FileNameByHandle()', 'The filepath of the filehandle is:' & @CRLF & @CRLF & _FileNameByHandle($hFileOpen) & '.') ; Find the filepath by passing the filehandle to the function _FileNameByHandle. Local $iReturn = _FileClose($hFileOpen) ; Close the filehandle to release the file. ConsoleWrite('The return value of the native function FileClose was: ' & $iReturn & @CRLF) ; Debug line. Edited June 4, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted October 8, 2012 Author Share Posted October 8, 2012 Updated the UDF syntax and overall structure. Any suggestions then please post below. Thanks. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
JScript Posted October 8, 2012 Share Posted October 8, 2012 Excellent and very useful, 5 * from me! JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
guinness Posted October 9, 2012 Author Share Posted October 9, 2012 Thanks JScript for the vote. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted June 4, 2013 Author Share Posted June 4, 2013 (edited) I removed the 'magic numbers' from the UDF and at some point will look at optimising the UDF by removing the Global variables. I will probably do this in the next 10-20mins. Maybe another day. Edited June 4, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted March 2, 2014 Author Share Posted March 2, 2014 New version (without a Global Array) : expandcollapse popup#include <FileConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local Const $hFileOpen = _FileOpen(@ScriptFullPath, $FO_READ) ; Open the file in reading mode. MsgBox($MB_SYSTEMMODAL, '_FileNameByHandle()', 'The filepath of the FileOpen handle is:' & @CRLF & @CRLF & _FileNameByHandle($hFileOpen) & '.') ; Find the filepath by passing the filehandle to the function _FileNameByHandle. ConsoleWrite('The return value of the native function FileOpen was: ' & $hFileOpen & @CRLF) ; Debug line. ConsoleWrite('The return value of the native function FileClose was: ' & _FileClose($hFileOpen) & @CRLF) ; Close the filehandle to release the file. ConsoleWrite('The FileOpen handle is remmoved from the internal dictionary (it returns a blank string): ' & _FileNameByHandle($hFileOpen) & @CRLF) EndFunc ;==>Example Func _FileNameByHandle($hWnd) Return __FileNameByHandle_Internal($hWnd, Default, Default) EndFunc ;==>_FileNameByHandle Func _FileClose($hWnd) Local $iReturn = 0 If __FileNameByHandle_Internal($hWnd, Default, Null) Then $iReturn = FileClose($hWnd) EndIf Return $iReturn EndFunc ;==>_FileClose Func _FileOpen($sFilePath, $iMode = $FO_READ) Local Const $hFileOpen = FileOpen($sFilePath, $iMode) __FileNameByHandle_Internal($hFileOpen, $sFilePath, $iMode) Return $hFileOpen EndFunc ;==>_FileOpen ; #INTERNAL_USE_ONLY#============================================================================================================ Func __FileNameByHandle_Internal($hWnd, $sFilePath, $iMode) Local Static $hAssocFile = Null Local Const $fIsAssocFile = Not ($hAssocFile = Null) Local $fReturn = True If $iMode = Default Then ; FileNameByHandle() If $fIsAssocFile Then Local Const $MODE_LENGTH = 1 Return $hAssocFile.Exists($hWnd) ? StringTrimRight($hAssocFile.Item($hWnd), $MODE_LENGTH) : '' EndIf ElseIf $iMode = Null Then ; FileClose() If $hAssocFile.Exists($hWnd) Then $hAssocFile.Remove($hWnd) Else $fReturn = False EndIf Else If Not $fIsAssocFile Then $hAssocFile = ObjCreate('Scripting.Dictionary') If IsObj($hAssocFile) Then $hAssocFile.CompareMode = 0 ; $ASSOC_BINARYMODE Else $hAssocFile = Null $fReturn = False EndIf EndIf If $hWnd Then ; Int(BitAND($iFlag, $FO_APPEND) Or BitAND($iFlag, $FO_OVERWRITE)) ; 0 = Read mode or 1 = Write mode. $hAssocFile.Add($hWnd, $sFilePath & $iMode) EndIf EndIf Return $fReturn EndFunc ;==>__FileNameByHandle_Internal UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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