AutoHotkey Community

It is currently May 27th, 2012, 10:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: January 20th, 2008, 5:59 pm 
Offline

Joined: December 12th, 2007, 12:12 am
Posts: 17
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2008, 2:22 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2008, 4:46 am 
Offline

Joined: December 12th, 2007, 12:12 am
Posts: 17
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2008, 6:13 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2008, 4:49 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2008, 7:09 pm 
Offline

Joined: December 12th, 2007, 12:12 am
Posts: 17
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2008, 1:24 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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. :?

If you don't mind opening a new window, this might be an alternative:
Code:
Run, explorer.exe /e`,M:\Drivers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2008, 2:53 am 
Offline

Joined: December 12th, 2007, 12:12 am
Posts: 17
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2008, 11:31 am 
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%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2008, 5:20 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
The script is significantly simplified, now all through Dispatch interfaces.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2008, 12:56 am 
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 :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2008, 1:58 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2008, 3:12 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject: COM error on Document
PostPosted: October 16th, 2008, 7:53 pm 
Offline

Joined: August 12th, 2007, 3:32 pm
Posts: 3
Location: Colorado Springs, CO
In trying the Explorer manipulations (to get the current folder) I am getting a COM Error Notification:

Function Name: "Document"
ERROR: No such interface supported (0x80004002)
...


I believe that this comes from this line:

pfv := COM_Invoke(pwb, "Document")

COM_Invoke checks the returned HRESULT and pops up the error window. I see this error especially if I have a Windows Search Results window open.

(I have also had situations where the various methods return null so I have added a lot of null checks in my own code.)

I would like to handle (and ignore) the error myself, but I don't see a way to do this with the provided COM.ahk. Am I missing something? Do I need to add in another variant of this?

_________________
--Todd ( www.cool-man.org )


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 16th, 2008, 11:02 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tg2k wrote:
I see this error especially if I have a Windows Search Results window open.
I completely forgot that Windows has this functionality as I don't use it. Anyway what's your OS? "Document" function worked even with Search in my XPSP3.

Quote:
I would like to handle (and ignore) the error myself, but I don't see a way to do this with the provided COM.ahk. Am I missing something? Do I need to add in another variant of this?
You can suppress the error msgbox by executing COM_Error(False). If you want to handle the error yourself, just make hr (and/or lr) Global in COM_Invoke().


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: specter333, XX0 and 25 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group