How to run a script using a simple keyboard shortcut


  1. Posts : 39
    Windows 7 Home Premium 64bit SP1
       #1

    How to run a script using a simple keyboard shortcut


    I have posted this earlier as a followup question Shortcut to hide and unhide folders and files

    It might be best if I start a new thread with this query.

    I've created the script that I asked about there and works just as I want, but is there some way to run this script using a simple keyboard shortcut that I could set up , something like Ctrl+Alt+H

    Have done a Google search and things I have been advised to try just do not work or are very complicated and involve a deep understanding of programming.

    Again , if someone could point me in the right direction would be very pleased.

    SFM
      My Computer


  2. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #2

    Create a regular shortcut for the file first (which has a little arrow on the bottom left of the icon) then on it make Right mouse click - Properties - Shortcut tab - click on the line Shortcut key - Press desired key combination - Apply.

    (Limited to Ctrl+Alt+ one more key)

      My Computer


  3. Posts : 39
    Windows 7 Home Premium 64bit SP1
    Thread Starter
       #3

    Thanks but I already tried that. It looks like you can not run a .vbs script using a keyboard shortcut after creating a shortcut , as in your post:-(

    Nothing happens when you try the keyboard shortcut.

    Obviously keyboard shortcuts work just fine with actual .exe programs , but do not work with a .vbs script. Thanks anyway.
      My Computer


  4. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #4

    sanfranman said:
    Nothing happens when you try the keyboard shortcut.
    That is interesting. I have tried that myself. And it worked with vbs...
    Attached Thumbnails Attached Thumbnails How to run a script using a simple keyboard shortcut-test_vbs.png  
      My Computer


  5. Posts : 39
    Windows 7 Home Premium 64bit SP1
    Thread Starter
       #5

    Thanks, I tried your vbs and all works fine for me too using a keyboard shortcut.

    My problem must be something to do with the script itself. I found it on a website when I asked about how to hide and unhide files and folders in W7 without having to go through the usual process.

    I am not experienced with scripts but that script works fine, just that I can not get it to work with a keyboard shortcut that I put on the shortcut to the script.

    Just for your interest , this is the script in question:

    Hidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"

    SHidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden"

    Set Sh = WScript.CreateObject("WScript.Shell")

    St = Sh.RegRead(Hidden)

    If St = 2 Then

    Sh.RegWrite Hidden, 1, "REG_DWORD"

    Sh.RegWrite SHidden, 1, "REG_DWORD"

    Else

    Sh.RegWrite Hidden, 2, "REG_DWORD"

    Sh.RegWrite SHidden, 0, "REG_DWORD"

    End If

    Sh.SendKeys("{F5}")
      My Computer


  6. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #6

    sanfranman said:
    I can not get it to work with a keyboard shortcut that I put on the shortcut to the script.
    I have copied and pasted your script. And key shortcut of it's shortcut worked for me.
    The only problem I have found is that F5 command at the end of the script does not work, because Explorer window becomes inactive, when script starts.

    I had to manually press F5. Other than that, is all works just fine:
    script alternates settings for hidden folders.
      My Computer


  7. Posts : 39
    Windows 7 Home Premium 64bit SP1
    Thread Starter
       #7

    Thanks for your time in looking into this . Tried exactly what you suggested , no luck. I'm really over it. I'll just click on the script file or shortcut and forget about the key shortcut.
      My Computer


  8. Posts : 149
    Windows 7 Ultimate x64
       #8

    Try "The Wonderful Icon"


    Just in case anyone else comes here, like me, to find ways of utilising keyboard shortcuts...

    Try "The Wonderful Icon" - The Wonderful Icon

    One of its features is that you can "start application" and specify almost any key combination to trigger it.

    I'm using Ctrl+UP and Ctrl+DOWN to launch my "volume" script which alters the system volume according to a logarithmic scale (sound needs to double in volume for the ear to notice the change so the step from 1% to 2% sounds just the same difference as 50% to 100%) and all the volume controls I've come across use linear increments... this make the changes too coarse at low volume levels.

    If you need help configuring The Wonderful Icon to use hotkeys, contact me at steve.j.swift@gmail.com
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:55.
Find Us