Create Custom Windows Shortcut Key

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Create Custom Windows Shortcut Key

Post by arroway »

I'd like to assigne a Windows shortcut key to a function but don't know how. I'm using a program that does not allow macros so I'm wondering if there's a way of writing a macro and assigning it a short cut key for WinXP (if I'm thinking it out striaght). The macro would be something like:

UCase(Application.UserInitials) " " & Format(Date, "mm-dd-yy")

Which gets the user's initials and addes the date.

What I'm trying to do is create a keyboard shortcut that will add the user initials and date to a form/comment feild. I know that two initials and a date is easy to type but we do this so many times in a day that having a shortcut would be awesome.

I know how to do this in Word but the program we're pasting into is not word. So I'm thinking it might be accomplished via use of a custom WinXP keyboard shortcut but I don't know how to do it.

Anyone?

Thanks,
Dax
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Custom Windows Shortcut Key

Post by HansV »

Perhaps you can use AutoIt:
AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

Thanks for pointing me in that direction. Can you clarify something for me please? Is AutoIt v3 a program that we need to download and run on our machines or is it a scripting language to use in Windows?
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Custom Windows Shortcut Key

Post by HansV »

AutoIt is a third-party utility; you have to download and install it.

If you're not allowed to do that, you might be able to use VBScript, but sometimes that's blocked by network administrators as a potential security risk.
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

The program we're inserting the inits and date into is a web based program. Maybe I can create a custom keyboard shortcut for IE. Would I use AutoIt for something like this?
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Custom Windows Shortcut Key

Post by HansV »

AutoIt is a generic "macro" utility that can be used in any Windows application.

(I don't use it myself, but I know that there are other Loungers who do, so if you have specific questions, they may be able to help you)
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

OK, thanks Hans. I'll try it from home and see if it works for me. I'm also investigating Visual Stuido in order to overwrite some of the IE keyboard shortcuts via add-ons. Not sure if that's a better way to go or not but it's all good for the eduction. ~D.
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Create Custom Windows Shortcut Key

Post by Bigaldoc »

Disclaimer: I am not a programmer !!!

I do however use a free program to emit shortcuts and/or execute programs based on assigned hotkeys. The program is Clavier+.

My non-programming "solution" involves creating two hotkeys, one for the initials and one for the date. In my thoughts, having two hot keys, right next to one another, would only take a milisecond to type. In my test I used:
    • Win-Shift-z to emit the initials, and
      Win-Shift-x to run a short .vbs program
My vbs code:
    • set shell = WScript.CreateObject("WScript.Shell")
      shell.SendKeys Date()
Postscript: I can't figure out how to do both functions with ONE hotkey... :blush:

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Create Custom Windows Shortcut Key

Post by Bigaldoc »

I'm still trying. In Clavier+ I created a shortcut to "emit" text and put in the following code:
    • [A][E][space][space] [[C:\\Temp\\date.vbs]]
The vbs file is at the location on my hard drive. I used my plain text editor to test it and it does emit:
    • a e 9/18/2012
Not satisfied with the spacing between the initials and date, but it's a start. Good luck.

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

Thanks for taking a look at this Big Al. So you're suggesting Clavier. Is that a program that needs to be running on the host computer for the hotkeys to work or is it a program that can help change the behavior of pre-assigned windows keyboard shortcuts? ~Dax
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Create Custom Windows Shortcut Key

Post by Bigaldoc »

Clavier+ must be running on each computer where you need the hotkey capability. But, it's small in footprint and unobtrusive. I've not had the first problem with it ever since I first installed it. You can, of course, have it run at boot, so the user doesn't have to concern himself with activating it.

It certainly isn't a "programming" program per se, but does allow lots of customizing.

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

The company for which I work will not allow us to install programs, so having something running like Clavier+ or WinKey won't work. The best I'm coming up with is to have something like a function/macro on desktop and point a shortcut to it, but I'm 1) not sure if it'll work and 2) not a programmer enough to be able to write it. =/
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Custom Windows Shortcut Key

Post by HansV »

You could create a text file with the following contents:

Code: Select all

with createobject("word.application")
    .documents.add
    .selection.typetext .userinitials & " " & date()
    .selection.wholestory
    .selection.copy
    .quit false
end with
Change the extension of the text file to .vbs to convert it to a VBScript file.
Create a desktop shortcut to the .vbs file and assign a keyboard shortcut to the desktop shortcut in the Shortcut tab of its properties.
Pressing the keyboard shortcut will place your initials plus the date on the Windows clipboard, ready to be pasted (Ctrl+V) into any application that can receive text.
Best wishes,
Hans

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Create Custom Windows Shortcut Key

Post by arroway »

Now THAT's a beautiful thing! EXACTLY what I was looking for! You are a life saver! Thank you! ~Dax
It takes 2 to tango; unless you speak binary; then it takes 10.