Moving to next row by right arrow button in Finder

If Finder, when I display files in icon view, when I move to the last file in one line, and then press → (right arrow) button, I want it to move to the first file of next row (like in Windows).

I tried to achieve that by Keyboard Maestro as:

  1. If
    If the distance of last file (middle of file icon) to the right edge of the Finder window is <50;
  2. Then
    Press ↓(down arrow) one time and ←( left arrow) many times

However, I do not konw how to get the distance of file icon to the window edge. Could you please help? Or do you have any other suggestions to achieve this?

Or if there is any other maextro already achieve this, please kindly let me know, thanks.

Thanks a lot!

You may not need a macro. If your files are already displayed in alphabetical order (what Finder calls "Name order"), then the Tab key (and Shift-Tab) will already do this. The only problem is that if you have files that start with digits, it seems to get those a little out of order (there may be a way to fix that, I'm not sure.) So if the names of the files in your folder don't start with digits, and you sort the files by name, this should be a 100% solution.

There may be some geniuses here who can figure out how to make Finder sort files different, so that problem might be fixable.

I like this problem, however, and there's a 75% chance I can solve it. I have several ideas for solving it, but some of my ideas involve changing some of the Accessibility settings for macOS, and I'm not sure if you will be happy with changing the way Finder looks.

Hi Airy,

Thanks so much for your help, and it's so great to know that "Tab key / Shift Tab key" could change to next row. Really nice.

However, if it's possbile to use right/left arrow key to achieve that, it would be much better since I often use Mac / Windows both. If achieved, I would not need to remember to change to Tab when use Mac.

Regarding Accessibility settings, it's OK for me. Well, " changing the way Finder looks" , I do not understand that very well.

Thanks again.

Okay, I got the right arrow key working. I will upload the macro. But because this macro uses the Find Image action, and because your screen may not have the same resolution as mine, you may have to modify the Find Image actions in my macro.

My macro handles the case of right arrow, but at this time it does not handle left arrow moving upwards in the reverse direction. (You didn't actually say you wanted that.) I may be able to solve that too, but I need more time to think about it.

You will need to place the macro inside a group that is enabled ONLY when Finder is active.

At this time, my macro works if you limit Finder to a fixed number of icons across (currently 12.) But I might be able to address that.

Finder - Right Arrow Macro (v11.0.3)

Finder - Right Arrow.kmmacros (22 KB)

Notice how the images in this macro are the upper sliver of the highlight colour around the selected file. I just noticed something. In my System Settings / Accessibility / Display, I have "Increase Contrast" enabled. You should probably turn that on, at least for testing this macro.

Hi Airy, thanks for that, and I'll try to apply that on my computer and test.

Well, I do need left arrow moving upwards, and I did not mention that because I thought could learn and get them solved by the same way :slight_smile:

I appreciate your eagerness. Please try doing that, I won't stop you. But it will be 50% harder to solve. I'll let you figure out why, and then you can come back for help if you get stuck.

Actually I meet problem for the first step :slight_smile:

I turn on the "Increase Contrast" and also ajust to 12 (13 also tested) files per row, and also turn on the Maestro Group & Maestro itself, but it doesn't work.

Is it because my Keyboard Maestro version is too old? (Version 9.0.4).

Now I understand " changing the way Finder looks" , and it changed the layout of other software too. It's a big change, any other new ideas not changing contrast to achieve this?

Anyway, thanks a lot.

As I said above, you may have to take new image captures for the Find Image action to work. This is because you and I may have different screen resolutions. You didn't mention whether you did this or not, so this is probably the cause of your problem.

I will try to explain image captures in the next few minutes.

Ok, take a look at this... (from my macro). Look closely at the image inside the well....

image

Notice that the image well contains an image. You probably need to replace the image I gave you with your own image from your own screen. This is because you and I probably have different video resolutions.

In order to replace the image, you need to take screen captures. I have no idea if you know how to do that. What you need to learn to do is use the macOS features with the CMD-SHIFT-5 hotkey. (But first, make sure the Finder app is open and frontmost.) When you press that, a popup window will appear. You need to make sure the third icon in that popup is selected ("capture selected portion"). You also should check that under the Options pull down menu, Clipboard is selected (which makes things simpler.) Then you move the highlighted rectangle over the top edge of the file that is currently selected in Finder. You need to capture a thin sliver of that image, which should include the top corners of the icon, but NOT any part of the icon itself. Just a few pixels. Look at my image to see how slim the image is. Then press "Capture", then switch to the KM Editor. Then click on the image well, then press CMD-V (paste). This will capture the image you just copied. You need to do the last step twice, because there are two Find Image actions in my macro.

That's a lot of little steps, but I'm explaining it because I don't know if you have ever captured an image before.

Probably not. Just take all my other advice and it will probably work.

I said that you should change the contrast setting only for testing purposes. Once you get it working (which will be easier if you adjust the contrast) then you can return the contrast to normal, but then you will have to adjust your captures images. I have lots of experience with Find Image, but if you really enjoy pain and suffering, you can ignore my advice. Remember, I'm just asking you to change this setting for testing and debugging purposes.

I just thought of something. There's another simpler approach. Just create a macro that is active only when Finder is running that remaps the Right/Left arrow keys to the Tab/Shift-Tab keys. That sounds like a perfect solution. And simple! Like this:

And do the same thing to remap Left Arrow to Shift-Tab. How much simpler can a solution be than this?

Thanks so much for your patience and even tell me how to take screen-caputre, and I know how to do that. I replaced the pictures by dragging captured image and the gray color is the same with slected file background, and the maestro sitll doesn't work.

I will try more times later.

Actually I also considered after your reminding about Tab key, but after testing, I find it's not a good way because I still use "Right arrow" key for changing the name of file.

The Tab key would not move the cursor position in the file name, but only works as "Enter" key and stop changing name process.

Well, it works for me. So it's probably an image-related issue. Do you know how to use the debugger to go step by step through this macro?

You should turn on the "Display" flag in the Find Image action and go step by step, slowly, to see if/where it's finding the image.

There may be ways to address that problem, so you might be closing the door too quickly on that option.

My macro doesn't redefine the tab key, so I'm not sure what the problem cold be there.

Keyboard Maestro's find image is more reliable if you paste the screenshot from the clipboard. So you could perhaps try ⌘⇧⌃4 and pasting your screenshots into the KM action image wells to see if that helps.

Perhaps they were expecting the Tab key to take on the role of the Right Arrow key, as the Right Arrow key had taken on the role of the Tab key.

Either way, I think getting used to using Tab and Shift-Tab would be infinitely easier to do, and it will always work regardless of icon count, which Mac you're using, etc. That doesn't mean it's not fun and useful to try to come up with a macro solution, but in this case, given a built-in solution exists and works perfectly other than which keys it uses, it seems like the best route—at least, it's the route I'd take, and I love finding a way to use a macro even when it makes no sense :).

-rob.

Please try to edit file name, for exmaple, the name is "123.jpg", and change it to "1203" by move the mouse cursor from beginning to right side of "1" by right arrow, and you will find when you press "right arrow key" ( it works as Tab key by your Maestro), and you will find you could not move the cursor position at all.

Well, I did not close the door, and I also find a way that may work. That is:

  1. Use your "find image" method to find "file name backgroud" (blue color)
  2. If found, use your maestro to make "right arrow" key work as "Tab"
  3. If not found, do not make "right arrow" key work as "Tab", and it would not affect changing name process ( When you change name and move cursor position, there is no blue background for file name.

I'll study more about finding image of your maestro first and then try more.

Thanks and I'll try it.

Tab key is not reliable enough. If the files are not ranked by name, for example, by size, when press Tab key, it would jump to a file far away from the file selected, not to the right side one.

Gotcha ... well, given that you need back and forward, while a macro is feasible, I think it's going to be complicated to make it work in all situations. You might consider using list view with the Preview column (View > Show Preview) open.

All four arrow keys can be used in list view to move through your files, opening and closing folders as needed, and the preview column shows the file/image/etc. You can make the Preview column as wide as you wish, and with list view, it's also very easy to change the sort order as needed.

Just a thought.

-rob.

Yes! But that may be fixable! I can't fix everything all at once. We start by getting the macro working, and only after that do we address the problems.