• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 01:03
CEST 07:03
KST 14:03
  • 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
Team TLMC #5 - Finalists & Open Tournaments0[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29LiuLi Cup - September 2025 Tournaments3
StarCraft 2
General
#1: Maru - Greatest Players of All Time Weekly Cups (Sept 8-14): herO & MaxPax split cups Team Liquid Map Contest #21 - Presented by Monster Energy SpeCial on The Tasteless Podcast Team TLMC #5 - Finalists & Open Tournaments
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris SC4ALL $6,000 Open LAN in Philadelphia Sparkling Tuna Cup - Weekly Open Tournament WardiTV TL Team Map Contest #5 Tournaments RSL: Revival, a new crowdfunded tournament series
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
[ASL20] Ro16 Preview Pt2: Turbulence BW General Discussion ASL20 General Discussion Diplomacy, Cosmonarchy Edition BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL20] Ro16 Group D [ASL20] Ro16 Group C [Megathread] Daily Proleagues SC4ALL $1,500 Open Bracket LAN
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread General RTS Discussion Thread Nintendo Switch Thread Borderlands 3
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread Russo-Ukrainian War Thread The Big Programming Thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1118 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
PiGosaur Monday
00:00
#49
Liquipedia
OSC
23:00
OSC Elite Rising Star #16
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft556
StarCraft: Brood War
Leta 533
Noble 51
ajuk12(nOOB) 43
Icarus 10
Dota 2
NeuroSwarm132
Counter-Strike
Stewie2K326
semphis_47
Super Smash Bros
Mew2King40
Other Games
summit1g4930
C9.Mang0320
XaKoH 150
ViBE142
SortOf52
Trikslyr32
trigger1
Organizations
Other Games
gamesdonequick684
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• OhrlRock 91
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1120
• Lourlo1113
• Stunt441
Other Games
• Scarra1215
Upcoming Events
LiuLi Cup
5h 57m
OSC
13h 57m
RSL Revival
1d 4h
Maru vs Reynor
Cure vs TriGGeR
The PondCast
1d 7h
RSL Revival
2 days
Zoun vs Classic
Korean StarCraft League
2 days
BSL Open LAN 2025 - War…
3 days
RSL Revival
3 days
BSL Open LAN 2025 - War…
4 days
RSL Revival
4 days
[ Show More ]
Online Event
4 days
Wardi Open
5 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 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.