Autohotkey Gui 7 - Text Overlay On Another Program


Hello tab nation, it's. Tom here today, with a quick video on something, I thought was kind of just a cool idea. So this is kind of more of like a showcase simple explanation, nothing too crazy here. But it was a've done a video where I did like a transparent GUI. This is kind of the same idea, but focus on a set of buttons text. This was a cool idea.

I thought for creating like list, or you know, to-do list kind of things to display over maybe like a video game, you're playing, or if you're working, uh to. Do dude list is kind of what I created here today. So yeah, let's go ahead and take a look at the code, real quick, and then we'll show you it in action. So very short script here, it's only like 18 lines of code, plus the spaces.

So the first thing I'm doing here, I'm just doing a set working directory to a script. This just means that anytime I kind of call upon a file like an INI file, or in this case, a text file it's going to find it wherever the script that I ran was located, which for here is just my. Desktop and that's going to be this right here. So it's just called to-do list.

It's just a text file. And then there I just got some just whatever basic information. I put in there, a little to-do list.

So three little things you can as much as you want I'll, show you why? Uh. So first thing I'm going to do is I'm going to press f1, and it's going to read that file store it as the variable file info. As you see here, I don't have a file path that's because it's just looking because of this set working. Directory at the same location, which is my desktop and always make sure you put that dot TXT at the end, or if you're using a Word document, you know, whatever type of file make sure you do include that we're going to do mouse, get position, x and y coordinates. Uh, the reason why I'm doing it this way you can hard code down here, the coordinates.

But you know, I could be playing one game where maybe I want the text to overlay over here. But then on a different game. I want the text to be over here. Instead. So I want to be able to live change the coordinates of where it's opening versus having to constantly decode my script close down and rerun it.

So we're doing a goofy destroy. Just in case, I know, close it. I don't want any variables getting doubled, uh hit. There it's always good to put in front of gooey, regardless, uh. And then we're just going to kind of set up.

I just copy and paste some settings here, uh, you know last found, actually, I guess I don't really technically need that because I'm using. The mouse kit position, but you might want that if you are moving some stuff around, so I'll, just leave it there for now it's, not really going to affect me always on top. Obviously, I want that text to always be visible, no matter what program I'm in. And then I just want to create like a tool window and remove that caption, which is just kind of removing this bar that's up here and removing the, you know, the x and the minimize key here, because I don't want to see that all I want is just pure text. I.

Don't want to see the GUI pretty much at all, so I'm going to set the GUI's color here. I use the hex number here that I just made up, honestly, I don't even know what this is, but for some it really doesn't matter because it's going to be hidden, um. But I mean, I could go to google here and see what color it is with this, uh, hex website here.

So it's just kind of like a. I guess it's like a soft pink or whatever, but you can go up here, and you know, find whatever color you want really doesn't matter just. Make one up I'm going to do the font at 20, just so s, size, 20, so it's, nice and big, but not too crazy, big and then here's where my text is actually going to be. So just, you know, got my variable file info. The variable at the end, that's what's going to be displayed make sure you put that in percent signs. And then, um color, that's, just the text, the font color. So I just put red in there. I if you remove this, I think it would just default to whatever your system.

Text color is. So it should be black unless. You've played around with that, but you can put whatever here you want orange blue lime.

It supports a lot of different colors, just by their name. Well. Now we want to go ahead and make that pink color from that hex color up here. We want to make that transparent, so we're using mindset, which just is, you know, adjusting the GUI here, transcolor. So that's me, changing the level of transparency of it, and we're going to make sure you just copy and paste that exact same number, uh, letters, down here, and I'm. Just. Gonna use 150 that's going to make it pretty much completely invisible.

If you do kind of want to see the GUI a little just to give it more of a background color, maybe, you know, maybe you're playing a game where a lot of red appears. So sometimes possibly that red can like overlap that could be. I could see that being annoying. So you could play around with this transparency level to get what you want. But I'm just going. I don't want to see it. So 150 worked fine for me, uh, GUI show, and then I'm.

Grabbing those coordinates I got from when I press f1 up here with my hotkey. And as you notice, I do not have a title for my GUI here, um that's because there's, no point in it since I'm using this minus caption, you're, not even going to see it. So what's the point in even naming it no point. And then I just added f2 as a quick way to exit out of the uh program. If I wanted to obviously you can change this to maybe just like a gooey destroy if you want it, and honestly, it'd probably be what I'm going to. End up doing with it, too.

Yeah. Let's take a look at this. So let's, go ahead and launch this, and we'll just use it in notepad, so I'm going to place the mouse in the spot where I want let's, uh, let's, put it under my keyboard here. I just realized you can't, really see my keyboard very well, there we go. So yeah, I'm going to put it right here, and I'm going to go ahead press f1. And there is my text.

So it read that file grabbed what was ever in there and it, uh, displayed it. Another thing to point out with this GUI. Show is I do not have a height and a width that's, because I want it to automatically adjust to the size based on how much text is in that file, um. So, yeah, just leave that out there.

Because if I were to put coordinates in there, have this be really long, it would end up cutting off a lot of those cor, the text that I grabbed from that file. So yeah, let's, you know, I can just go over here, press, f1 again. Now, it's displayed over here and here's where I could see you wanted to maybe change this. Transparency level because that can be a little hard to read there because there's, you know, colors in the background behind this. So possibly adding a little of a less. Transparency would probably be a good idea. So yeah, that was all I had on this one.

If you guys have any ideas on how to expand on this I'm, definitely interested, I think I could see myself using this in many games, just as a way to kind of remind myself of what to do. Yeah, let me know in the comments below. And if you have any. Questions also, let me know in the comments below see you guys next time. Bye.

Dated : 18-Apr-2022

Leave Your Comment