PDA

View Full Version : Mapping characters to keycodes question


casman
03-26-2006, 05:47 AM
Hello SF7 forum.

As part of a setup, I include a screen to accept a character from the user, with 'Z' as the default character.
Once obtained, I would like to assign a Keyboard shortcut to a particular program, with the Keyboard shortcut comprising of 'CTRL+ALT+?' where '?' is the character obtained from the user (or 'Z' as default).

My quesion is, how do I convert my character obtained into a keycode, as required in Shell.CreateShortcut?

As an example, to create a Keyboard shortcut of 'CTRL+ALT+Z', I would use the following command:

DTFolder = SessionVar.Expand("%DesktopFolder%");
Shell.CreateShortcut(DTFolder, "TP", SessionVar.Expand("%AppFolder%\\TP.exe"), "", "", "", 0, SW_SHOWNORMAL, {ctrl=true,alt=true,keycode=90}, "");

However, I'm not sure how to build 'keycode=90' from the character 'Z' typed in an editbox.

Any suggestions would be greatly appreciated.

Regards,
Casman.

Adam
03-27-2006, 10:49 AM
What does the letter 'Z' return when you print it to a Dialog.Message()?

Adam Kapilik

Absynthe
03-27-2006, 02:24 PM
casman,

Take a look at String.Asc in the help file, it will do what you are looking for.

casman
03-27-2006, 10:01 PM
Thanks for the responses.

I tried the String.Asc and it has worked a treat!.

Thankyou for your assistance.

Regards,
Casman.