• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:54
CEST 21:54
KST 04:54
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL23Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30[ASL19] Ro4 Recap : The Peak15
Community News
Weekly Cups (May 19-25): Hindsight is 20/20?0DreamHack Dallas 2025 - Official Replay Pack8[BSL20] RO20 Group Stage2EWC 2025 Regional Qualifiers (May 28-June 1)18Weekly Cups (May 12-18): Clem sweeps WardiTV May3
StarCraft 2
General
The Memories We Share - Facing the Final(?) GSL How does the number of casters affect your enjoyment of esports? Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN Can anyone explain to me why u cant veto a matchup Karma, Domino Effect, and how it relates to SC2.
Tourneys
EWC 2025 Regional Qualifiers (May 28-June 1) DreamHack Dallas 2025 Last Chance Qualifiers for OlimoLeague 2024 Winter [GSL 2025] Code S:Season 2 - RO12 - Group B [GSL 2025] Code S:Season 2 - RO12 - Group A
Strategy
Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void Mutation # 472 Dead Heat
Brood War
General
Which player typ excels at which race or match up? Battle.net is not working Will foreigners ever be able to challenge Koreans? Practice Partners (Official) BW General Discussion
Tourneys
[BSL 2v2] ProLeague Season 3 - Friday 21:00 CET [ASL19] Grand Finals [BSL20] RO20 Group D - Sunday 20:00 CET [BSL20] RO20 Group B - Saturday 20:00 CET
Strategy
[G] How to get started on ladder as a new Z player I am doing this better than progamers do.
Other Games
General Games
Path of Exile Nintendo Switch Thread Monster Hunter Wilds Beyond All Reason Battle Aces/David Kim RTS Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia TL Mafia Community Thread TL Mafia Plays: Diplomacy TL Mafia: Generative Agents Showdown Survivor II: The Amazon
Community
General
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread All you football fans (soccer)! European Politico-economics QA Mega-thread
Fan Clubs
Serral Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion!
Sports
2024 - 2025 Football Thread NHL Playoffs 2024 Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard How to clean a TTe Thermaltake keyboard?
TL Community
The Automated Ban List TL.net Ten Commandments
Blogs
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Yes Sir! How Commanding Impr…
TrAiDoS
Poker
Nebuchad
Info SLEgma_12
SLEgma_12
SECOND COMMING
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 14257 users

AutoHotKey and Macros

Blogs > DTK-m2
Post a Reply
YejinYejin
Profile Blog Joined July 2009
United States1053 Posts
Last Edited: 2010-05-20 04:19:10
May 20 2010 04:11 GMT
#1
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

*
안지호
lyAsakura
Profile Blog Joined March 2010
United States1414 Posts
May 20 2010 04:30 GMT
#2
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...
WeMade FOX would be a deadly SC2 team.
YejinYejin
Profile Blog Joined July 2009
United States1053 Posts
May 20 2010 04:34 GMT
#3
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.
안지호
Frobert
Profile Blog Joined March 2010
Canada113 Posts
May 20 2010 08:03 GMT
#4
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!
Dead9
Profile Blog Joined February 2008
United States4725 Posts
Last Edited: 2010-05-22 11:03:33
May 20 2010 09:50 GMT
#5
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
Elaeli
Profile Joined July 2009
Germany62 Posts
Last Edited: 2010-05-20 14:02:50
May 20 2010 13:47 GMT
#6
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..)
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
May 20 2010 17:24 GMT
#7
This way of sending keys is ugly since you are relying on the correct window having focus at the when you send the keys.
You might use WM_KeyDown and WM_KeyUp instead. This has the advantage that SendMessage takes a target window-handle.

http://www.gamethreat.net/forums/software-development/11132-why-you-shouldnt-use-sendkeys.html
LiquipediaOne eye to kill. Two eyes to live.
YejinYejin
Profile Blog Joined July 2009
United States1053 Posts
May 20 2010 23:43 GMT
#8
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.
안지호
Please log in or register to reply.
Live Events Refresh
BSL 2v2 ProLeague S3
19:00
Day 3 - WB Round 2
ZZZero.O76
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 674
IndyStarCraft 253
MindelVK 41
UpATreeSC 27
Livibee 12
StarCraft: Brood War
Britney 17287
Calm 3981
EffOrt 785
Rush 201
Dewaltoss 160
BRAT_OK 83
ZZZero.O 63
Aegong 25
Shine 9
Dota 2
PGG 73
Counter-Strike
ScreaM4221
Stewie2K399
flusha325
Heroes of the Storm
Grubby3155
Liquid`Hasu452
Khaldor226
Other Games
FrodaN3435
Beastyqt777
mouzStarbuck265
ToD213
Mew2King103
Trikslyr78
KnowMe60
Organizations
Other Games
BasetradeTV43
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• davetesta28
• musti20045 26
• Adnapsc2 20
• Reevou 7
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• FirePhoenix5
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2623
League of Legends
• Jankos2110
• TFBlade1230
• Shiphtur653
Other Games
• imaqtpie2081
Upcoming Events
Road to EWC
2h 6m
Road to EWC
13h 6m
Road to EWC
20h 6m
BSL Season 20
22h 6m
Sziky vs Razz
Sziky vs StRyKeR
Sziky vs DragOn
Sziky vs Tech
Razz vs StRyKeR
Razz vs DragOn
Razz vs Tech
DragOn vs Tech
Online Event
1d 8h
Clem vs ShoWTimE
herO vs MaxPax
Road to EWC
1d 13h
Road to EWC
1d 20h
BSL Season 20
1d 22h
Bonyth vs Doodle
Bonyth vs izu
Bonyth vs MadiNho
Bonyth vs TerrOr
MadiNho vs TerrOr
Doodle vs izu
Doodle vs MadiNho
Doodle vs TerrOr
Replay Cast
3 days
Replay Cast
3 days
[ Show More ]
The PondCast
5 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-05-28
DreamHack Dallas 2025
Calamity Stars S2

Ongoing

JPL Season 2
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 1
2025 GSL S2
Heroes 10 EU
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL Season 17: Qualifier 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLAN 2025
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Bellum Gens Elite Stara Zagora 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.