• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 04:10
CET 10:10
KST 18:10
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
Foreign Brood War BGH Auto Balance -> http://bghmmr.eu/ Data analysis on 70 million replays BW General Discussion MBCGame Torrents
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile ZeroSpace Megathread The Perfect Game
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
I decided to write a webnov…
DjKniteX
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1023 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 50m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
trigger 62
RotterdaM 23
StarCraft: Brood War
Hyuk 2960
Leta 993
Killer 514
firebathero 513
BeSt 458
Zeus 293
910 271
Soma 145
Dewaltoss 96
EffOrt 91
[ Show more ]
Sacsri 90
JulyZerg 88
sorry 87
Bale 62
ajuk12(nOOB) 50
zelot 46
Noble 21
Sharp 18
Hm[arnc] 13
Dota 2
singsing2968
NeuroSwarm159
Super Smash Bros
C9.Mang0613
hungrybox279
AZ_Axe37
Heroes of the Storm
Khaldor189
Other Games
summit1g9266
mouzStarbuck395
Organizations
StarCraft: Brood War
UltimateBattle 45
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH236
• LUISG 6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota241
League of Legends
• Jankos852
Upcoming Events
Sparkling Tuna Cup
50m
WardiTV 2025
2h 50m
OSC
5h 50m
IPSL
7h 50m
Bonyth vs KameZerg
BSL 21
10h 50m
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
23h 50m
Wardi Open
1d 2h
StarCraft2.fi
1d 6h
Monday Night Weeklies
1d 7h
Replay Cast
1d 14h
[ Show More ]
WardiTV 2025
2 days
StarCraft2.fi
2 days
PiGosaur Monday
2 days
StarCraft2.fi
3 days
Tenacious Turtle Tussle
3 days
The PondCast
4 days
WardiTV 2025
4 days
StarCraft2.fi
4 days
WardiTV 2025
5 days
StarCraft2.fi
6 days
RSL Revival
6 days
IPSL
6 days
Sziky vs JDConan
Liquipedia Results

Completed

Proleague 2025-12-04
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
WardiTV 2025
META Madness #9
Kuram Kup
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 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.