Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to run a script using a simple keyboard shortcut

12 Apr 2011   #1
sanfranman

Windows 7 Home Premium 64bit SP1
 
 
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 System SpecsSystem Spec
.
12 Apr 2011   #2
Neutron16

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

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 System SpecsSystem Spec
12 Apr 2011   #3
sanfranman

Windows 7 Home Premium 64bit SP1
 
 

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 System SpecsSystem Spec
.

12 Apr 2011   #4
Neutron16

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

Quote   Quote: Originally Posted by sanfranman View Post
Nothing happens when you try the keyboard shortcut.
That is interesting. I have tried that myself. And it worked with vbs...


Attached Thumbnails
How to run a script using a simple keyboard shortcut-test_vbs.png  
My System SpecsSystem Spec
12 Apr 2011   #5
sanfranman

Windows 7 Home Premium 64bit SP1
 
 

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 System SpecsSystem Spec
13 Apr 2011   #6
Neutron16

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

Quote   Quote: Originally Posted by sanfranman View Post
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 System SpecsSystem Spec
14 Apr 2011   #7
sanfranman

Windows 7 Home Premium 64bit SP1
 
 

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 System SpecsSystem Spec
09 Sep 2015   #8
swiftie

Windows 7 Ultimate x64
 
 
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 System SpecsSystem Spec
Reply

 How to run a script using a simple keyboard shortcut




Thread Tools




Similar help and support threads
Thread Forum
Simple shortcut question, changing drive letter?
I use a flash drive to install certain things on multiple computers. What do I put in the shortcut info so that it automaticly will default to whatever drive letter that flash drive has at the moment? I would have googled but I couldnt figure out how to word it.
General Discussion
Setting Default Communications Device using a shortcut or script?
I bought myself a Logitech G930 wireless headset and it works great. Only problem is that when I want to use it I have to Control Panel > Sound > and 'Set as Default Device' When I want to use my main speakers again I have to do the whole process again. Could I somehow make a shortcut, or a...
Hardware & Devices
Keyboard Shortcut?
I'd like to assign a keystroke to one of my mouse buttons that will launch Windows Explorer. The Windows key + E launches computer in Windows Explorer which would be fine. However, Logitech SetPoint Settings wont let me map the Windows key. Another option was to create a shortcut of...
Customization
Creating a Show Desktop Script for keyboard Hotkey.
Hello (firstly i wasnt too sure where to put this post, so if a moderators reading this - feel free to move it.) Okay so ive just got a Logitech Cordless Desktop EX110, and the keyboard (like most moderately priced keyboards) has numerous 'hot-keys' (like music controls, email button,...
General Discussion
Keyboard Shortcut(s)
1) Is there a W7 shortcut that will select a sentence or a full line? 2) Is there a GOOD keyboard shortcut quick reference sheet anyone has found? I have done several searches on the two above, and I feel like those people in the commercial that run a search and start spouting off tangent...
General Discussion
Simple Script: Control WMP while minimized
I listen to music on Windows Media Player while I play some full screen games. I usually have to kill fullscreen (extreme killer on system performance), open WMP (still being bottlenecked by game), change the song, and somehow manage back into fullscreen, about 5 minutes later. So, I made this....
Software


Our Sites

Site Links

About Us

Find 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 20:05.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App