• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:40
CEST 17:40
KST 00:40
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL62Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event21Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays FEL Cracov 2025 (July 27) - $8000 live event Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Player “Jedi” cheat on CSL SC uni coach streams logging into betting site Flash Announces Hiatus From ASL Practice Partners (Official) ASL20 Preliminary Maps
Tourneys
CSL Xiamen International Invitational [BSL20] Grand Finals - Sunday 20:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Summer Games Done Quick 2025! Trading/Investing Thread Things Aren’t Peaceful in Palestine
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 650 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
FEL
12:00
Cracov 2025: Qualifier #2
CranKy Ducklings582
IndyStarCraft 336
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 371
IndyStarCraft 336
Hui .230
StarCraft: Brood War
Calm 4738
Rain 2504
Shuttle 1656
Horang2 1307
Bisu 958
EffOrt 820
Jaedong 654
Mini 338
Stork 309
Hyuk 271
[ Show more ]
TY 194
GuemChi 185
Soma 150
hero 110
ToSsGirL 105
Hyun 82
Barracks 78
Sacsri 78
PianO 47
GoRush 45
Free 30
Terrorterran 17
HiyA 10
sas.Sziky 5
ivOry 4
Stormgate
TKL 273
Dota 2
qojqva3671
Fuzer 330
canceldota265
LuMiX1
League of Legends
singsing2857
Counter-Strike
byalli295
edward59
Super Smash Bros
Chillindude57
Mew2King4
Heroes of the Storm
Khaldor657
Liquid`Hasu473
Other Games
Gorgc3417
B2W.Neo1599
FrodaN1069
ArmadaUGS103
KnowMe78
Organizations
Other Games
EGCTV1374
StarCraft: Brood War
Kim Chul Min (afreeca) 12
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• StrangeGG 83
• Adnapsc2 14
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 3735
• WagamamaTV730
• Ler125
Upcoming Events
BSL: ProLeague
2h 20m
Dewalt vs Bonyth
Wardi Open
19h 20m
Monday Night Weeklies
1d
Replay Cast
1d 8h
Sparkling Tuna Cup
1d 18h
WardiTV European League
2 days
PiGosaur Monday
2 days
The PondCast
2 days
WardiTV European League
2 days
Replay Cast
3 days
[ Show More ]
RSL Revival
3 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
4 days
RSL Revival
4 days
Classic vs Cure
FEL
5 days
RSL Revival
5 days
FEL
5 days
FEL
6 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
FEL
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
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
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.