Jump to content

A3LMenu - examples


Recommended Posts

I got this example for A3LMenu.au3 include a long time ago (see code below). I noticed though that the newest A3LMenu.au3 does not have the same functions or working functions anymore.

Question: Does anyone know how I can fix the below script or another example that uses Explorer?

I did search the forum and try to resolve this myself, but "no dice." I have a good feeling that I'll be slapped for asking this question; I just don't know why yet.

#include <A3LMenu.au3>
#include <A3LToolbar.au3>
#include <A3LTreeView.au3>
Opt('TrayIconDebug',1)
Opt("MustDeclareVars", 1)

; ====================================================================================================



; Description ...: Shows how to set up folder views in Explorer
; Author ........: Paul Campbell (PaulIA)
; Notes .........:
; ====================================================================================================




; ====================================================================================================



; Global variables
; ====================================================================================================




Global $hToolbar

; ====================================================================================================



; Main
; ====================================================================================================



Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
_Lib_WinWaitActive("My Computer")
$hToolbar = _Toolbar_FindToolbar("My Computer", "&File")

Views()
Folders()
StatusBar()
Close()

; ====================================================================================================



; Close Explorer
; ====================================================================================================



Func Close()
  _Lib_PopupClose()
  _Toolbar_ClickAccel($hToolbar, "f")
  _Menu_ClickPopupAccel("c")
EndFunc

; ====================================================================================================



; Set Folder Options
; ====================================================================================================



Func Folders()
  Local $hTree, $hRoot

; Select "Tools"
  _Toolbar_ClickAccel($hToolbar, "t")
; Select "Folder Options"
  _Menu_ClickPopupAccel("o")
  _Lib_WinWaitActive("Folder Options")

; Use Windows classic folders
  ControlClick("Folder Options", "", "Button3")
; Switch to View tab
  ControlCommand("Folder Options", "", "SysTabControl321", "TabRight")
  Sleep(1000)

; Set folder options
  $hTree = ControlGetHandle("Folder Options", "", "SysTreeView321")
  $hRoot = _TreeView_GetFirstNode($hTree)

  _TreeView_SetCheckedByIndex($hTree, $hRoot,  0, False)
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  1, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  2, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  3, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  4, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  5, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  6, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  8, False)
  _TreeView_SetCheckedByIndex($hTree, $hRoot,  9, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 10, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 12, False)
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 13, False)
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 14, False)
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 15, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 16, True )
  _TreeView_SetCheckedByIndex($hTree, $hRoot, 17, False)

; Select "Apply to all folders"
  ControlClick("Folder Options", "", "Button2")
  _Lib_WinWaitActive("Folder views")
; Select "Yes" on dialog
  ControlClick("Folder views", "", "Button1")
  _Lib_WinWaitNotExists("Folder views")

; Close Folder Options dialog
  ControlClick("Folder Options", "", "Button5")
  _Lib_WinWaitNotExists("Folder Options")
EndFunc

; ====================================================================================================



; Set a TreeView node checkbox
; ====================================================================================================



Func SetCheck($hTree, $iIndex, $bCheck)
  _TreeView_SetCheckedByIndex($hTree, 0, $iIndex, $bCheck)
EndFunc

; ====================================================================================================



; Turn on the status bar
; ====================================================================================================



Func StatusBar()
; Select "View" menu
  _Toolbar_ClickAccel($hToolbar, "v")
; Turn on status bar if not already on
;if not _Menu_IsChecked(_Lib_PopupGetHwnd(), 1) then _Menu_ClickPopupAccel("b")
  if not _Menu_GetItemChecked(_Lib_PopupGetHwnd(),1) then _Menu_ClickPopupAccel("b")
  _Lib_PopupClose()
EndFunc

; ====================================================================================================



; Set up the default views
; ====================================================================================================



Func Views()
; Select "View" menu
  _Toolbar_ClickAccel($hToolbar, "v")
; Select "Arrange icons by"
  _Menu_ClickPopupAccel("I")
; Turn off "Show in Groups" if on
;if _Menu_IsChecked(_Lib_PopupGetHwnd(), 6) then _Menu_ClickPopupAccel("G")
  if not _Menu_GetItemChecked(_Lib_PopupGetHwnd(),6) then _Menu_ClickPopupAccel("G")
  _Lib_PopupClose()

; Select "View" menu
  _Toolbar_ClickAccel($hToolbar, "v")
; Select "Arrange icons by"
  _Menu_ClickPopupAccel("I")
; Select "Auto Arrange"
; if not _Menu_IsChecked(_Lib_PopupGetHwnd(), 7) then _Menu_ClickPopupAccel("A")
  if not _Menu_GetItemChecked(_Lib_PopupGetHwnd(),7) then _Menu_ClickPopupAccel("A")
  _Lib_PopupClose()

; Select "View" menu
  _Toolbar_ClickAccel($hToolbar, "v")
; Select "Arrange icons by"
  _Menu_ClickPopupAccel("I")
; Select "Name"
  _Menu_ClickPopupAccel("N")

; Select "View" menu
  _Toolbar_ClickAccel($hToolbar, "v")
; Select "Icon" view style
  _Menu_ClickPopupAccel("n")
EndFunc

Edit

Another bug : seems like it prevents (glitches) any menu access and right clicking contextmenu access.

Edited by JohnBailey
A decision is a powerful thing
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...