Shift Tab twice

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Shift Tab twice

18 Nov 2020, 23:38

I need to send the Tab key twice while holding the shift key down. I wrote this as part of my script:

Send, +{Tab}
Send, +{Tab}

Is there a better way to write this?
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Shift Tab twice

18 Nov 2020, 23:42

Code: Select all

Shift::Send, {Blind}{Tab 2}
User avatar
boiler
Posts: 16968
Joined: 21 Dec 2014, 02:44

Re: Shift Tab twice

18 Nov 2020, 23:46

I took it to mean that it does what it’s supposed to but just wants to know if it can be written more efficiently, like this:

Code: Select all

Send, +{Tab 2}
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

19 Nov 2020, 00:04

Xtra wrote:
18 Nov 2020, 23:42

Code: Select all

Shift::Send, {Blind}{Tab 2}
That's interesting, I didn't know you could specify the number of times key press by simply typing the number, 2.

After I read your post, I did some thinking and realized I could do something like this...

Code: Select all

Send, +{Tab 2}
My code worked. Yours didn't however. I wonder why that is?
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

19 Nov 2020, 00:11

boiler wrote:
18 Nov 2020, 23:46
I took it to mean that it does what it’s supposed to but just wants to know if it can be written more efficiently, like this:

Code: Select all

Send, +{Tab 2}
Yes! exactly.

I have no idea what the other poster was trying to do w/ his code.
User avatar
boiler
Posts: 16968
Joined: 21 Dec 2014, 02:44

Re: Shift Tab twice

19 Nov 2020, 00:21

M4verick wrote:
19 Nov 2020, 00:11
I have no idea what the other poster was trying to do w/ his code.
It was interpreting your post to mean that you wanted the script to Send the Tab key twice when you physically press the Shift key (i.e., a Shift hotkey).
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

01 Dec 2020, 22:47

The method suggested by Boiler is not working
Send, +{Tab 2}

What I'm trying to do is to save a file in one of my Windows Explorer favorites as shown here:

Screenshot
[Mod edit: Link fixed.]

I don't know how to save a file automatically to a preset directory of my choosing. I figured if I can at least get the focus onto the "Favorites" navigation pane by sending the shift+tab twice. From there it would be a simple matter of sending the down arrow key twice to select the "EP Sub" folder and sending the Enter key.

Well, that's awkward, the forum script keeps breaking my link. Here's a slightly modified link; please replace the plus sign with the backslash.
https:++ibb.co+PjHvD3g
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

01 Dec 2020, 23:09

There's a simple approach that could save some headaches here: use a hotstring for the directory path. For example:

Code: Select all

#IfWinActive Save As ahk_class #32770
:COT:eps::c:\EP Sub\
#IfWinActive
Now: at the default filename box, just press Home and then type: eps Space. Your directory path will be inserted automatically.
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

01 Dec 2020, 23:43

Thanks Mikeyww, your code works but I'm trying to automate everything so that AHK does everything on its own without any user input involved. It's a simple PNG file hosted on a website and so I figured there's gotta be a way to save the file to a specific directory of my choosing. I've read the beginner tutorials on how to SetWorkingDir

I tried using the SetWorkingDir command and set it at the very top of my script like so:
SetWorkingDir, E:\blah blah\EP Sub

It's not working, which is why I've been trying to send the shift+tab keystroke combination make the focus go over to the navigation pane in the Save As box.
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

02 Dec 2020, 06:24

This might work for you. You can change the hotkey as needed.

Code: Select all

#IfWinActive Save As ahk_class #32770
F3:: ; Navigate "Save as" to Favorites
ControlFocus, SysTreeView321
Send {Home}{Down 2}{Enter}
Sleep, 200
Send !n
Return
#IfWinActive
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

02 Dec 2020, 23:31

Thanks Mikeyww, but that's not what I'm looking for (Like I said, I'm trying to automate everything so there's no user input required after the script launches). However, your post taught me something new and very important for my situation! the ControlFocus and SystreeView321 was much needed for my script to work properly so I modified your code and incorporated into my beginners amateurish script. I've got everything working now.

I don't think I need to post the entire script but here are the last few lines of my script:

Code: Select all

Send, ^v ; this pastes the clipboard contents from memory into the browser address bar
Send, {enter}
Sleep,2000 ; gives a full 2 seconds for the image to download into the browser
Send, ^s ; invokes the save command in Firefox
WinWaitActive Save As ahk_class #32770 ahk_exe firefox.exe
ControlFocus, SysTreeView321
Send, {Home}{Down 2}{Enter}
Sleep, 200
Send, !s
Return
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

03 Dec 2020, 00:25

I see what you mean.

Thanks for the follow-up.
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

03 Dec 2020, 18:51

@mikeyww, quick follow up question:

What exactly is SysTreeView321 anyway? Based on the end results of the script, I'm guessing it's the navigation pane in the Windows Explorer window. Correct? I tried doing a keyword search in the AHK help menu ("SysTreeView321") but nothing came up. Is SystreeView321 particular to AHK or is it commonly used in other programming languages?

How did you learn all this stuff anyway? Are you a programmer by vocation? It seems it's gonna take me many years to reach your proficiency level.
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

03 Dec 2020, 19:14

No problem. SysTreeView321 is the name of the treeview control in that window. You are using it in Firefox, but Windows (File) Explorer uses that control name more broadly, so you will notice it in many different dialog windows where there is an Explorer-style treeview. Yes, that treeview and control are used for the navigation pane. This is not an AHK-specific or AHK-exclusive kind of feature or issue. Other programming languages could access the same controls, with the same names, in their own way.

Thanks for your comments and feedback. I do a lot of programming and have done it professionally and also as a hobby at other times, for many years (decades). I'm actually a medical scientist with a background in cognitive science, computer science, and technology. I study the roles of technology in healthcare, including telehealth, telecommunication, and electronic health records. I have programmed and designed databases, HTML, neural networks (but long ago), and some varieties of other things. I have some casual interests in networks and cybersecurity. Most of my work is practical and applied and not very theoretical. I do a lot of reading, testing, and seeing how other people approach problems. Solving problems is the fundamental thing that I do in nearly all of my work. I don't have the same depth of programming knowledge as the most advanced users on the forum here, but I can figure out a lot of things!

You're well on your way! Have fun with it. :beard:
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

03 Dec 2020, 19:54

That's pretty cool. What is neural networks?
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

03 Dec 2020, 20:21

A momentary divergence from AHK :shh:, though I'm sure that AHK could be used to program a neural network: a neural network is a network of simulated neurons or actual neurons, which are cells of the nervous system that transmit signals to each other and to muscle cells throughout the body. Real neurons make your brain, spine, and muscles work, transmit pain signals, and do a few other useful things, like enable you to hear, see, and smell things. Computers can be programmed to simulate real neurons, which house the deepest form of learning that is known. As such, artificial neural networks can be trained and then, based on that learning, can respond to new stimuli in patterned ways that essentially reflect mathematical models of layered, interconnected nodes. Although this has a theoretical basis, the networks also have practical applications in doing things like recognizing voices, handwriting, cancer, faces, and weather. You could think of them as the most advanced forms of pattern matchers-- a solar system above regular expressions!
M4verick
Posts: 193
Joined: 03 Nov 2020, 12:00

Re: Shift Tab twice

03 Dec 2020, 22:25

Ah, yes... a network made up of neurons. That is exactly what I had surmised but I thought you were a programmer and not a medical professional so so I just couldn't make the correlation in your initial response with the response you just gave me now. (My mind began to go off in the a different tangent more specifically tied to computer networks.)

You touched on a keyword for me -- artificial intelligence. In one of my previous jobs I met a programmer at the company I used to work for. We got along great and hung out after work a few times - he was a really smart dude and I miss talking with him. Such an intelligent person. He was the first person to alert me to the progress of A.I. in our modern society and the implications of this growing field. Ever since, I've been curious to know more about this very fascinating topic. Shortly after our friendship began we lost touch. Both of my parents became very ill so both my time and energy was sucked up into take care of them. Things are a little bit better but not by much.

Personally, I very much regret not choosing computer science (or some type of science) as my major. There are so many things about computer science i want to learn more about. By the way, I watched a PBS documentary last year called "in The Age of A.I.". I don't know if you saw that or not, but I found it to be well done. You can still watch it on their website here.
User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Shift Tab twice

03 Dec 2020, 22:33

Thank you very much! I will check it out. AI goes back at least 65 years (before my time!), depending on how and what one counts. Thus, for people who think it's a new thing-- well, it isn't at all. Nonetheless, advances in computing and certain techniques are making many new and important applications of AI possible today, so there's a renewed sense of excitement about it.

I know this is somewhat off topic for AHK, but I find it rewarding and useful to hear about the backgrounds of people on the forum; wish I still knew more about the regulars! Thanks for sharing. It's never too late to learn and apply yourself in new ways. I hope that 2021 is looking up for everyone. :)

:offtopic: (I couldn't resist)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, just me and 221 guests