Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Adding a button to Windows Explorer standard toolbar?

Reply
 
Old 08-28-2009   #1 (permalink)
Learning VBS


 
 

Adding a button to Windows Explorer standard toolbar?

Is it possible in VBS to add a button in Windows Explorer standard toolbar,
that will create a new folder in the current folder?

I'm trying to speed things up a bit, the right-click context menu or the
file menu is quite slow.

Alternatively, can one call the current path displayed in the windows
explorer address bar from VBS? I could make a script and run it via a
shortcut key.

Thanks!

My System SpecsSystem Spec
Old 08-28-2009   #2 (permalink)
mayayana


 
 

Re: Adding a button to Windows Explorer standard toolbar?

> Is it possible in VBS to add a button in Windows Explorer standard
toolbar,
Quote:

> that will create a new folder in the current folder?
>
No. In pre-XP you can add custom items because
the folder window is actually a webpage. In XP and
later that's no longer true.

People were talking about
adding a button in the shell programming group
recently. The concensus seems to be that it's
theoretically possible because Microsoft has done it,
but that there's no standard API method to do it, and
certainly not a scripting method.
Quote:

> I'm trying to speed things up a bit, the right-click context menu or the
> file menu is quite slow.
>
It shouldn't be. If you're using XP or later, and
response is generally slow, then you may just need
to clean things up. (Cull the unnecessary startup
programs, disable the 5-dozen-odd unnecessary
services that are running, an maybe turn off frivolous
GUI effects like shadows in XP and the Aero
"transparent windows" nonsense in Vista/7.

If the system is generally snappy then you may
just need to clean up your context menu by
removing Registry entries that deal with shell
extensions for that menu.
Quote:

> Alternatively, can one call the current path displayed in the windows
> explorer address bar from VBS? I could make a script and run it via a
> shortcut key.
>
This code will display the path (in URL format)
of all open Explorer and IE windows:

Set SHAp = CreateObject("Shell.Application")
set wins = SHAp.windows
for i = 0 to wins.count - 1
msgbox = wins.item(i).LocationURL
next
set wins = nothing
set SHAp = nothing


My System SpecsSystem Spec
Old 08-29-2009   #3 (permalink)
KuroNeko


 
 

Re: Adding a button to Windows Explorer standard toolbar?

"mayayana" <mayaXXyana@xxxxxx> wrote in
news:OA1i#TFKKHA.4392@xxxxxx:
Quote:
Quote:

>> I'm trying to speed things up a bit, the right-click context menu or
>> the file menu is quite slow.
>>
> It shouldn't be. If you're using XP or later, and
> response is generally slow, then you may just need
> to clean things up. (Cull the unnecessary startup
You misunderstood, R click and move the mouse to the right menu item, or
open the File menu and next the submenu and select 'New Folder' takes
too much time in itself if you need to do it hundreds of times a day. A
button or shortcut key works much faster, and I need to make lots of new
folders all the time.
Quote:
Quote:

>> Alternatively, can one call the current path displayed in the windows
>> explorer address bar from VBS? I could make a script and run it via a
>> shortcut key.
>>
>
> This code will display the path (in URL format)
> of all open Explorer and IE windows:
>
> Set SHAp = CreateObject("Shell.Application")
> set wins = SHAp.windows
> for i = 0 to wins.count - 1
> msgbox = wins.item(i).LocationURL
> next
> set wins = nothing
> set SHAp = nothing
Thanks very much! I'll experiment with this code. I'm very new to
programming and scripting, so this help is really terrific. Ideally,
I'll make a script that makes a new folder in the currently open (and
having the focus) Windows Explorer window, and have the name selected
ready to start typing the folder name. Will take me a while though :-)

Thanks again!






My System SpecsSystem Spec
Old 08-29-2009   #4 (permalink)
Tom Lavedas


 
 

Re: Adding a button to Windows Explorer standard toolbar?

On Aug 29, 4:46*am, KuroNeko <none> wrote:
Quote:

> "mayayana" <mayaXXy...@xxxxxx> wrote innews:OA1i#TFKKHA.4392@xxxxxx:
>
Quote:
Quote:

> >> I'm trying to speed things up a bit, the right-click context menu or
> >> the file menu is quite slow.
>
Quote:

> > * It shouldn't be. If you're using XP or later, and
> > response is generally slow, then you may just need
> > to clean things up. (Cull the unnecessary startup
>
> You misunderstood, R click and move the mouse to the right menu item, or
> open the File menu and next the submenu and select 'New Folder' takes
> too much time in itself if you need to do it hundreds of times a day. A
> button or shortcut key works much faster, and I need to make lots of new
> folders all the time.
>
Quote:
Quote:

> >> Alternatively, can one call the current path displayed in the windows
> >> explorer address bar from VBS? I could make a script and run it via a
> >> shortcut key.
>
Quote:

> > This code will display the path (in URL format)
> > of all open Explorer and IE windows:
>
Quote:

> > Set SHAp = CreateObject("Shell.Application")
> > set wins = SHAp.windows
> > * for i = 0 to wins.count - 1
> > * * *msgbox = wins.item(i).LocationURL
> > * next
> > set wins = nothing
> > set SHAp = nothing
>
> Thanks very much! I'll experiment with this code. I'm very new to
> programming and scripting, so this help is really terrific. Ideally,
> I'll make a script that makes a new folder in the currently open (and
> having the focus) Windows Explorer window, and have the name selected
> ready to start typing the folder name. Will take me a while though :-)
>
> Thanks again!
I'm not exactly certain this is what you are after, but I also find
the Window's way of creating new folders to click-intensive, so I
created the following to add a folder right-click menu item to speed
the process ...

' NewFolder.vbs
'
' Tom Lavedas, 17 Jan 2007
'
sKeyName = "HKEY_CLASSES_ROOT\Folder\shell\NewFolder\"

' Self installation on first execution
' (New folder is NOT created)
'
with createObject("Wscript.Shell")
sScript = wsh.ScriptFullName
sCommandText = "wscript.exe """ & sScript & """ ""%1"""
On Error Resume Next
sValue = .RegRead(sKeyName & "command\")
On Error Goto 0
if sValue = "" then
.RegWrite sKeyName , "&New Folder", "REG_SZ"
.RegWrite sKeyName & "command\", sCommandText, "REG_SZ"
wsh.echo "Registration of NewFolder is complete"
wsh.quit 0
end if
end with ' WShell

if WSH.Arguments.Count > 0 Then
' Build folder name with today's date
'
sShowTree = left(WSH.Arguments.Item(0), 3)
n = 2
for each level in Split(Mid(WSH.Arguments.Item(0), 4), "\")
sShowTree = sShowTree & vbNewLine & space(n) & "-" & level
n = n + 2
next
sNameList = InputBox(sShowTree & vbNewline & vbNewline _
& "New Folder Name(s)" & vbNewline _
& "[use a colon to separate multiple names]", "New Folder")

' Create the new folder's pathspec
'
if sNameList <> "" Then
with createobject("scripting.filesystemobject")
For each sName in Split(sNameList, ":")
sPath = WSH.Arguments.Item(0)
for each sSubName in Split(sName, "\")
spath = sPath & "\" & sSubName
' Create the new folder at indicated location
'
if Not .FolderExists(sPath) Then .CreateFolder(sPath)
next
next
end with ' FSO
' Optional - opens the last new folder in explorer window
' createobject("WScript.Shell").Run "explorer.exe " & sPath
end if
else
wsh.echo "Unexpected error condition - no input argument", _
vbNewline, "Nothing was done."
wsh.quit 1
End if

The first time it is run, it installs a registry item, such that right-
clicking any folder presents a 'Newfolder' entry that supports
creation of multiple subfolders at one time under the selected folder
(names separated by colons). Multiple levels of subfolders are
automatically created when delimited by the normal back slash
(sublevel1\sublevel2\etc).

HTH,

Tom Lavedas
My System SpecsSystem Spec
Old 08-30-2009   #5 (permalink)
mr_unreliable


 
 

Re: Adding a button to Windows Explorer standard toolbar?

Learning VBS wrote:
Quote:

> Is it possible in VBS to add a button in Windows Explorer standard toolbar,
> that will create a new folder in the current folder?
>
hi Learning,

Other than changing the registry to add a context menu item,
I would say (in general) the answer for _scripting_ is that
it's not possible.

However, you can do this with other languages, most likely
one that allows for calling the system api's, and more
likely (if you wish to use the example code) then c++
or c#.

First, look for code and/or tutorials dealing with
"windows explorer" and "shell extensions". You will turn
up plenty of material from google and msdn. You might
also be able to find a copy of the book entitled: "Visual
Basic Shell Programming", by J.P. Hamilton, and published
by O'Reilly, which is basically all about shell extensions.
Yes, it can be done with vb, but it gets more tricky
dealing with the system shell interfaces in vb than with
the various flavors of "c".

Secondly, look up code and/or tutorials on "Browser
Helper Objects". Yes, yes, I know that BHO's are
normally mentioned in the IE context, but they apply
to windows explorer too. For example, my internet
service provider is att+yahoo!. The "Yahoo Companion"
BHO was gratuitously installed on my system, and can
be optionally added to both the IE and the windows
explorer toolbars. I am a fan of Dino Esposito's
"Cutting Edge" column which appeared in MSDN Magazine.
I recommend his "Browser Helper Objects: The Browser
the Way You Want It", found here:

http://msdn.microsoft.com/en-us/library/ms976373.aspx

Dino asserts that his BHO's apply equally well to IE
and WE, but spends most of his discussion directed at
IE.

Thirdly, you could write your own "windows explorer".
That would be easier than you think, and in fact there
is plenty of (vb) code examples, and probably code
available in other languages as well. All you need is
to add another button and/or menu item, plus a click
handler to do what you want. For an example of a
home-brew "windows explorer" app in vb, look up
Bard Martinez' VBExplorer, with source code,
found here:

http://btmtz.mvps.org/vbexplorer/

Fourthly, there is always the "Brute Force" way,
although in this case I wouldn't recommend it. What
you see at the top of the windows explorer window is
something called a "rebar" control, which serves as a
container for the toolbar controls. You may add or
subtract buttons from one of the toolbars by sending
system messages to the toolbar. Then you have to subclass
the parent window, to pick up the toolbar's "button click"
messages, and then write code to handle the user click
on the button you just added. This can get messy, unless
you know what you're doing.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)
My System SpecsSystem Spec
Old 08-31-2009   #6 (permalink)
KuroNeko


 
 

Re: Adding a button to Windows Explorer standard toolbar?

Hi Mr Unreliable

thanks very much for all that advice. It's been extremely hectic at work or
I'd be all over this already. I'm going to read up on this carefully and
try to find the book you advised!

Thanks again
My System SpecsSystem Spec
Old 08-31-2009   #7 (permalink)
mayayana


 
 

Re: Adding a button to Windows Explorer standard toolbar?


Quote:

>
> thanks very much for all that advice. It's been extremely hectic at work
or
Quote:

> I'd be all over this already. I'm going to read up on this carefully and
> try to find the book you advised!
>
I have that book. I've used its guidance to
write BHOs, a Browser Extension, and an
Explorer Bar. You can also create toolbars.
But all of this is way beyond script. And as
far as I know there's no method to put a button
on Explorer's toolbar. You can put a button
on the IE toolbar with a Browser Extension
(a BHO alone doesn't do it), but it doesn't show
up on Explorer. (I think you can even put a button
on the IE toolbar with script if you set the right
Registry settings. But then you don't
have a process that's linked into IE and it's
document, so I don't know how useful that is.)

You can add a toolbar or Explorer Bar and put a
button on that. (But again, that's very involved
and way beyond the scope of script.) If you really
think you're going to go through with the button
plan then see the recent postings in
microsoft.public.platformsdk.shell

There have been at least 2 threads recently
about adding a button to Explorer.

Then again, wasn't the original idea to save a
fraction of a second when you make a new folder?
I don't know exactly what you're doing, but it sounds
like a script to automate folder creation might be
more realistic than rebuilding the Windows GUI, for
what you want to accomplish.


My System SpecsSystem Spec
Old 09-01-2009   #8 (permalink)
Tim Williams


 
 

Re: Adding a button to Windows Explorer standard toolbar?

How about [mis]using "SendTo", and have that trigger the script from a
right-click on the parent folder ?
All you need to do is drop the script in

C:\Documents and Settings\username\SendTo

Tim

"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:e7DMHamKKHA.4432@xxxxxx
Quote:

>
>
Quote:

>>
>> thanks very much for all that advice. It's been extremely hectic at work
> or
Quote:

>> I'd be all over this already. I'm going to read up on this carefully and
>> try to find the book you advised!
>>
>
> I have that book. I've used its guidance to
> write BHOs, a Browser Extension, and an
> Explorer Bar. You can also create toolbars.
> But all of this is way beyond script. And as
> far as I know there's no method to put a button
> on Explorer's toolbar. You can put a button
> on the IE toolbar with a Browser Extension
> (a BHO alone doesn't do it), but it doesn't show
> up on Explorer. (I think you can even put a button
> on the IE toolbar with script if you set the right
> Registry settings. But then you don't
> have a process that's linked into IE and it's
> document, so I don't know how useful that is.)
>
> You can add a toolbar or Explorer Bar and put a
> button on that. (But again, that's very involved
> and way beyond the scope of script.) If you really
> think you're going to go through with the button
> plan then see the recent postings in
> microsoft.public.platformsdk.shell
>
> There have been at least 2 threads recently
> about adding a button to Explorer.
>
> Then again, wasn't the original idea to save a
> fraction of a second when you make a new folder?
> I don't know exactly what you're doing, but it sounds
> like a script to automate folder creation might be
> more realistic than rebuilding the Windows GUI, for
> what you want to accomplish.
>
>

My System SpecsSystem Spec
Old 09-01-2009   #9 (permalink)
mr_unreliable


 
 

Re: Adding a button to Windows Explorer standard toolbar?

Learning VBS wrote:
Quote:

> Is it possible in VBS to add a button in Windows Explorer standard toolbar,
> that will create a new folder in the current folder?
>
> I'm trying to speed things up a bit, the right-click context menu or the
> file menu is quite slow.
>
hi Learning,

Here is something for your consideration, and
it doesn't require any programming...

When you open the folder (with windows explorer)
that you wish to add a new folder to, then
press the "alt key", keep it down, and type in
"fnf". Then release the alt key. That's it.
If you are good at typing, or if you practice
this a bit, then that should go much faster
than rt-clicking, selecting "new", then
selecting "folder".

What is that alt-fnf all about? You are just
selecting menu items -- from the main menu.
Alt-f gets you "File", then alt-n gets you "New",
and alt-f gets you "Folder". But you don't have
to do those one-at-a-time. Alt-fnf will do it.

People are so mouse-happy these days that they
sometimes tend to forget that one can run the
system (mostly) from the keyboard. (Spoken
like an old-timer, eh?). In this case, imho
the keyboard approach is (much) faster...

cheers, jw
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Standard Toolbar in Vista Business Edition Vista General
Adding buttons to the Explorer Toolbar Vista General
windows explorer standard toolbar missing the UP button Vista file management
Adding a toolbar to the windows taskbar PowerShell
I want to add a DELETE button on the windows explorer toolbar Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46