AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Explorer Windows Manipulations
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
TRS80



Joined: 12 Dec 2007
Posts: 15

PostPosted: Sun Jan 20, 2008 5:59 pm    Post subject: Reply with quote

Since you are quoting me, majkinetor, I find your remarks unnecessarily insulting. I did read the script and I tried several different solutions, but they didn't work. I spent an hour searching through the documentation, trying to understand what was required to do what I wanted. I am not a programmer and this script is beyond my understanding. So yes, I can read, and did read the script, but the solution was taking far more time than I wanted to invest in using the script. So, I reluctantly asked the question which lexikos answered. Correct me if I have missed the purpose for this list or did I misinterpret your kindness?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2557
Location: Australia, Qld

PostPosted: Mon Jan 21, 2008 2:22 am    Post subject: Reply with quote

majkinetor wrote:
I wouldn't answer to the people that can't even look at the script....
The example uses A_MyDocuments and similar built-in variables. Someone new to AutoHotkey mightn't realise:
  • that A_MyDocuments is a variable
  • that A_MyDocuments is a built-in variable (i.e. has a pre-defined value)
  • where to look to find out what A_MyDocuments contains...
Back to top
View user's profile Send private message
TRS80



Joined: 12 Dec 2007
Posts: 15

PostPosted: Mon Jan 21, 2008 4:46 am    Post subject: Reply with quote

lexikos: Thank you for kindly answering my questions and for pointing me in the right direction. When I first began studying the script, I did some searching on what looked like a function called ShellNavigate and found nothing in the forums or documentation that helped. The, I searched on A_WinDir and didn't find anything helpful. I tried several combinations of A_Drivers or A_M:\Drivers but they went nowhere. I even tried M:\Drivers without the quotes and no joy.

I will read up on A_MyDocuments when I have time because I would like to know more about the workings of AutoHotkey.

I have experimented with the command toggle suggested earlier to get both panels in Windows Explorer to show up, but I haven't figured that out. Given the way the script is written, is the single panel a default behavior or is it intentionally set up that way?

Thanks again for your time and words of wisdom.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2557
Location: Australia, Qld

PostPosted: Mon Jan 21, 2008 6:13 am    Post subject: Reply with quote

Quote:
I have experimented with the command toggle suggested earlier to get both panels in Windows Explorer to show up, but I haven't figured that out.

Which version of Windows are you running? I suspect it is specific to Windows XP.
Quote:
When I first began studying the script, I did some searching on what looked like a function called ShellNavigate and found nothing in the forums or documentation that helped.
ShellNavigate is defined in this script (ExplorerWindowControl.ahk).
Quote:
Given the way the script is written, is the single panel a default behavior or is it intentionally set up that way?
It is likely a default behaviour. I'm not sure of any way to change it with the APIs used by this script.

If you have any requests unrelated to this script (like general help with scripting), please post in the Ask for Help forum.

Edit: It was easier than I expected. ShellNavigate() accepts a parameter "nFlags", which is a bitwise combination of flags (defined at MSDN.) The one you want is SBSP_EXPLOREMODE (0x20).
Code:
ShellNavigate("M:\Drivers", 0x20)

Here is a list of flags, for the curious:
Code:
#define SBSP_DEFBROWSER         0x0000
#define SBSP_SAMEBROWSER        0x0001
#define SBSP_NEWBROWSER         0x0002
#define SBSP_DEFMODE            0x0000
#define SBSP_OPENMODE           0x0010
#define SBSP_EXPLOREMODE        0x0020
#define SBSP_HELPMODE           0x0040
#define SBSP_NOTRANSFERHIST     0x0080
#define SBSP_ABSOLUTE           0x0000
#define SBSP_RELATIVE           0x1000
#define SBSP_PARENT             0x2000
#define SBSP_NAVIGATEBACK       0x4000
#define SBSP_NAVIGATEFORWARD    0x8000
#define SBSP_ALLOW_AUTONAVIGATE   0x00010000

MSDN wrote:
These flags specify whether another window is to be created.

SBSP_DEFBROWSER
Use default behavior, which respects the view option (the user setting to create new windows or to browse in place). In most cases, calling applications should use this flag.
SBSP_SAMEBROWSER
Browse to another folder with the same Windows Explorer window.
SBSP_NEWBROWSER
Creates another window for the specified folder.

The following flags specify the mode. These values are ignored if SBSP_SAMEBROWSER is specified or if SBSP_DEFBROWSER is specified and the user has selected Browse In Place.

SBSP_DEFMODE
Use the current window.
SBSP_OPENMODE
Specifies no folder tree for the new browse window. If the current browser does not match the SBSP_OPENMODE of the browse object call, a new window is opened.
SBSP_EXPLOREMODE
Specifies a folder tree for the new browse window. If the current browser does not match the SBSP_EXPLOREMODE of the browse object call, a new window is opened.
SBSP_HELPMODE
Not supported. Do not use.
SBSP_NOTRANSFERHIST
Do not transfer the browsing history to the new window.

The following flags specify the category of the pidl parameter.

SBSP_ABSOLUTE
An absolute pointer to an item identifier list (PIDL), relative to the desktop.
SBSP_RELATIVE
A relative PIDL, relative to the current folder.
SBSP_PARENT
Browse the parent folder, ignore the PIDL.
SBSP_NAVIGATEBACK
Navigate back, ignore the PIDL.
SBSP_NAVIGATEFORWARD
Navigate forward, ignore the PIDL.

SBSP_ALLOW_AUTONAVIGATE
Enable auto-navigation.
Back to top
View user's profile Send private message
ShellTeam
Guest





PostPosted: Mon Jan 21, 2008 4:49 pm    Post subject: Reply with quote

lexikos wrote:
Code:
ShellNavigate("M:\Drivers", 0x20)

It'll open a new window if not already in the explore mode.

MSDN wrote:
The following flags specify the mode. These values are ignored if SBSP_SAMEBROWSER is specified or if SBSP_DEFBROWSER is specified and the user has selected Browse In Place.
Back to top
TRS80



Joined: 12 Dec 2007
Posts: 15

PostPosted: Mon Jan 21, 2008 7:09 pm    Post subject: Reply with quote

lexikos: Thank you for the additional info. I have printed it out to keep. Yes, I am running Win XP sp2.

If Windows Explorer is not launched and I press the hotkey to jump to M:\Drivers, I always get a single panel display of M:\Drives no matter what. There is no tree panel (on the left side of screen). I have tried the various bitmaps you listed without success. ("M:\Drivers", 0x20), etc.

However, if Windows Explorer running and then I use the hotkey to jump to M:\Drivers, both panels remain open and useable. In this example, I can jump between A_WinDir and M:\Drivers and both panels remain open. If Windows Explorer is not running and I use the hotkey to jump to A_WinDir, there is no tree panel, just the single panel showing the contents of my Windows Directory.

ShellTeam: Given this particular script, ShellNavigate("M:\Drivers") and ShellNavigate("M:\Drivers", 0x20) behave identically. See above.

Thank you both for your help.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2557
Location: Australia, Qld

PostPosted: Tue Jan 22, 2008 1:24 am    Post subject: Reply with quote

ShellTeam wrote:
lexikos wrote:
Code:
ShellNavigate("M:\Drivers", 0x20)

It'll open a new window if not already in the explore mode.

MSDN wrote:
The following flags specify the mode. These values are ignored if SBSP_SAMEBROWSER is specified or if SBSP_DEFBROWSER is specified and the user has selected Browse In Place.
You are correct. However, contrary to that quote, SBSP_EXPLOREMODE is not ignored in either case, at least on Vista. A more appropriate quote would have been:
MSDN wrote:
If the current browser does not match the SBSP_EXPLOREMODE of the browse object call, a new window is opened.
If SBSP_NEWBROWSER must be specified, there would be no need for the above exception, since a new window would be opened every time. This implies that SBSP_EXPLOREMODE may in fact be used with SBSP_SAMEBROWSER or SBSP_DEFBROWSER when the user has selected Browse In Place, despite the previous quote.
ShellTeam? wrote:
ShellTeam: Given this particular script, ShellNavigate("M:\Drivers") and ShellNavigate("M:\Drivers", 0x20) behave identically. See above.
They may not behave consistently, but they certainly do not behave identically. Without 0x20 (assuming Browse In Place is the default setting), an existing window is reused. With 0x20, an existing window is reused if it is in explore mode, otherwise a new window is opened in explore mode. However, as TRS80 noted, if no windows are open, on Vista it seems to open a new window not in explore mode. Confused

If you don't mind opening a new window, this might be an alternative:
Code:
Run, explorer.exe /e`,M:\Drivers
Back to top
View user's profile Send private message
TRS80



Joined: 12 Dec 2007
Posts: 15

PostPosted: Tue Jan 22, 2008 2:53 am    Post subject: Reply with quote

Hello lexikos and ShellTeam:

I finally figured out a way modify the Explorer script so that in XP it will:

(a) launch Explorer so that it shows both panels
(b) it opens to the desired folder in the treeview panel and the contents of that folder are showing in the right panel and
(c) if hotkeys toggle other folders, the program stays within the one instance of Explorer that was launched. (I didn't want several instances of Explorer running.)

This is what I was hoping to accomplish and I've learned something new! Of course, I don't begin to understand everything going on in the script, but thanks for your willingness to help! Here's the code. Yes, very primitive, but it works!

Code:

!d::
if winexist("ahk_class ExploreWClass")
ShellNavigate("M:\Drivers", 0x0020)
else
Run explorer /e`, M:\Drivers
return
Back to top
View user's profile Send private message
ShellTeam
Guest





PostPosted: Tue Jan 22, 2008 11:31 am    Post subject: Reply with quote

TRS80 wrote:
Code:

!d::
if winexist("ahk_class ExploreWClass")
ShellNavigate("M:\Drivers", 0x0020)
else
Run explorer /e`, M:\Drivers
return

Instead, you may simply replace the cmd in ShellNavigate()
Code:
pwb := SHGetIDispatchForFolder(sPath)

with
Code:
Run, explorer.exe /e`,%sPath%
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1336

PostPosted: Tue Feb 05, 2008 5:20 pm    Post subject: Reply with quote

The script is significantly simplified, now all through Dispatch interfaces.
Back to top
View user's profile Send private message
nonov
Guest





PostPosted: Mon Jun 23, 2008 12:56 am    Post subject: Reply with quote

Hi, is it possible to modify ShellFolder() to get from the desktop too?
i've tried by adding (hwnd:=WinExist("ahk_class Progman")) to ShellFolder() but no luck Sad
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1336

PostPosted: Mon Jun 23, 2008 1:58 am    Post subject: Reply with quote

nonov wrote:
Hi, is it possible to modify ShellFolder() to get from the desktop too?

No, ShellFolder() won't work with Progman, unfortunately. AFAIK, there is no exposed interface for it. However, as it's simply a ListView (SysListView32) control, you may utilize it. Or you may use Accessibility Standard Library.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1336

PostPosted: Mon Jun 23, 2008 3:12 am    Post subject: Reply with quote

Here is one method. Need the latest Accessibility Standard Library.
Code:
MsgBox % ShellDesktop()
Return

ShellDesktop()
{
   ControlGet, hWnd, hWnd,, SysListView321, ahk_class Progman
   Acc_Init()
   pacc :=   Acc_AccessibleObjectFromWindow(hWnd)
   If   SubStr(penm:=acc_Selection(pacc),1,1)=" "
      Loop
         If   COM_Enumerate(penm,idChild)<>0
         {
            COM_Release(penm)
            Break
         }
         Else   sSelect.=acc_Name(pacc,idChild) . "`n"
   Else If   penm
      sSelect:=acc_Name(pacc,penm)
   If   idChild:=acc_Focus(pacc)
      sFocus :=acc_Name(pacc,idChild)
   COM_Release(pacc)
   Acc_Term()
   Return   "Focus: " . sFocus . "`n<Selected Items>`n" . sSelect
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group