• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:36
CEST 19:36
KST 02:36
  • 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
Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Weekly Cups (Aug 3-9): Protoss get shut out7RSL goes to London! 2026 Offline Finals Nov 21-2212Weekly Cups (July 27-Aug 2): SHIN's big week0SC4ALL II: Brood War - $2500 - Dec 5-611SC4ALL II announced - $10,000 prize pool, Dec 5-64
StarCraft 2
General
GSTL Returns in 2026! SC4ALL: II Talent Announcement! https://www.facebook.com/Eco.Fuel.Reviews/ Balance hotfix patch 5.0.16b (July 16) Protoss AoE skill expression
Tourneys
PIG STY FESTIVAL 8.0! (13 - 23 August) https://www.facebook.com/Audileaf.Official/ 2026 KungFu Cup Announcement Sparkling Tuna Cup - Weekly Open Tournament RSL goes to London! 2026 Offline Finals Nov 21-22
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
How to Watch RedNote Short Dramas in the United St u4gm Diablo 4: QoL Secrets for Faster Gameplay u4gm POE2 Frostbolt Build: A Powerful Boss Killer U4GM CFB 27 Guide: Why UTSA’s Offense Is So Danger
Brood War
General
ASL22 General Discussion StarCraft 64 is coming to Philly at SC4ALL II BW General Discussion [Personal Project Share] Terran Defense v0.60 BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues SC4ALL II: Brood War - $2500 - Dec 5-6 KCM Race Survival 2026 Season 3 2v2v2v2 Tournament
Strategy
Odyssey Mineral Stack Saturation Fighting Spirit mining rates Any training maps people recommend? Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread EVE Corporation General RTS Discussion Thread Diablo 2 thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread The Letting Off Steam Thread Iain M Banks Says He Has Cancer And Months To Live Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The ShoWTimE Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread Series you have seen recently... [Req][Books] Good Fantasy/SciFi books
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 NBA General Discussion Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Chinese Gen Z: Between Dream…
TrAiDoS
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Hello guys!
LIN1s
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5463 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
Next event in 2h 25m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft531
mouzHeroMarine 403
ProTech94
UpATreeSC 65
MindelVK 17
StarCraft: Brood War
Britney 22264
Shuttle 2588
Larva 315
Stork 254
Rush 211
Hyuk 57
hero 53
sSak 33
yabsab 16
Sexy 15
[ Show more ]
scan(afreeca) 11
Dota 2
qojqva4146
Counter-Strike
fl0m6631
x6flipin514
ceh9347
Heroes of the Storm
XaKoH 137
Other Games
singsing1585
FrodaN924
Beastyqt708
B2W.Neo272
ArmadaUGS140
Rex23
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 65
• mYiSmile122
• Reevou 6
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• intothetv
• Kozan
StarCraft: Brood War
• Michael_bg 10
• Pr0nogo 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Nemesis2162
• imaqtpie775
• TFBlade724
• Shiphtur506
Other Games
• WagamamaTV274
Upcoming Events
OSC
2h 25m
Replay Cast
6h 25m
Escore
16h 25m
PiG Sty Festival
18h 25m
ByuN vs HeRoMaRinE
ShoWTimE vs Zoun
Big Brain Bouts
22h 25m
Nicoract vs Neeb
TriGGeR vs ShoWTimE
CranKy Ducklings
1d 16h
PiG Sty Festival
1d 18h
herO vs Krystianer
Solar vs Cure
IPSL
1d 22h
Sparkling Tuna Cup
2 days
PiG Sty Festival
2 days
Maru vs Shameless
Reynor vs TriGGeR
[ Show More ]
IPSL
2 days
OSC
3 days
Afreeca Starleague
3 days
Rush vs Hm
Bisu vs Shuttle
WardiTV Weekly
3 days
The Patches Monday
3 days
Afreeca Starleague
4 days
Sharp vs Shinee
Action vs Shine
PiGosaur Cup
5 days
Replay Cast
5 days
Afreeca Starleague
5 days
BeSt vs Paralyze
Jaedong vs Speed
Kung Fu Cup
5 days
The PondCast
6 days
KCM Race Survival
6 days
Liquipedia Results

Completed

Proleague 2026-08-12
CranK Gathers Season 4: BW vs SC2 Team League
Eternal Conflict S2 Finale

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
Acropolis #5
RSL Revival: Season 6
PiG Sty Festival 8.0
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

Escore Tournament S3: W7
CSLAN 4
ASL Season 22
Escore Tournament S3: W8
Acropolis #5 - TRS
Blizzard Classic Cup 2026
Acropolis #5 - GSA
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Big Dog Cup 2026 Div 1
META DYMY #4
PGL Masters Bucharest 2026
Thunderpick World Champ.
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
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 © 2026 TLnet. All Rights Reserved.