|
I'm kind of confused. Hopefully someone here uses AutoHotKey and can help me.
So for Chrome, there was this application called TabsLock, where hitting capslock would open up a new tab for you if Chrome was open (because who used capslock anyway?). If Chrome wasn't already open, it would open it.
Anyways, my TabsLock stopped working one day and just kept on opening a new Chrome window regardless of whether one was open or not, so I decided to uninstall and try to reinstall (hoping that would solve the problem). I can't find TabsLock anywhere, though. I think the website where you can download it is just gone.
So I decided to get AutoHotKey, which is better anyway, and I started setting up some of my macros today. Here's my version of TabsLock: + Show Spoiler + Capslock:: IfWinExist ahk_class Chrome_WindowImpl_0 { WinActivate Chrome_WindowImpl_0 Send ^t } else { Run C:\Users\MYNAMEHEREFOOL\AppData\Local\Google\Chrome\Application\chrome.exe } return
+CapsLock::CapsLock
The last line there turns shift + CapsLock into a regular CapsLock.
So my issue is that if Chrome is my active window, it opens a new tab like it should, but if Chrome is either inactive or nonexistent, it just turns on capslock and doesn't do anything else. The weirdest thing is that it was working just fine before I turned my computer off, but then I checked just now, and the same code seems to not be working anymore.
HELP ME PL0X!?!? O.o
|
Are you saying it works when you select it and doesn't work when you didn't select chrome? It seems like that's how it's supposed to be, or am I wrong?
And I use caps lock instead of shift, so to capitalize my sentences I turn it on then turn it back off. In contrast, I hardly ever use shift...
|
Well the eventual goal is:
1: If Chrome is open and my foremost window, the CapsLock button functions just like Ctrl+T, and opens up a new tab. 2: If Chrome is open but either minimized or in the background, CapsLock will bring Chrome to the front and act as a Ctrl+T, opening a new tab. 3: If Chrome is not open, CapsLock will open a Chrome window, bringing me to my home page.
Right now, only situation 1 actually works. In situations 2 and 3, my CapsLock button is just a CapsLock button. Sadness.
And do you turn your caps lock on and off even if you're just capitalizing a single letter? That seems incredibly inconvenient.
|
I just plugged in your script and it is working fine on my computer. Situation 3: achieved. Situation 2 has not happened so far. I think bringing an application to the forefront may require an extra line or two with its own function. With that said, I have no idea what the problem might be in your case. If it stops working when I restart my computer I'll let you know. I have had problems with using the CapsLock key in Autohotkey before. A past script of mine had shift + Caps toggle regular Caps as well, but its functionality was hit or miss. This is a pretty sweet script though, I think it will be really useful as long as it keeps working. I'm going to for sure check back to see if you've gotten situation #2 to work. Good luck!
|
Try this
Capslock:: IfWinActive ahk_class Chrome_WindowImpl_0 { WinActivate WinWaitActive Send ^t } else { Run C:\Users\MYNAMEHEREFOOL\AppData\Local\Google\Chrome\Application\chrome.exe } return
edit: he's right the IfWinActive should be IfWinExist
|
Probably the window isn't active yet when you sent ^t (need to wait), or shift-caps conflicts with the code. Either way, try what Dead9 posted, I'd have suggested the same. Another issue could be if the class of chrome does silly things when you use IfWinActive, so you could try to change that to simply checking for "chrome" in the window name/class or something.
[e] Although you might have to change IfWinActive to IfWinExist .. I don't know if the code by Dead9 does the desired things. (not tested this, I don't even have Chrome..)
|
Germany2896 Posts
|
Thank you all. I think its working now.
My first issue was some code above it which wasn't returned properly I think (idk), but it was messing with this section of the code, too. I fixed that, and now its okay. I also put in WinWaitActive, which helped, and changed the if statement to IfWinExist.
|
|
|
|