How do I assign a "F" key?

  • Thread starter Thread starter D.
  • Start date Start date
D

D.

I asked 3 days ago how do I assign a key on the keyboard & got 0
responses.

So now I am being a little more definite - how do I assign a function
key (F key, like F8)? What I want to do is assign the "&" character.
I am ALWAYS not pressing the shift key in time to get that character,
& I use that character a lot.

....D.
 
I suppose Shift + Function doesn't help. You can swap keys about but I don't think you can do part of a key.

You could go into accesability and turn on sticky keys. Press and release Shift then press 7 to get &.

One is to get Windows Recorder supplied with Windows 3.1, the other is to write a script.

You can write a program


set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}^c%{TAB}^v"

[above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]

Then set a shortcut to the scripts and set a hotkey for the shortcut (see help). The shortcut must be on the desktop or the startmenu for hotkeys to be recognised.


Windows Script Host

SendKeys Method
See Also
WshShell Object | Run Method

Sends one or more keystrokes to the active window (as if typed on the keyboard).

object.SendKeys(string)
Arguments
object
WshShell object.
string
String value indicating the keystroke(s) you want to send.
Remarks
Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard character, send the character itself as the string argument. For example, to send the letter x, send the string argument "x".

Note To send a space, send the string " ".
You can use SendKeys to send more than one keystroke at a time. To do this, create a compound string argument that represents a sequence of keystrokes by appending each keystroke in the sequence to the one before it. For example, to send the keystrokes a, b, and c, you would send the string argument "abc". The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:

a.. plus sign "+",
b.. caret "^",
c.. percent sign "%",
d.. and tilde "~"
Send these characters by enclosing them within braces "{}". For example, to send the plus sign, send the string argument "{+}". Brackets "[ ]" have no special meaning when used with SendKeys, but you must enclose them within braces to accommodate applications that do give them a special meaning (for dynamic data exchange (DDE) for example).

a.. To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one.
b.. To send brace characters, send the string argument "{{}" for the left brace and "{}}" for the right one.
Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, send the arguments shown in the following table:

Key Argument
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT, create a compound string argument that represents the keystroke combination. You do this by preceding the regular keystroke with one or more of the following special characters:

Key Special Character
SHIFT +
CTRL ^
ALT %

Note When used this way, these special characters are not enclosed within a set of braces.
To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

a.. e and c are pressed, send the string argument "+(ec)".
b.. e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".
You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter "x" ten times, you would send the string argument "{x 10}". Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send "x" ten times, but you cannot do the same for "Ctrl+x".
Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
Example
The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). Each job runs the Windows calculator and sends it keystrokes to execute a simple calculation.

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"
WScript.Sleep 500
WshShell.SendKeys "2"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 500
WshShell.SendKeys "*3"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 2500
</script>
</job>

<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("calc");
WScript.Sleep(100);
WshShell.AppActivate("Calculator");
WScript.Sleep(100);
WshShell.SendKeys ("1{+}");
WScript.Sleep(500);
WshShell.SendKeys("2");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(500);
WshShell.SendKeys("*3");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(2500);
</script>
</job>
</package>
See Also
WshShell Object | Run Method
 
First - I am not a newbie. I am knowledgeable with several aspects of
Windows XP, & the Internet, Usenet, etc.

& thanks for the reply. No one else replied. & you took a lot of
time to do it too. But I have a problem. I tried a couple of basic
suggestions of yours. This stuff is completely new to me & over my
head.

I wouldn't mind swapping. If I could press the "7" key and get the
"&" character, that'd be fine. But I don't think you suggested that,
did you (???)

I don't know what you mean by "Shift + Function". I know I have
function keys F1 through F12, but pressing shift plus any of the
function keys does nothing. So you must mean something else. (I have
a 101 keyboard).

I went & turned on the acceptability keys. I turned on sticky keys.
But then, what do I do - you suggest pressing shift and releasing then
pressing 7. But I tried it. There is no special subtitle in that
window that tells me I can now do something like shift + 7 to get "&".

So I tried it again. & I went to XP help & tried other keyboard
things. What I now have after all of that is my Windows Start bar
being twice as tall, & the tray icons are now twice as big, and the
clock now displays the time plus what day of the week it is. The only
saving grace in all of this is that I like it. I am going to leave it
alone.

But still I have the problem of not being able to get the "&"
character with one single key press - any key I can use, or swap the
7, or whatever. If I have to write a program, please tell me - do I
use notepad? & what name do I save it as.. How do I turn it on or
enter it into what? Or do I enter it in start\run?

And I don't know how to access hotkeys. My search tells me I have a
file called zhotkey.exe in C:\windows & has been turned on.

....D.

-------------------
I suppose Shift + Function doesn't help. You can swap keys about but I don't think you can do part of a key.

You could go into accesability and turn on sticky keys. Press and release Shift then press 7 to get &.

One is to get Windows Recorder supplied with Windows 3.1, the other is to write a script.

You can write a program


set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}^c%{TAB}^v"

[above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]

Then set a shortcut to the scripts and set a hotkey for the shortcut (see help). The shortcut must be on the desktop or the startmenu for hotkeys to be recognised.


Windows Script Host

SendKeys Method
See Also
WshShell Object | Run Method

Sends one or more keystrokes to the active window (as if typed on the keyboard).

object.SendKeys(string)
Arguments
object
WshShell object.
string
String value indicating the keystroke(s) you want to send.
Remarks
Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard character, send the character itself as the string argument. For example, to send the letter x, send the string argument "x".

Note To send a space, send the string " ".
You can use SendKeys to send more than one keystroke at a time. To do this, create a compound string argument that represents a sequence of keystrokes by appending each keystroke in the sequence to the one before it. For example, to send the keystrokes a, b, and c, you would send the string argument "abc". The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:

a.. plus sign "+",
b.. caret "^",
c.. percent sign "%",
d.. and tilde "~"
Send these characters by enclosing them within braces "{}". For example, to send the plus sign, send the string argument "{+}". Brackets "[ ]" have no special meaning when used with SendKeys, but you must enclose them within braces to accommodate applications that do give them a special meaning (for dynamic data exchange (DDE) for example).

a.. To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one.
b.. To send brace characters, send the string argument "{{}" for the left brace and "{}}" for the right one.
Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, send the arguments shown in the following table:

Key Argument
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT, create a compound string argument that represents the keystroke combination. You do this by preceding the regular keystroke with one or more of the following special characters:

Key Special Character
SHIFT +
CTRL ^
ALT %

Note When used this way, these special characters are not enclosed within a set of braces.
To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

a.. e and c are pressed, send the string argument "+(ec)".
b.. e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".
You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter "x" ten times, you would send the string argument "{x 10}". Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send "x" ten times, but you cannot do the same for "Ctrl+x".
Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
Example
The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). Each job runs the Windows calculator and sends it keystrokes to execute a simple calculation.

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"
WScript.Sleep 500
WshShell.SendKeys "2"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 500
WshShell.SendKeys "*3"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 2500
</script>
</job>

<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("calc");
WScript.Sleep(100);
WshShell.AppActivate("Calculator");
WScript.Sleep(100);
WshShell.SendKeys ("1{+}");
WScript.Sleep(500);
WshShell.SendKeys("2");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(500);
WshShell.SendKeys("*3");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(2500);
</script>
</job>
</package>
See Also
WshShell Object | Run Method
 
I don't know what zhotkey is, possibly something from E-Machines in Japan.

Accessibility is in Control Panel, not the stupid wizard you ran. Run the stupid wizard again and undo everything. Then look at sticky keys in Accessability in Control Panel.

If you assign 7 to F7 you'll have to press Shift + F7 to get ampersand. You can only assign whole keys.

Create a text file and name it something.vbs, copy in

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "&"

Create a shortcut to this file, it must be on desktop or start menu or the key is not used.

-------------------------------------------------------------------
This is from help by typing shortcut key in search.
--------------------------------------------------------------------

To specify shortcut keys for specific programs
Before beginning this procedure, please refer to the documentation that came with the program to verify a shortcut was installed.

1.. Open My Computer.
2.. Locate the program file (.exe) or the program's shortcut icon. Right-click the program file or shortcut, and then click Properties.
3.. Click the Program tab for an MS-DOS program or the Shortcut tab for a Windows program.
4.. With the cursor in the Shortcut key box, select the keyboard key you want to use in combination with CTRL+ALT. Shortcut keys automatically start with CTRL+ALT. The Shortcut key box will display None until you select the key and then the box will display Ctrl+Alt+the key you selected. You cannot use the ESC, ENTER, TAB, SPACEBAR, PRINT SCREEN, SHIFT, or BACKSPACE keys.
Notes

a.. To open My Computer, click Start, and then click My Computer.
b.. Once you assign a shortcut key combination for a specific program, you will not be able to use that key combination with other programs. For a list of shortcut keys used by this version of Windows, click Related Topics.
c.. If you forget the key combination for your shortcut, you can follow steps 2 through 3 and review your shortcut keys.
d.. Using shortcut keys to open programs can often be simpler than opening programs using a pointing device, especially when working on portable computers.


--
----------------------------------------------------------
http://www.counterpunch.org/bageant06132004.html
D. said:
First - I am not a newbie. I am knowledgeable with several aspects of
Windows XP, & the Internet, Usenet, etc.

& thanks for the reply. No one else replied. & you took a lot of
time to do it too. But I have a problem. I tried a couple of basic
suggestions of yours. This stuff is completely new to me & over my
head.

I wouldn't mind swapping. If I could press the "7" key and get the
"&" character, that'd be fine. But I don't think you suggested that,
did you (???)

I don't know what you mean by "Shift + Function". I know I have
function keys F1 through F12, but pressing shift plus any of the
function keys does nothing. So you must mean something else. (I have
a 101 keyboard).

I went & turned on the acceptability keys. I turned on sticky keys.
But then, what do I do - you suggest pressing shift and releasing then
pressing 7. But I tried it. There is no special subtitle in that
window that tells me I can now do something like shift + 7 to get "&".

So I tried it again. & I went to XP help & tried other keyboard
things. What I now have after all of that is my Windows Start bar
being twice as tall, & the tray icons are now twice as big, and the
clock now displays the time plus what day of the week it is. The only
saving grace in all of this is that I like it. I am going to leave it
alone.

But still I have the problem of not being able to get the "&"
character with one single key press - any key I can use, or swap the
7, or whatever. If I have to write a program, please tell me - do I
use notepad? & what name do I save it as.. How do I turn it on or
enter it into what? Or do I enter it in start\run?

And I don't know how to access hotkeys. My search tells me I have a
file called zhotkey.exe in C:\windows & has been turned on.

...D.

-------------------
I suppose Shift + Function doesn't help. You can swap keys about but I don't think you can do part of a key.

You could go into accesability and turn on sticky keys. Press and release Shift then press 7 to get &.

One is to get Windows Recorder supplied with Windows 3.1, the other is to write a script.

You can write a program


set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}^c%{TAB}^v"

[above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]

Then set a shortcut to the scripts and set a hotkey for the shortcut (see help). The shortcut must be on the desktop or the startmenu for hotkeys to be recognised.


Windows Script Host

SendKeys Method
See Also
WshShell Object | Run Method

Sends one or more keystrokes to the active window (as if typed on the keyboard).

object.SendKeys(string)
Arguments
object
WshShell object.
string
String value indicating the keystroke(s) you want to send.
Remarks
Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard character, send the character itself as the string argument. For example, to send the letter x, send the string argument "x".

Note To send a space, send the string " ".
You can use SendKeys to send more than one keystroke at a time. To do this, create a compound string argument that represents a sequence of keystrokes by appending each keystroke in the sequence to the one before it. For example, to send the keystrokes a, b, and c, you would send the string argument "abc". The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:

a.. plus sign "+",
b.. caret "^",
c.. percent sign "%",
d.. and tilde "~"
Send these characters by enclosing them within braces "{}". For example, to send the plus sign, send the string argument "{+}". Brackets "[ ]" have no special meaning when used with SendKeys, but you must enclose them within braces to accommodate applications that do give them a special meaning (for dynamic data exchange (DDE) for example).

a.. To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one.
b.. To send brace characters, send the string argument "{{}" for the left brace and "{}}" for the right one.
Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, send the arguments shown in the following table:

Key Argument
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT, create a compound string argument that represents the keystroke combination. You do this by preceding the regular keystroke with one or more of the following special characters:

Key Special Character
SHIFT +
CTRL ^
ALT %

Note When used this way, these special characters are not enclosed within a set of braces.
To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

a.. e and c are pressed, send the string argument "+(ec)".
b.. e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".
You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter "x" ten times, you would send the string argument "{x 10}". Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send "x" ten times, but you cannot do the same for "Ctrl+x".
Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
Example
The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). Each job runs the Windows calculator and sends it keystrokes to execute a simple calculation.

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"
WScript.Sleep 500
WshShell.SendKeys "2"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 500
WshShell.SendKeys "*3"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 2500
</script>
</job>

<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("calc");
WScript.Sleep(100);
WshShell.AppActivate("Calculator");
WScript.Sleep(100);
WshShell.SendKeys ("1{+}");
WScript.Sleep(500);
WshShell.SendKeys("2");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(500);
WshShell.SendKeys("*3");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(2500);
</script>
</job>
</package>
See Also
WshShell Object | Run Method
 
Back
Top