Jump to content
Sign in to follow this  
Yashied

TVExplorer UDF

Recommended Posts

Yashied,

I have asked in post #28 a questions that I thought I found an answer for it, but indeed I did not.

It was about how to detach a TV root iem and recreating it by using the following code:

My code was simply like this;

GUICtrlTreeView_Delete($hTV,  0)
GUICtrlTVExplorer_AttachFolder ( $hTV , $sPath)

When I delete the tree view item and attach new path to it its works and I do not see any error

until I exit the main application.

Once I close the main application I get crash or error such as: "!>12:13:42 AutoIT3.exe ended.rc:-1073741819"

Or " autoit3.exe - Application error , the instruction at 0x7c911980 referenced memory at 0x00000000. The memory could not be "read".

I have destroy the control on exit (either by _GUICtrlTVExplorer_Destroy() and _GUICtrlTVExplorer_DestroyAll())

and try almost anything to avoid the error but nothing help.

My code create once the control (_GUICtrlTVExplorer_Create) during the life time of the process

but dynamicly load the TV control with different path (I am using combobox filled with different path items)

.

I know could be many reasons to crash the application on exits but after investigating the issue many hours I have got to conclusion that the deleted root cause it.

Is there anything to do to detach the control without destroying it?

by the way, I noticed that the crash usually happens when expanding the TV items manually. If not expanding them then there is no crash. I am realy frustrated here...


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

You should not use GUICtrlTreeView_Delete().

#Include <ComboConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <TVExplorer.au3>
#Include <WindowsConstants.au3>

GUICreate('MyGUI', 400, 431)
$Combo = GUICtrlCreateCombo(@WorkingDir, 10, 10, 380, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
$hTV = _GUICtrlTVExplorer_Create(@WorkingDir, 10, 41, 380, 380, -1, $WS_EX_CLIENTEDGE)
GUISetState()

While 1
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo
            _GUICtrlTVExplorer_AttachFolder($hTV, GUICtrlRead($Combo))
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

You should not use GUICtrlTreeView_Delete().

#Include <ComboConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <TVExplorer.au3>
#Include <WindowsConstants.au3>

GUICreate('MyGUI', 400, 431)
$Combo = GUICtrlCreateCombo(@WorkingDir, 10, 10, 380, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
$hTV = _GUICtrlTVExplorer_Create(@WorkingDir, 10, 41, 380, 380, -1, $WS_EX_CLIENTEDGE)
GUISetState()

While 1
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo
            _GUICtrlTVExplorer_AttachFolder($hTV, GUICtrlRead($Combo))
    EndSwitch
WEnd

Hi Yashid,

The TVExplorer control is beautiful one. I found the error. it was not about deleting items or attaching folder.

I found that the onexit function that I am using in my script was called twice, so probably its caused memory deallocation

problem. Strangly it was happend only after expanding the tree's node items.

Regards.

BTW: For those who wants example with multiple GUI (Father/Chiled) here is a one:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TVExplorer.au3>
#Include <ComboConstants.au3>
Global $hForm, $hTV[3], $Input[3], $hFocus = 0, $Dummy, $Path, $Style, $oFILE 
$Father = GUICreate("Form1", 380, 193, 193, 115)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 75, 25, 0)
GUISetState(@SW_SHOW)
Global $Child, $Button2 ,$Combo
_CreateChiled()

While 1
    $nMsg = _GUICtrlTVExplorer_GetMsg(1)
    Switch $nMsg[1]
        Case $Father
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    _GUICtrlTVExplorer_DestroyAll()
                    Exit
                Case $Button1
                    GUISetState(@SW_SHOW, $Child)
            EndSwitch
        Case $Child
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Child)
                Case $Dummy
                    $Path = _GUICtrlTVExplorer_GetSelected($hFocus)
                    _GUICtrlTVExplorer_AttachFolder($hFocus)
                    _GUICtrlTVExplorer_Expand($hFocus, $Path, 0)
                    $hFocus = 0
                 Case $Combo
                        _ReCreateTVControl($hTV, GUICtrlRead($Combo))
            EndSwitch
    EndSwitch
WEnd
Func _ReCreateTVControl(ByRef $hTV, $Path)
    _GUICtrlTVExplorer_AttachFolder($hTV[0], $Path)
EndFunc   ;==>_ReCreateTVControl

Func _CreateChiled()
    $Child = GUICreate("Edit File System", 400, 400, 0, 0, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $Father)
    $Input[0] = GUICtrlCreateInput('', 20, 20, 320, 19)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $hTV[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 20, 48, 320, 210, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
    GUICtrlSetBkColor(-1, 0xF1F4F7)
    $Combo = GUICtrlCreateCombo(@WorkingDir, 10, 270, 380, 21, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
    $Dummy = GUICtrlCreateDummy()
    GUISetState(@SW_HIDE, $Child)
EndFunc   ;==>_CreateChiled

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    consolewrite("$hWnd=" & $hWnd & ", " & "$iMsg=" & "," & "$sPath=" & $sPath & ", " & "$hItem=" & $hItem & @CRLF)
    Switch $iMsg
        Case $TV_NOTIFY_BEGINUPDATE
            GUISetCursor(1, 1)
        Case $TV_NOTIFY_ENDUPDATE
            GUISetCursor(2)
        Case $TV_NOTIFY_SELCHANGED
                If $hTV[0] = $hWnd Then
                    _TVSetPath($Input[0], $sPath)
                EndIf
        Case $TV_NOTIFY_DBLCLK
            ; Nothing
        Case $TV_NOTIFY_RCLICK
            ; Nothing
        Case $TV_NOTIFY_DELETINGITEM
            ; Nothing
        Case $TV_NOTIFY_DISKMOUNTED
            ; Nothing
        Case $TV_NOTIFY_DISKUNMOUNTED
            ; Nothing
    EndSwitch
EndFunc   ;==>_TVEvent

Func _TVSetPath($iInput, $sPath)
    Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2)
    If GUICtrlRead($iInput) <> $Text Then
        GUICtrlSetData($iInput, $Text)
    EndIf
EndFunc   ;==>_TVSetPath

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Hi Yashied

Melba aimed me @ TVExplorer so I immediately downloaded & tested but there seems to be a small issue which might be an easy fix.

Firstly, I did add " #include APIConstants.au3" to the example as noted above by Wakillon.

The TVExplorer.au3 is in my User Includes which is correctly configed and everything is as up to date as possible.

They are only warnings and the example does continue to operate but figured you should know.

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:AutoIT_ScriptsTVExplorerTVExplorer_Ex.au3" /UserParams   
+>13:13:52 Starting AutoIt3Wrapper v.2.1.0.8    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0)  from:C:Program Files (x86)AutoIt3
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(833,66) : WARNING: $SEM_FAILCRITICALERRORS: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(833,91) : WARNING: $SEM_NOOPENFILEERRORBOX: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(945,39) : WARNING: $SHGFI_SMALLICON: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(945,60) : WARNING: $SHGFI_SYSICONINDEX: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(949,33) : WARNING: $SHGFI_OPENICON: possibly used before declaration.
  $Flags = BitOR($SHGFI_OPENICON,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,61) : WARNING: $SHGFI_ICON: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,82) : WARNING: $SHGFI_OVERLAYINDEX: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,108) : WARNING: $SHGFI_USEFILEATTRIBUTES: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1082,40) : WARNING: $SSF_SHOWALLOBJECTS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1082,64) : WARNING: $SSF_SHOWEXTENSIONS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1362,28) : WARNING: $SIID_DOCNOASSOC: possibly used before declaration.
  $ID[0] = $SIID_DOCNOASSOC
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1363,24) : WARNING: $SIID_FOLDER: possibly used before declaration.
  $ID[1] = $SIID_FOLDER
  ~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1364,28) : WARNING: $SIID_FOLDEROPEN: possibly used before declaration.
  $ID[2] = $SIID_FOLDEROPEN
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1366,69) : WARNING: $SHGSI_ICON: possibly used before declaration.
   $tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1366,87) : WARNING: $SHGSI_SMALLICON: possibly used before declaration.
   $tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1404,28) : WARNING: $SIID_DRIVEFIXED: possibly used before declaration.
  $ID[0] = $SIID_DRIVEFIXED
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1405,29) : WARNING: $SIID_DRIVEREMOVE: possibly used before declaration.
  $ID[1] = $SIID_DRIVEREMOVE
  ~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1406,26) : WARNING: $SIID_DRIVERAM: possibly used before declaration.
  $ID[2] = $SIID_DRIVERAM
  ~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1407,25) : WARNING: $SIID_DRIVECD: possibly used before declaration.
  $ID[3] = $SIID_DRIVECD
  ~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1408,26) : WARNING: $SIID_DRIVENET: possibly used before declaration.
  $ID[4] = $SIID_DRIVENET
  ~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsTVExplorerTVExplorer_Ex.au3 - 0 error(s), 20 warning(s)

Thanks to ALL THE CONTRIBUTORS

Such a community ! Love it !!

WhiteStar


~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Share this post


Link to post
Share on other sites

Search WinAPIEx.au3 by Yashied and there you'll find APIConstants.au3.


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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Hi Guiness

I had the TVExplorer_Ex.au3 set this way:

#Include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>
#Include <APIConstants.au3>

Thanks to your quick tip and a quick glance @ WinAPIEx, I relocated the #Include <APIConstants.au3> above #Include <WinAPIEx.au3> it works without error messages.

I have the latest WinAPIEx.au3 (which changes so often I feel like I need to update almost weekly LOL) but there is no Include in it for APIConstants.au3, maybe it was omitted during the last update or two, I don't know.

Thanks

WhiteStar


~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Share this post


Link to post
Share on other sites

APIConstants.au3 is separate to keep the size of WinAPIEx.au3 down (or so I've understood it). Sometimes I've used functions from WinAPIEx but haven't needed to include APIConstants.au3, though these are rare occasions.


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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Hi all, I've just downloaded and updated TVExplorer and WinAPIEx but when I run the example I get the following warnings/errors, almost the same as WhiteStar, (he only got warnings), did above.

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3"
+>21:38:19 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,66) : WARNING: $SEM_FAILCRITICALERRORS: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,91) : WARNING: $SEM_NOOPENFILEERRORBOX: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,39) : WARNING: $SHGFI_SMALLICON: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,60) : WARNING: $SHGFI_SYSICONINDEX: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(949,33) : WARNING: $SHGFI_OPENICON: possibly used before declaration.
$Flags = BitOR($SHGFI_OPENICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,61) : WARNING: $SHGFI_ICON: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,82) : WARNING: $SHGFI_OVERLAYINDEX: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,108) : WARNING: $SHGFI_USEFILEATTRIBUTES: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,40) : WARNING: $SSF_SHOWALLOBJECTS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,64) : WARNING: $SSF_SHOWEXTENSIONS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1362,28) : WARNING: $SIID_DOCNOASSOC: possibly used before declaration.
$ID[0] = $SIID_DOCNOASSOC
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1363,24) : WARNING: $SIID_FOLDER: possibly used before declaration.
$ID[1] = $SIID_FOLDER
~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1364,28) : WARNING: $SIID_FOLDEROPEN: possibly used before declaration.
$ID[2] = $SIID_FOLDEROPEN
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,69) : WARNING: $SHGSI_ICON: possibly used before declaration.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,87) : WARNING: $SHGSI_SMALLICON: possibly used before declaration.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1404,28) : WARNING: $SIID_DRIVEFIXED: possibly used before declaration.
$ID[0] = $SIID_DRIVEFIXED
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1405,29) : WARNING: $SIID_DRIVEREMOVE: possibly used before declaration.
$ID[1] = $SIID_DRIVEREMOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1406,26) : WARNING: $SIID_DRIVERAM: possibly used before declaration.
$ID[2] = $SIID_DRIVERAM
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1407,25) : WARNING: $SIID_DRIVECD: possibly used before declaration.
$ID[3] = $SIID_DRIVECD
~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1408,26) : WARNING: $SIID_DRIVENET: possibly used before declaration.
$ID[4] = $SIID_DRIVENET
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,66) : ERROR: $SEM_FAILCRITICALERRORS: undeclared global variable.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,91) : ERROR: $SEM_NOOPENFILEERRORBOX: undeclared global variable.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,39) : ERROR: $SHGFI_SMALLICON: undeclared global variable.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,60) : ERROR: $SHGFI_SYSICONINDEX: undeclared global variable.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(949,33) : ERROR: $SHGFI_OPENICON: undeclared global variable.
$Flags = BitOR($SHGFI_OPENICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,61) : ERROR: $SHGFI_ICON: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,82) : ERROR: $SHGFI_OVERLAYINDEX: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,108) : ERROR: $SHGFI_USEFILEATTRIBUTES: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,40) : ERROR: $SSF_SHOWALLOBJECTS: undeclared global variable.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,64) : ERROR: $SSF_SHOWEXTENSIONS: undeclared global variable.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1362,28) : ERROR: $SIID_DOCNOASSOC: undeclared global variable.
$ID[0] = $SIID_DOCNOASSOC
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1363,24) : ERROR: $SIID_FOLDER: undeclared global variable.
$ID[1] = $SIID_FOLDER
~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1364,28) : ERROR: $SIID_FOLDEROPEN: undeclared global variable.
$ID[2] = $SIID_FOLDEROPEN
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,69) : ERROR: $SHGSI_ICON: undeclared global variable.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,87) : ERROR: $SHGSI_SMALLICON: undeclared global variable.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1404,28) : ERROR: $SIID_DRIVEFIXED: undeclared global variable.
$ID[0] = $SIID_DRIVEFIXED
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1405,29) : ERROR: $SIID_DRIVEREMOVE: undeclared global variable.
$ID[1] = $SIID_DRIVEREMOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1406,26) : ERROR: $SIID_DRIVERAM: undeclared global variable.
$ID[2] = $SIID_DRIVERAM
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1407,25) : ERROR: $SIID_DRIVECD: undeclared global variable.
$ID[3] = $SIID_DRIVECD
~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1408,26) : ERROR: $SIID_DRIVENET: undeclared global variable.
$ID[4] = $SIID_DRIVENET
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3 - 20 error(s), 20 warning(s)
!>21:38:19 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 0 Time: 0.530

So I added the #include <APIConstants.au3> as he suggested above:

#Include <GUIConstantsEx.au3>
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>

But I still end up with 1 error that won't let me run the examples:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "D:\My Documents\AutoIt\TVExplorer\TVExplorer_Ex.au3"
+>21:47:01 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3
C:\Program Files (x86)\AutoIt3\Include\ImageListConstants.au3(12,40) : ERROR: $E_INVALIDARG previously declared as a 'Const'.
Global Const $E_INVALIDARG = 0x80070057
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer_Ex.au3 - 1 error(s), 0 warning(s)
!>21:47:02 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 0 Time: 1.097

I could comment out the offending line in either of the includes but then I'd be afraid of breaking something else - I'm using AutoIt 3.3.8.0, (tried 3.3.8.1, didn't make any difference), Win7 x64.

Is there a better fix available than just commenting out the line?

Thanks for any help.

Share this post


Link to post
Share on other sites

Unfortunately no.

I once had the same problem that a constant was defined in two include files. You have to comment out one of them. If they have the same value assigned then it shouldn't be a problem for your scripts.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-04-14 - Version 1.5.3.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-04-13 - Version 1.6.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Thanks water, I'll move the modified include into the source directory so it doesn't screw up other things.

Share this post


Link to post
Share on other sites
:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-04-14 - Version 1.5.3.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-04-13 - Version 1.6.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

I'm trying to add a 'tristate' to this udf

but i'm not having success!

would be good to add that in the next version, if i get news i post here!

p.s: very nice udf, thanks for sharing!

Edited by darkshark

Share this post


Link to post
Share on other sites

ModemJunki,

Look at posts #12 and 13 - that should give you a clue. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest

Hi Yashied,

I want to add the path @DesktopDir to the ListView but i can not find a normal way how to do it with your UDF..

I did it in very horrible way.. i did it with help from your example in

http://www.autoitscript.com/forum/topic/124430-display-on-the-fly-a-directory-tree-in-a-treeview/

this is what i did:

#Include <GUIConstantsEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>
#Include <WinAPIEx.au3>
#Include <Array.au3>
#AutoIt3Wrapper_Run_AU3Check=n

;~ Opt('MustDeclareVars', 1)

Global $hForm , $Input[3], $hFocus = 0, $Dummy, $Path, $Style

If Not _WinAPI_DwmIsCompositionEnabled() Then
    $Style = $WS_EX_COMPOSITED
Else
    $Style = -1
EndIf
$hForm = GUICreate('TVExplorer UDF Example', 700, 736, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $Style)
GUISetIcon(@WindowsDir & '\explorer.exe')
$hListViewInput = GUICtrlCreateInput('', 20, 378, 660, 19)

GUICtrlSetState(-1, $GUI_DISABLE)
$hListView = _GUICtrlTVExplorer_Create('', 20, 406, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
_TVSetPath($hListViewInput, _GUICtrlTVExplorer_GetSelected($hListView))
;~ _TV_Update("D:\Games", $hListView)
;~ _GUICtrlTVExplorer_AttachFolder($hListView, "D:\Games")

_TVUpdate($hListView,_GUICtrlTreeView_AddChild($hListView, 0,@DesktopDir, 0, 0) ) ; < =========== this is what i want to do - to add the path @DesktopDir to the list

;~ _TV_AddShortcut(1, $hListView, "D:\Games")

;~ _TV_Index($hListViewInput)

_GUICtrlTVExplorer_SetExplorerStyle($hListView)






;~ For $i = 0 To 2
;~  ConsoleWrite(_GUICtrlTVExplorer_GetSelected($hTV[$i])&@CRLF)
;~     _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i]))
;~     _GUICtrlTVExplorer_SetExplorerStyle($hTV[$i])
;~ Next
GUISetState()





While 1
;~  ToolTip(_TV_Index($hListViewInput))
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            _GUICtrlTVExplorer_DestroyAll()
            Exit
        Case $TV_NOTIFY_SELCHANGED
            _TVSetPath($hListViewInput, $sPath)
    EndSwitch
WEnd

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    Switch $iMsg
        Case $TV_NOTIFY_SELCHANGED
            _TVSetPath($hListViewInput, $sPath)
    EndSwitch
EndFunc   ;==>_TVEvent

Func _TVSetPath($iInput, $sPath)
;~  ConsoleWrite($sPath&@CRLF)
    Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2)

    If GUICtrlRead($iInput) <> $Text Then
        GUICtrlSetData($iInput, $Text)
    EndIf
EndFunc   ;==>_TVSetPath





; ========================================== Functions from:  http://www.autoitscript.com/forum/topic/124430-display-on-the-fly-a-directory-tree-in-a-treeview/  ==========================

Func _TVUpdate($hTV, $hItem)
    Local $hImageList = _SendMessage($hTV, $TVM_GETIMAGELIST)
    Local $Path = StringRegExpReplace(_TVGetPath($hTV, $hItem, "\"), '\\+\Z', '')
    ;ConsoleWrite($Path&@CRLF)
    Local $var = StringSplit($Path,"\",1)
    Local $foldername = $var[$var[0]]
    Local $Excluded[8] = [7, "$Recycle.Bin", "Documents and Settings", 'MSOCache', "PerfLogs", "ProgramData", "Recovery" , "System Volume Information"]
    If _ArraySearch($Excluded,$foldername,1) > 0 Then Return 0
    ;If DirGetSize($Path) = 0 Then Return 1
    Local $hSearch, $hIcon, $Index, $File

    $hSearch = FileFindFirstFile($Path & '\*')
    If $hSearch = -1 Then
        If Not @error Then
            If FileExists($Path) Then
;               If _WinAPI_PathIsDirectory($Path) Then
;                   ; Access denied
;               EndIf
            Else
                Return 0
            EndIf
        EndIf
    Else
        While 1
            $File = FileFindNextFile($hSearch)
            If @error Then
                ExitLoop
            EndIf
            ;If DirGetSize($Path) = 0 Then Return 0

            If @extended Then
                _GUICtrlTreeView_AddChild($hTV, $hItem, $File, 0, 0)

            EndIf
        WEnd
        FileClose($hSearch)
        ;ConsoleWrite($File&@CRLF)
    EndIf
    Return 1
EndFunc   ;==>_TVUpdate


Func _TVGetPath($hTV, $hItem, $sRoot)
    Local $Path = StringRegExpReplace(_GUICtrlTreeView_GetTree($hTV, $hItem), '([|]+)|(\\[|])', '\\')
    If Not $Path Then
        Return ''
    EndIf
    If Not StringInStr($Path, ':') Then
        Return StringRegExpReplace($sRoot, '(\\[^\\]*(\\|)+)\Z', '\\') & $Path
    EndIf
    Return $Path
EndFunc   ;==>_TVGetPath

In your UDF i tried _GUICtrlTVExplorer_AttachFolder and this function works but it deletes all other items in the list..

 

Please 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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Synaps3
      This script will make it so you can press Alt + "+" in Windows Explorer to select all files with the current file extension. This is something that I wanted for a long time and it should be a feature in Windows, but it's not. The only way to get close is to use the search thing (but then it shows the results excluding everything else) or to group by that type, but I don't want it grouped.
      You can press Alt + Enter right after to open properties on those files or you can press delete to delete only files of that type.
      You need the "Automating Windows Explorer" pack here: https://www.autoitscript.com/forum/topic/162905-automating-windows-explorer/
       
      #include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt( "MustDeclareVars", 1 ) HotKeySet("!=", "SelectTypes") Func SelectTypes() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Could not find Windows Explorer.") Return EndIf $hExplorer = WinActive("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Windows Explorer is not in focus.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Explorer", "Could not get an IShellBrowser interface.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get selected files with full path ;GetFiles( $fSelected = False, $fFullPath = False, $fPidl = False, $iMax = 0 ) Local $aAllFiles = GetItems(False, False) Local $aFiles = GetItems(True, False) Local $sExt Local $i If UBound($aFiles) = 1 Then ;MsgBox(0, "Selected", $aFiles[0]) $sExt = StringRight($aFiles[0], StringLen($aFiles[0]) - StringInStr($aFiles[0], ".", 0, -1)) ;MsgBox(0, "Selected", $sExt) For $i = 0 To UBound($aAllFiles) - 1 If StringInStr($aAllFiles[$i], ".") > 0 Then If StringRight($aAllFiles[$i], StringLen($aAllFiles[$i]) - StringInStr($aAllFiles[$i], ".", 0, -1)) = $sExt Then SetSelectedItem($i) EndIf EndIf Next Else MsgBox($MB_ICONWARNING, "Error", "None or multiple items selected!") EndIf EndFunc While 1 GUIGetMsg() Wend  
    • By jcpetu
      Hi people, I'm trying to dynamically populate a TreeView based on a script from Water that I modified for my needs. but I can't figured it out how to make it work.
      Here what I have in case anyone can help me, thanks in advance:
      #include <array.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> Local $aTV1[14][3] = [ _ ['1', 'Text 1', -1], _ ;-1 idicates it's an index item ['2', 'Text 2',-1], _ ['3', 'Text 3',-1], _ ['1-1', 'Text 1-1',0], _ ['1-2', 'Text 1-2',0], _ ['2-1', 'Text 2-1',0], _ ['2-2', 'Text 2-2',0], _ ['2-1-1', 'Text 2-1-1',0], _ ['2-1-2', 'Text 2-1-2',0], _ ['2-1-2-1', 'Text 2-1-2-1',0], _ ['2-1-2-1-1', 'Text 2-1-2-1-1',0], _ ['3-1', 'Text 3-1',0], _ ['3-1-1', 'Text 3-1-1',0], _ ['3-1-1-1', 'Text 3-1-1-1',0]] ;_ArrayDisplay($aTV1) Local $Gui = GUICreate('TreeView Example', 500, 600) Local $tv = GUICtrlCreateTreeView(10, 30, 450, 550) GUISetState() _pop_treeview($tv, $aTV1) While 1 Switch GUIGetMsg() Case $gui_event_close Exit EndSwitch WEnd Func _pop_treeview($hTV, $array) Local $TimeInitial = TimerInit(), $Hours, $Mins, $Secs, $item _ArraySort($array, 0, 0, 0, 0) ;------------------------- sort Ascending on column 0 ;_ArrayDisplay($array) $idxroot = _GUICtrlTreeView_Add($hTV, 0, "index") For $i = 0 To UBound($array) - 1 ConsoleWrite("$array[" & $i & "][" & 0 & "] = " & $array[$i][0] & @CRLF) If $array[$i][0] = '' Then ExitLoop ;--------------- Exit at first empty element $item = '' If $array[$i][2] = -1 Then ;------------------------ Add root element _GUICtrlTreeView_AddChild($hTV, $idxroot, $array[$i][1]) Else $item = StringLeft($array[$i][0], StringInStr($array[$i][0], "-", 1, -1) - 1) ConsoleWrite("$item = " & $item & @CRLF) $Found = _ArrayBinarySearch($array, $item, 0, 0, 0) ;search on column 0 Switch $Found Case 0 ;----------------------------------- Value wasn't found in array ConsoleWrite("Item NOT found @error= " & @error & @CRLF) Case Else ConsoleWrite("Item found " & @CRLF) _GUICtrlTreeView_AddChild($hTV, $Found, $array[$i][1]) EndSwitch EndIf Next _GUICtrlTreeView_Expand($hTV) EndFunc ;==>_pop_treeview  
    • By MesterPerfect
      good morning
      this is the first post here in the autoit forums
      i hope that you can help me in my problem
      i have a JSON encoded
      it a map of my forums
      where i want to make a treeview that have the same type of map
      e.g
      a system (as category)
      windows (as sub category)
      software (as an child item in the windows category)
      .....
      i don't know how to do that
      so, i know that i can do that using the json functions
      but i need your help about how we can do it as the type that i told you
      by the way i need to put the sub info for each item in an array that give me the ability to manage my items
      e.g
      can post thread
      can reply
      message cound ...
      you just give me a small example and i can continue.
      am sorry if this against the rules of the forum.
      but i realy searched a lot but i couldn't
      i hope some one give me the way.
      thank you very much in advance
       
      here is the link of json forum
      https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/
      and here is my encoded json file
       
      { "tree_map": { "0": [ 1, 5, 6, 7 ], "1": [ 2 ], "2": [ 4 ], "5": [ 3 ], "6": [ 8 ], "8": [ 9, 10 ] }, "nodes": [ { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 1, "node_id": 1, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Main category", "type_data": {} }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 2, "node_name": null, "node_type_id": "Forum", "parent_node_id": 1, "title": "Main forum", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" }, { "node_id": 2, "title": "Main forum", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 4, "node_name": null, "node_type_id": "Forum", "parent_node_id": 2, "title": "my forums1", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 2, "node_id": 5, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Perfect", "type_data": {} }, { "breadcrumbs": [ { "node_id": 5, "title": "Perfect", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 2, "node_id": 3, "node_name": null, "node_type_id": "Forum", "parent_node_id": 5, "title": "ahmed", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 3, "node_id": 6, "node_name": null, "node_type_id": "Forum", "parent_node_id": 0, "title": "autoit", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 8, "node_name": null, "node_type_id": "Forum", "parent_node_id": 6, "title": "examples", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 9, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "GUI", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 31, "node_id": 10, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "windowEX", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 4, "node_id": 7, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "vbs", "type_data": {} } ] }  
    • By WoodGrain
      Hi All,
      Trying to open windows explorer to a WebDav location and it's not working quite how I want, on the computers it is setup as a "network location" (as opposed to a "mapped drive", and this unfortunately can't be changed), the "Data" WebDav folder sits directly under "This PC" if that's an easier way to get to it. any suggestions as to what I can correct to get the 2nd example to work?
      ; This works, but I'm trying to avoid this as users normally see the URL style in the 2nd example below $folderToOpen = "\\mycompany.sharepoint.com@SSL\DavWWWRoot\Data" Run("Explorer.exe " & $folderToOpen) ; This does not work, it tries to open the WebDav url in the default web browser $folderToOpen = "https://mycompany.sharepoint.com/Data" Run("Explorer.exe " & $folderToOpen) ShellExecute also opens it in the default browser.
      Saw _WinAPI_ShellOpenFolderAndSelectItems but couldn't get the 2nd example to work.
      If I manually open Windows Explorer and paste in https://mycompany.sharepoint.com/Data it loads the WebDav directory without issue.
      If I have to use the pathing from the first example it is fine, just trying to give users a familiar experience.
      Thanks!
    • By Burgs
      Hello,
        I am having great difficulty with something I would have thought to be fairly easy.  I have an array containing (military) organization strings, similar to this:
      42nd Battalion
       Company A
        1st Platoon
         1st Squad
         2nd Squad
         3rd Squad
        2nd Platoon
         ...1st, 2nd, 3rd Squad
        3rd Platoon
        ...1st, 2nd, 3rd Squad
       Company B
        ...etc...
      I also have an associated array that contains the 'hierarchy' information associated with each string..."0", "1","2", etc   ...therefore using example above the "0" would associate with "42nd Battalion", while "1" would be "Company A", "2" is "1st Platoon", etc.  Each sequential number is a 'child' of the preceding number.  Therefore the information above would appear in the array as "0", "1", "2", "3", "3", "3", "2", "3", "3", "3", "2", "3", "3", "3", "1", etc...
        My issue is that I'm having great difficulty creating a 'Treeview' control using this information.  Mainly due to the fact that entries can, and will...repeat (for example multiple entries for "Company A", "Company B", "1st Platoon", "1st Squad", etc, etc).  The following code is operative, however it does not create the treeview items as 'child' entries of one another...it simply lists each item as a separate entity.
      For $_populate = 0 to Ubound($_HIERARCHY) - 1 _GUICtrlTreeView_BeginUpdate($idTreeView) _GUICtrlTreeView_Add($idTreeView, $_HIERARCHY[$_populate], String($_STRUCTURES[$_populate])) _GUICtrlTreeView_EndUpdate($idTreeView) Next ;Next $_populate, cycle thru '$_HIERARCHY' array to build 'TREEVIEW' Controls As I mentioned earlier I thought I could manage this...however i'm pulling out quite a bit of my hair trying to get this working properly...any help would be appreciated.  I thank you in advance. 
       
×
×
  • Create New...