vbs sendkeys - got one working - need help with another

Discussion in 'Scripting' started by tnx, Feb 17, 2016.

  1. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,601
    227
    60
    #1 tnx, Feb 17, 2016
    Last edited by a moderator: Apr 20, 2017
    Hi all.

    Messing about with a couple of vbs scripts and adding commands to the context menu.

    I wanted to move "right click, new, new folder" to just "right click, new folder"

    Got this working with a .vbs and a REG edit

    .vbs
    Code:
    Option Explicit
    Dim objShell 
    
    Set objShell = CreateObject("WScript.Shell")
    objShell.SendKeys "^+n" 
    REG Edit
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\New Folder]
    "icon"="MyIcons.dll,19"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\New Folder\command]
    @="WScript C:\\Windows\\CreateNewFolder.vbs"
    
    Added a little pic to show what I was doing

    [​IMG]

    Works a treat. Right click, there is "New Folder" with a little icon and when clicked on it an new folder is created within the open DIR, where ever that may be.

    Looks neat and tidy and works really well.

    What I also want to do but having trouble pinning down is to add "create new text Document" to the Context menu.
    instead of "rightclick,new,new text document" just "right click, new text document"

    But I can not get the keyboard shortcut to work

    SHIFT+F10 w t

    if i right click w t that works fine.

    I thought SHIFT+F10 was the same as right click. Is this right or wrong ?

    What I want to do, pic
    [​IMG]

    Anybody help me out here.

    Anybody see what i am trying to do ?

    ;)

    ohh yes, the .vbs file is placed into C:\Windows. :cool:
     
  2. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,601
    227
    60
    #2 tnx, Feb 17, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Got it....

    Got it !!!!!

    Took me a little while but got there in the end...:g:

    Started with just

    Code:
    "^+{F10}
    and watched what happens.

    then added a "W", then ENTER....Getting nearer..

    Finally got this

    Code:
    Option Explicit
    Dim objShell 
    
    Set objShell = CreateObject("WScript.Shell")
    objShell.SendKeys "^+{F10} W W {ENTER} T"
    Works a treat...

    :clap:
    Just, well just because we can I added New Notepad Document there too.

    [​IMG]