Request for a Hotkey

Discuss anything related to portable freeware here.
Post Reply
Message
Author
ALISHIBAZ
Posts: 2
Joined: Thu Jul 05, 2018 10:01 am

Request for a Hotkey

#1 Post by ALISHIBAZ » Thu Jul 05, 2018 10:06 am

Hello. I posted the following to a different forum. But I'd like to re-post it here in case anyone here may find the following hotkey useful.

I have now completed my first project using Spread32. I really appreciate its simplicity and want to say thank you very much.

There is one suggestion I'd like to ask you to consider. I very much prefer to use the keyboard instead of the mouse as much as possible.

I find that I can do almost everything I need with Spread32 using the keyboard - except for one thing. I find that I often need to move my cursor from some cell to the edit box on the top of the spreadsheet so that I can edit an existing formula. I sure do wish there was some "hotkey" like maybe the Escape key or maybe some other key that is rarely used - like perhaps the backslash? "\" or one of the function keys?

Even better, would it be possible to enable users to choose the key for themselves? In that way, we could define the keys we would prefer to use? I'd love to have one key that I could choose that would instantly move the cursor from any cell or anywhere else directly to the "formua box" at the top of the spreadsheet.

For example, I see that you do define certain hotkeys like "Ctrl-1" which is equivalent to "Format Cells". It would be wonderful if you had another key that would be called something like "Jump to edit box" - especially if people could choose for themselves just which key combinations they'd like to use. Combinations like "Alt-Ctl-J" or even "Shift-Alt-Ctl-F" for example. The best user-defined hotkeys enable people to use up to 3 different modifier keys in a single definition. I know that you only have a very tiny number of hotkeys in use. But it would be so wonderful if you could add a few more for all of us keyboard afficionados.

Thank you very much for your consideration.

-------------------------------------------------------------------------------------------------------------------------------------------------



ALISHIBAZ
Posts 4

2 minutes ago #2
After making the above post, it occurred to me that some other people might also find it useful to use a hotkey that instantly causes the cursor to jump to the edit box at the top of the spreadsheet.

One of the most wonderful Windows freeware utilities I have ever used is a language that enables people to create their own hotkeys. It is a full programming language. But it can also be used to create just a few simple hotkeys. I decided to post an example of the hotkey I created which uses the backslash "\" to cause the cursor to jump to the edit box at the top of the spreadsheet.

I should begin by telling you that Autohotkey has a web site and you can easily download the free version of the utility there. It is: https://www.autohotkey.com

There is no "catch" to this product. It is completely free. It never asks you to send them money. You just go to that web site and download the current version of AHK (AutoHotKey). Then you install it and the entire process is very quick and very easy.

One of the tools that comes with AHK is a "spy" program. I will just tell you that one of the capabilities of that tool is that you can move the mouse cursor anywhere on the screen and it will tell you the exact position of the cursor in pixels. I used it to find the mouse position of the edit box is 42, 57. That means the x-co-ordinate is 42 pixels and the y-co-ordinate is 57 pixels.

I will now show you the code required to transform the backslash key into a hotkey that moves the mouse cursor instantly to a position in the edit box at the extreme left. Here are the five lines required to achieve this hotkey:

---------------------------------------

\::
Coordmode Mouse,Screen
Click 42,57
Coordmode Mouse,Relative
RETURN

---------------------------------------

The first line means that you are creating a macro that will be invoked every time you tap the backslash key.
The second line uses the command "Coordmode". This command enables you to choose whether you want to reference pixels in the active window or on the entire screen.
I chose to use the full screen. So "Click 42,57" means to move the cursor to a point on the screen that is 42 pixels to the right of the upper left corner and 57 pixels down from the upper corner.

You can look up this command in the User Guide to learn its fine points. But its not really necessary. It's really very simple. It just enables you to choose from two options when specifying any position to move the mouse.

The fourth line is "Coordmode Mouse,Relative". This command just restores the system to use the active window whenever someone specifies a pair of pixel co-ordinates.

The "RETURN" command signals the end of the hotkey macro.

---------------------------------------

I will now show you a few examples of simple hotkeys so that you can get the idea if this language is something that may appeal to you. Here is an example of four hotkey definitions that map four key combinations to the cursor keys. You might use these definitions if you have some reason for not wanting to use the cursor keys.

In AHK, when defining a key combination, it uses the following four characters to signify the four modifier keys: ALT, CTL, SHIFT, WIN.

! - ALT
^ - CTL
+ - SHIFT
# - WIN

The following four lines demonstrate the use of "single line" hotkeys. Whenever you define a hotkey you can define that hotkey with a single line or with multiple lines. The following four lines each define a keystroke combination that can be used in place of one of the four cursor keys:

^m::sendinput {UP}
^,::sendinput {LEFT}
^.::sendinput {RIGHT}
^/::sendinput {DOWN}

The 1st line changes the meaning of CTL-m. Whenever you press CTL-m, the effect will be the same as pressing the UP cursor key. The idea is that you can use the key sequence "CTL-M" to simulate pressing the "up cursor key".

Once you define the key sequence "CTL-m" as the UP cursor key, everytime you press the CTL-m key, the PC will react as if you have pressed the UP cursor key. This is no real earth-shattering event. But in many cases, you will find that you can do many wonderful things by defining your own hotkeys. For example, I have found many excellent techniques that I can accomplish by defining certain hotkeys using the AHK language. I hope you will decide to give this utility a chance. If you do. I think you will find that you can accomplish many excellent productivity enhancements by using this tool. I can tell you - with no reservation at all - if I was stranded on a desert island and could use only one PC applications, it would be - without a doubt - Auto HotKey. I have used this language to accomplish many wonderful things. One of my most favorite activities is to use AHK to simulate employing hundreds of people to each enter contests or purchase concert tickets. I have won several great prizes because I am able to submit many multiple entries in a very short period of time and in this way, I can get several great advantages over other people who are limited to submitting orders or contest entries - limited to the speed at which they can enter such contests. I can create "bots" (aka "robots") who can submit hundreds of entries in a few seconds so that I can essentially jump to the front of the line and buy out hundreds of concert tickets before anyone else is ever able to buy one such ticket. Is that cheating? I don't know. Is it fun? Oh my Gosh It's a riot and I love it.

Have you ever wondered why you are never able to purchase any concert tickets for your favorite performers? Have you ever wondered why a very few select number of people seem to be able to "snap up" almost every single ticket as soon as they go on sale? It may not be fair. But, it's a wonderful tool and if you use it correctly, you can multiply your abilities hundreds or thousands of times and I think it's safe to say that you will absolutely love this tool. If you rely on using spreadsheets, I think it's safe to say that you will be able to do all kinds of terrific stuff with your spreadsheets by using them together with some Hotkey Language. The best thing about this language? It is completely free. You never have to give me (or anyone else) any money. Honest! Well .... almost honest anyways. You can send me a Private Message if you want to know more. But you really don't need to send me anything private. Please be assured. I will never ask you for any money and no one else will either. Honest! Never! I promise!

In the above sample code:
The 2nd line changes the meaning of CTL-, (CTL-comma) as follows: Whenever you press CTL-,Comma, the effect will be the same as pressing the LEFT cursor key.
The 3rd line changes the meaning of CTL., (CTL-period) as follows: Whenever you press CTL-Period, the effect will be the same as pressing the RIGHT cursor key.
The 4th line changes the meaning of CTL/, (CTL-slash) as follows: Whenever you press CTL-Slash, the effect will be the same as if you pressed the DOWN cursor key.

---------------------------------------

Well, that's just about it. AHK is truly very simple and a real marvel. I just wanted to give you the basic idea of how to create your own hotkeys and then use them in conjunction with some other app.

If you have any questions, AHK has a very enthusiastic and friendly user forum and if you post your questions there, I'm quite certain the AHK users will be glad to try and help you. Please feel free to experiment with the "SPY tool" and with pixel co-ordinates. You can easily adjust them if you find that 42, 57 may not be the very best co-ordinates for you to use.

Have Fun and always remember ...... "Keep a stiff upper lip"! Ain't that what they mean by the name, ""Stiffie"? I think it probably may well be.
Last edited by ALISHIBAZ on Sat Jul 07, 2018 12:18 pm, edited 1 time in total.

User avatar
Midas
Posts: 4272
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Request for a Hotkey

#2 Post by Midas » Fri Jul 06, 2018 4:06 am

Wow! That's some 1st post... :mrgreen:

But I reckon it should have been posted to "Discussion", so moving...

ALISHIBAZ
Posts: 2
Joined: Thu Jul 05, 2018 10:01 am

Re: Request for a Hotkey

#3 Post by ALISHIBAZ » Sat Jul 07, 2018 12:03 pm

I'm afraid I have a tendency to make posts that are very long - unfortunately, they are often far too long. I also have a tendency to ramble when I get excited by an idea that I like. But, when I do both things at the same time, the results are usually bad. I have to apologize to you all for that. In the past, I have often been told, "TL DNR" which means "Too Long - Did not Read".

I wanted to post a request for a hotkey that would instantly move the mouse cursor to the Edit Box at the top of the spreadsheet. But when I realized that I could create that hotkey for myself (using AHK), I got excited because that meant I wouldn't have to ask someone else to create it for me and wait for them to do it. If case anyone is interested, I have created a few other new Spread32 commands using AHK and I think you may find them useful.

One of these new commands is an extension to the "jump" hotkey (that's what I'm calling the hotkey that moves the cursor to the edit box). It jumps to the Edit Box and then enters the code "=SUM()". You can enter the cell co-ordinates for yourself. You can also see how to create other similar commands for yourself and if you often use formulas (or just dislike typing), that might save you a fair bit of time.

Another new command enables you to instantly resize Windows so that you can compare two spreadsheets "side by side" as it were. I'm sure many of you know about "dual pane" File Explorers. They enable you to look at all the files in two different folders - side by side. One freeware utility called "QDir" goes so far as to let you look at four folders at once - displayed in the four quadrants of your screen. My new commands are a similar idea for spreadsheets. You can display two (or four) spreadsheets on your monitor, you can then move one to the LHS of the screen and the other one to the RHS of the screen (or you can display up to four spreadsheets in the four quadrants of your monitor). Since everyone here likely has monitors of different sizes, you can use the AHK SPY utility to see the exact height and width of your monitor (in pixels). Then you can figure out the exact dimensions to use for the Left Hand Side spreadsheet as well as the Right Hand Side spreadsheet. This command is a whole bunch of fun and it's very useful too. You might want to experiment with the dimensions and pick your own number and sizes of the various quadrants. It's lots of fun. It's also very useful to be able to look at two spreadsheets - side by side - or one above and one below. The best part is that each command requires less than ten lines of code. AHK is often very simple to use.

I made a mistake yesterday by combining 2 or 3 posts into one. I should have just made one post explaining how people could create this "Jump" capability for themselves. In future, I will try to keep my posts much shorter - or at least warn you if they're going to be so long. I hope you have "Spoiler Boxes" here because I should have split up most of that long post and organized it into a few spoiler boxes so you could look at the details if you wanted or just skipped the details if you weren't interested. I'll do that next time (if I don't get banned first). I get banned a lot for making long & rambling posts).

Post Reply