Search the Community
Showing results for tags 'windows explorer'.
-
I have a problem trying to use _IEAttach to recover control after a Windows Explorer reset (e.g. on Windows 7), since all the InternetExplorer.Application objects appear to be destroyed by this event. An example of this is when a PC has some kind of fault causing a pop-up error message "Windows Explorer has stopped working". I can simulate this event by using Windows Task Manager to end the Explorer.exe process then to file, new task (run...) Explorer.exe After this event, _IEAttach gives an @error of: 7 ($_IEStatus_NoMatch) - No Match However, using WinList() followed by WinGetText() I can recover the URL for an IE session that has lost its InternetExplorer.Application object which could be used to _IECreate a new session (the $iTryAttach fails) and WinKill() the original session but the result is a if a refresh had been done (any form entries are lost) . Unfortunately form entries do not appear as text or hidden text to Windows so I'm looking for the best way to read the contents of an Internet Explorer screen (even if just text without structure). When there is no InternetExplorer.Application object (because of some Windows fault) but still with an Internet Explorer session running, I tried to read its contents by a "Select All" & "Copy to Clipboard" but its form entries are blanked and combo boxes choices are all displayed with no way of finding out which ones were selected. Local $ClipBoardSave = _ClipBoard_GetData() ;not ClipGet() which is text only ClipPut("") ;Clear User's Clipboard Local $sText = "" Local $hWnd = WinActivate("Window Title", "") If IsHWnd($hWnd) Then Local $bStatusCtrlSend = ControlSend("Window Title", "", "", "^a^c") If $bStatusCtrlSend Then Local $bStatusCtrlClick = ControlClick("Window Title", "", "") If $bStatusCtrlClick Then $sText = ClipGet() _ClipBoard_SetData($ClipBoardSave) ;not ClipPut($ClipBoardSave) which is text only Is there a solution to this please?
-
Windows 7 I've had a chance to test the script on Windows 7. To be able to browse system folders e.g. the Control Panel on Windows 7 you have to run the script, EnumDesktopGUI.au3, in the proper way. If you are using Windows 7 64 bit you have to run the script as a 64 bit program to be able to browse the system folders. On Windows XP the generel look and appearance of the GUI is OK. There are problems on Windows 7: The menu bar doesn't look good. Disabled icons are looking very bad. The drop down menu of some of the buttons can erase parts of other controls. The grouping in the ListView of the items in Computer folder is looking very clumsy and the items seems to be mixed up in some way. Also for the Control Panel some items are mixed up and some items appears both as folders and files. I will try to find a solution to these issues. Update #2: 2012-08-20 See first post dated 2012-04-19 below. zip-files are attached to the bottom of the post. Severe error Fixed an error which could lead to a crash immediately before GUI was closed down. Data for the TreeView was deleted and memory freed while the TreeView still had focus. Sorting _GUICtrlListView_RegisterSortCallBack() and related functions are used for sorting. The functions are modified to group files and folders, and to properly sort by size, by type and by time. The functions are provided in the file SortListView.au3. It can be time consuming to sort a large number of files and folders. To prevent using time on both updating and sorting the ListView when a new folder is selected in the TreeView, the sorting mechanism is reset to default when a new folder is selected. The default sorting is the order of files and folders as provided in the "While $IEnumIDList.Next() ... WEnd" loops. Virtual folders It can be a lengthy process to expand a large number of subfolders in the TreeView. To avoid this multiple subfolders can be grouped into a number of virtual folders with a specific number of subfolders in each virtual folder. The virtual folders are only created in the TreeView and ListView. Not on the disk. Virtual folders will be used when the number of subfolders exceeds 300. The number of subfolders in each virtual folder is set to 100. These limits can be changed in the options. And the functionality can be disabled completely. This is testet in a folder with 4000 subfolders and 100 pictures in each subfolder. Expanding the subfolders is much much faster when using virtual folders. In this example there will be created 40 virtual folders named "1 - 100", "101 - 200", ..., "3901 - 4000". Each virtual folder will contain 100 subfolders. But the 100 subfolders will not be expanded until you click a virtual folder. That means that in stead of creating 4000 subfolders at one time (which is extremely time consuming) there will be created 40 virtual folders, and when you click a virtual folder there will be created 100 subfolders at a time. Other updates Right click menu in TreeView: Refresh Added a SplitterBar control between the TreeView and ListView Added grouping information to the ListView for My Computer folder If an icon file EnumDesktopGUI.ico exists, this icon will be used for the GUI Option to save GUI position and size on exit Option to set TreeView startup folder More info to the Details View Fixed some minor issues Update #1: 2012-04-25 In post #3 wraithdu pointed out that the built-in function ObjCreateInterface could be used in stead of AutoItObject. An advantage in using ObjCreateInterface is that according to the helpfile you can use a struct as a parameter in the description string for the methods of the interface. It works in this example. No need for a lot of calls to DllStructGetPtr(). With ObjCreateInterface enumeration of a folder looks like this: ; The address that receives an IShellFolder Interface pointer $pParentFolder = GetParentFolder( ... ) ; Create an IDispatch-Object for the IShellFolder Interface $IShellFolder = ObjCreateInterface( $pParentFolder, $sIID_IShellFolder, $dtagIShellFolder ) ; $pIEnumIDList is the address that receives an IEnumIDList interface pointer of the enumeration object If $IShellFolder.EnumObjects( $NULL, BitOR( $SHCONTF_FOLDERS, $SHCONTF_INCLUDEHIDDEN ), $pIEnumIDList ) = $S_OK Then ; Create an IDispatch-Object for the IEnumIDList Interface $IEnumIDList = ObjCreateInterface( $pIEnumIDList, $sIID_IEnumIDList, $dtagIEnumIDList ) ; Enumerate the folders ; Param 1 [in] : Step value as in a For-loop While $IEnumIDList.Next( 1, $pidlRel, $iFetched ) = $S_OK ; Param 2 [out]: PIDL relative to parent folder $iFolders += 1 ; Param 3 [out]: 0 if no more PIDLs, 1 else ... ... ... WEnd EndIf The zipfile below is updated with new au3-files (the 3 EnumDesktop-files) that uses ObjCreateInterface. This version is not depending on AutoItObject and AutoItObject.au3 is not included. In this example ObjCreateInterface seems to be working flawlessly. 2012-04-19 I've been looking at AutoItObject for some time. I've got inspiration for this example from a similar C++ example and from this thread http://www.autoitscript.com/forum/index.php?showtopic=123365. The GUI in the example is a Windows Explorer Viewer with a TreeView and a ListView. The root of the TreeView is the Desktop. You can browse the Desktop by expanding the folders in the TreeView. Select a folder to show the subfolders and files in the ListView. Right click on an item in the ListView to get file properties. Right click in the free area of the ListView to print a list of item names. Double click or press Enter on an item in the ListView to open a file or execute a program. With AutoItObject a folder doesn't have to be a file system folder. It can be any folder in the Desktop e.g. the Control Panel. The Desktop in this case means the root of the Shell's namespace. To enumerate a folder using AutoItObject you use code like this: ; The address that receives an IShellFolder Interface pointer $pParentFolder = GetParentFolder( ... ) ; Create an IDispatch-Object for the IShellFolder Interface $IShellFolder = _AutoItObject_WrapperCreate( $pParentFolder, $dtagIShellFolder ) ; The address that receives an IEnumIDList interface pointer of the enumeration object $aRet = $IShellFolder.EnumObjects( $NULL, BitOR( $SHCONTF_FOLDERS, $SHCONTF_INCLUDEHIDDEN ), 0 ) If $aRet[0] = $S_OK Then $pIEnumIDList = $aRet[3] ; Create an IDispatch-Object for the IEnumIDList Interface $IEnumIDList = _AutoItObject_WrapperCreate( $pIEnumIDList, $dtagIEnumIDList ) ; Enumerate the folders $aRet = $IEnumIDList.Next( 1, 0, 0 ) ; Param 1 [in] : Step value as in a For-loop While $aRet[3] ; Param 2 [out]: PIDL relative to parent folder $iFolders += 1 ; Param 3 [out]: 0 if no more PIDLs, 1 else ... ... ... $aRet = $IEnumIDList.Next( 1, 0, 0 ) WEnd EndIf Enumeration of a folder in this way uses PIDLs (pointers to ITEMIDLIST structures) in stead of file and folder names. See http://msdn.microsoft.com/en-us/library/windows/desktop/cc144090(v=vs.85).aspx. The zipfile below contains a number of files: EnumDesktopConsts.au3 - definitions and declarationsEnumDesktopFuncs.au3 - functions for the enumerationsEnumDesktopGUI.au3 - the GUI, run this fileFunctions.au3 - different functionsGetIcon.au3 - icon functionsWindows.au3 - child windows for options and infoStringSize.au3 - by Melba23, see http://www.autoitscript.com/forum/index.php?showtopic=114034HourglassOff.au3 - turn hourglass off, see belowres\ - 4 icons and WSP.dll by Yashied, see http://www.autoitscript.com/forum/index.php?showtopic=83621 post #16WSP.dll is used for NM_RETURN notifications in the ListView. The central file in the example is EnumDesktopFuncs.au3. The most important functions in the file are GetParentFolder() - returns an IShellFolder Interface pointer to the parent folderEnumTreeViewObjects() - expands the folders of the parent folder in the TreeViewEnumListViewObjects() - shows the folders and files in the ListView for the parent folderInvokeCommand() - opens a file or runs a program when an item in the ListView is activatedYou need AutoItObject by the AutoItObject team and APIConstants.au3 and WinAPIEx.au3 version 3.6 or 3.7 by Yashied. If the script fails for some reason and you are left with an hourglass cursor, then run HourglassOff.au3 to get the normal cursor back. Run EnumDesktopGUI.au3 in the zipfile. Testet on XP SP3. The zip-files can be opened with 7-Zip. 2012-04-19: Implemented with AutoItObject EnumDesktop.zip Update #2 2012-08-20: Implemented with ObjCreateInterface() (no need for AutoItObject, not included) EnumDesktop.zip EnumDesktop.zip