[Solved]Script working on: 7,8.1 early versions of 10 but not on version_1703_updated_june_2017

Discussion in 'Scripting' started by tnx, Jul 26, 2017.

  1. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    234
    60
    Well I have an annoying little problem. For a good while now I have been using a couple of scripts + REG edits, which add "Create a new Folder" and "Create a new Text doc". These are on the context menu and work really will on Win 7, Win 8.1 and early version of 10.
    The REG edits just add a link between the Context menu ( nice little icons ) and to C:\Windows where the .vbs files live.

    Create a new Folder
    Code:
    Option Explicit
    Dim objShell
    
    Set objShell = CreateObject("WScript.Shell")
    objShell.SendKeys "^+n"
    this works well on all Windows.

    Create a new Text Doc
    Code:
    Option Explicit
    Dim objShell
    
    Set objShell = CreateObject("WScript.Shell")
    objShell.SendKeys "^+{F10} W W {ENTER} T"
    Whats bugging me is why will it not work on the latest Windows 10
    Should I be doing summet different ?

    Any clever guys help me out ?
     
  2. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    234
    60
    Well sorted it...Took me a little while but hey I don't confess on being a scripter..

    new .vbs file looks like this
    Code:
    Set WshShell = CreateObject("WScript.Shell")
    
    WshShell.SendKeys "(+{F10})"
    WshShell.SendKeys "W"
    WshShell.SendKeys "T"
    
    My Context Menu handler points to this and hey presto, order is restored.
     
  3. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    234
    60
    Just because it's good practice I added
    so it looks like this

    Code:
    Option Explicit
    Dim WshShell
    
    Set WshShell = CreateObject("WScript.Shell")
    
    WshShell.SendKeys "(+{F10})"
    WshShell.SendKeys "W"
    WshShell.SendKeys "T"
    cheers
     
  4. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    234
    60
    So while I was at it I updated my "Make A New Folder" vbscript too

    Code:
    Option Explicit
    Dim WshShell
    
    Set WshShell = CreateObject("WScript.Shell")
    
    WshShell.SendKeys "(+{F10})"
    WshShell.SendKeys "W"
    WshShell.SendKeys "F"
    I like things to look similar.
    :cool: