Intro to AutoHotkey | Learn to automate your Windows computer | Joe Glines | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Intro to AutoHotkey | Learn to automate your Windows computer

teacher avatar Joe Glines, AutoHotkey / Automation Expert

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

38 Lessons (5h 2m)
    • 1. 01 01 Joe Glines

    • 2. 01 02 RPA vs AI

    • 3. 01 03 Why should I care about ahk

    • 4. 01 04 What Is AutoHotkey

    • 5. 01 05 Installing AHK

    • 6. 01 06 AutoHotkey IDEs

    • 7. 02 01 Joe's Crazy Taskbar on Right

    • 8. 02 02 ahk Basics Your 1st Script

    • 9. 03 01 Multiple vs Single Scripts

    • 10. 03 02 Directives Commands and Functions

    • 11. 03 03 Auto Execute

    • 12. 03 04 Referncing Variables

    • 13. 04 01 HotStrings

    • 14. 04 02 HotKeys

    • 15. 04 04 Remapping Keys

    • 16. 04 05 FileSelect and Folder Select

    • 17. Mouse Clicks

    • 18. Overview

    • 19. 05 01 Assigning Values to Variables

    • 20. 05 02 Evaluating Conditions

    • 21. 05 03 ToolTips and SplashText

    • 22. 05 05 GoSub

    • 23. 06 01 Function Parameters

    • 24. 06 02 Scope

    • 25. 06 03 Returning a Value

    • 26. 06 04 Defining Default Vaules for Parameters

    • 27. 07 01 Includes and Libraries

    • 28. 07 02 Scripts and Windows Paths

    • 29. 07 03 Reading Writing Text Files

    • 30. 07 04 Manipulating Files and Folders

    • 31. 07 05 Working with Text

    • 32. 07 06 Built in Variables

    • 33. 08 01 Activating windows

    • 34. 08 02 Window Existance and Activation

    • 35. 08 03 Moving Hiding Showing Windows

    • 36. 08 04 Setting and Getting Info

    • 37. 09 01 Troubleshooting

    • 38. Wrap Up 2

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

In this course we learn about Desktop Automation & Robotics Process Automation (RPA).  We take our first steps learning how to program in AutoHotkey.  This course is for non-programmers that want to learn how to use this free (open source) tool!

Robotics Process Automation is a BOOMING field.  Most other tools cost $10,000 plus per licence while AutoHotkey is free!

This course covers the basics and is designed for non-programmers wanting to automate the mundane!

Meet Your Teacher

Teacher Profile Image

Joe Glines

AutoHotkey / Automation Expert


Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. 01 01 Joe Glines: Hi. My name is Joe Blinds E. And I am recording this video on auto hockey and basically to intercourse in how to use on a hockey. I want to give a little background about myself. So I'm not a programmer. I've been using out of hockey for about nine years. I'd say now, somewhere in there. And, uh, I think I'm uniquely qualified to present this to you because I have worked through it from a non programmers perspective. And so what I presented here is gonna be a lot of programming, but it's it's coming from someone that's like you that hasn't actually done necessarily programming before or not a hockey. So it's a real intro. Course it. We're gonna find ways to work smarter, not harder. That's my whole goal. Auto hockey is a means to its ends. I I love it because it's simple to learn easy to use, but sometimes I use other tools. But but for this video and this course, we're going to learn how to use on a hockey, so I hope you appreciate it. You can find me it over the automate er dot com. The dash automate er dot com and I have a lot of free videos there. This is going to be much more focused of an intro course and the process and flow on how to go over it. So I hope enjoy it. Thanks. 2. 01 02 RPA vs AI: So before we get started deep diving into auto hockey, I want to talk a little about what auto hockey is on what it isn't. So when you think about our p A and R P A stands for robotics process automation, I really hate that term. Makes everyone think of robots. We're not dealing with robots, but software in itself could be considered a robot. So what I do is I throw in the virtual. When you think of virtual robots, it makes a lot more sense. It's not real robots, but it's basically something sitting on your computer that is going to interact with another program. And there is a spectrum here where the RPI assisted. That means it. Ah, human is still usually involved versus the unassisted, where humans not involved. And in auto hockey, where you were in one of these two areas, more often than not, when I'm using it, I'm in the assisted mode, for his honesty is that is the basic stands by itself. And then there's the AI and machine learning type stuff, and in those, it's, ah, very unstructured data. It's not things now migrated. Actually, Will I let a webinar on, um, neural networks, which is, is in that kind of realm, but we're not touching it in this in this course, because this is just to introduce talky and internal automation. This top part here notices, says Trigger based or the R P. A. Assisted usually means we're going to either hit a hot key or use a gooey or something. And so it's not gonna act on its own right. We're gonna tell it to go ahead and run the rules. Based this, this is when it's unassisted. You have to have some logic in there, which we can definitely do without a hot key. It's not that hard to do it, but more often than not, we're going to play in the assisted area. This one, the the I stuff the data itself. Notice both of these are structured data. This one's very structure to this one has to be structures. Well, this one's unstructured data, and it's frankly, it's a pain to deal with. So I have a background in data science as to be a data scientist for three years, and I'm doing some machine learning stuff and things like that where it's it's processing data, huge amounts of data. It's not necessarily something you typically do without a hockey, and so we're not going to touching that. The other thing I want distinguish is auto hockey is a desktop automation tool, not a server or cloud based automation tools. Confuses a lot of people when you start talking about automation and explain what you're doing. And specifically, of course, auto hockey is built for running on Windows. So I've used on Windows XP, Windows seven, Windows eight, Windows 10 and it works, for the most part, works equally across all of them. There's some subtle differences that maybe we'll talk to, but from this part everything is Windows seven and 10 and not many things have changed since. And so for the most part, we shouldn't see any big problems with that. So hopefully that explains a bit about automation. My whole thing is I want I want to get to where I'm automating my work and, of course, my daily life as well. But I don't really care about the type of tools and terminology, right? It's about what in this offer do for me. So here we go. Thanks 3. 01 03 Why should I care about ahk: Hey, so before we get too much into actually programming out of hot key, I want explain. You know what auto hockey is, why we should care about it. What can it do? And right here we're gonna talk about some of the cool things it can do. So honestly, I love out of hockey, but it's a means to an end. So I don't really care necessarily what tool I'm using along with saving you time and allows me to work smarter, not harder. And so why am I picking to do this? A lot of hockey one is there is no course on this. And it's an amazing tool. I call it the Swiss Army knife for Windows. Right, So it only works in a Windows environment, but it allows so many things. I have a list here, and part of this is just teasers because some of these things are pretty advanced that we're not gonna get into them in this course. But I had to have this course in order to have in advance course, so I wanted to get this one done. But there's a thing called the windows a p I. And that's basically a programming interface where you can interact with it so virtually anything in Windows, any of the settings, all the things you want to do, like, let's say, adjust your desktop or detect how big your desktop is, or the the user settings where the time settings or stuff in your registry, right? All these things you can access with the windows a p I, and configure things like there's no tomorrow, so it's it's pretty amazing. There's things called hot keys and remapping of keys. And so we're going. We're going to go into those air really, really helpful. Their low hanging fruit. You can pick those things up in the second. Usually it will trigger an event or something. Eso or fix a program that could adapt it. What your needs are hot strings actually have you Timmy course on heartstrings. Jackie stuck and I have a course on that and I'm gonna touch on him. And here. But because I have it so deeply covered, the other one, we're not going to dive reel deeply into them. But they are. To me. They're the lowest hanging fruit of how you can work smarter, not harder, right away. You can also manipulate files and folders. So if you have too often like backup files or move files in a certain way or select certain files and then move them, it's a It's a great tool for that. It's very easy and intuitive. You can programmatically have access to your clipboard, so anything you can have on the screen, you can automatically. Basically, you can either send a mouse key stroke or whatever, but copied to the clipboard, manipulate what's in it and then possibly, you know, output it to whatever window you want or to a file or whatever you want. There's many, many ways to connect to programs that you currently interact with The very 1st 11 of my favorites, is working with calm, the Microsoft component object model in programs like Excel Inward and Outlook and Power Point right and a lot of other programs was to even SPS s I was using. It has a calm backbone, which allows you to programmatically access it in do things to the program. Lightning fast, highly reliable, very easy. Once you get used to how to code in it, very easy to do the the other one which I thought I had a list here, but it I took it off because it's part of Web scraping is you. Can you can do. You can automate i e. With calm, and that allows you to scrape data or to fill in data on a form right. So either way, it's a great way. It's a great skill to have in your tool scent of being able to do stuff Then. Then there's things like connecting to control. So older tools not like word, which is what I have opened here with the ribbon. But other tools that you that are not quite legacy, but they're a bit older that don't have the ribbon in them. They have controls in them, and even even the ribbon has some controls you can access. But that's one way to programmatically access it. Then there's the windows send message and post messages, and that can programmatically interact with with programs. DLL calls is another way. It's a little more sophisticated, but you can do that. And then when we get down to the bare when you can't do it, the quote unquote smart way you can send keystrokes and you can send mouse clips, clicks, and so just depending on what you're doing, I start usually at the top, and here we com and see if I can you automate it that way. And if not, I will end up sending keystrokes or mouse clicks. If I can't do it from any of these other pressures in between on, then there's things with text, right? Like if you want to strip off the first part or trim white space or get deep dive into regular expressions I have. I have, I think, around eight or so videos on my site talking about rail expressions without a hockey, Maybe at some point I'm making me course on it because they're amazingly powerful. Once you understand it's pattern recognition. When you're looking for things, it's a super helpful. You can also, this is amazing. When connected. Web service AP eyes So earlier, I mentioned the Windows AP. I Will Web service AP eyes. Those air basically tools that people have a server online somewhere that you can connect to and programmatically send queries to it and return the data you want. And a lot of vendors have tools out there now that are free to use. Usually not always, but usually sometimes a charge you just for the access. Sometimes it's per transaction and what not? But there are literally I think it was over 20,000 that I had seen the last one and shirts a lot higher than that by now of different services out there. And so I've connected to dozens from Google itself to yelp. Uh, well, you name it. I mean, there's so many FBI's in because that first part, they're free and it's lightning fast compared to doing Web scraping or some other sources so and the data doesn't change, there's big advantages to that. Then there's creating gullies. There's another big one where you create you build your own tool, right with auto hockey and building buoys. Guizar a bit different and we're not going to cover them in this tutorial either. But they are great, and it will cover basic things like input boxer message box. But creating a gooey a simple gooey isn't that hard. It's You could do some advanced stuff with him, though, but buoys themselves are are pretty tricky. So anyway, this is why I mean the big reason gets back to us. You have work to Dio, and all the things I just mentioned are different approaches. And there's probably two dozen mawr that I should have mentioned here of ways that you could do stuff with auto hockey, that the types of things you can dio that could just save you a ton of time. So this is why I thought it was critical to get this core training down. And then I'll make an advanced course later getting into using calm and sending Diello calls with also with the post messages and controls and things like that. But without this fundamental entry level, I couldn't do the other one. I felt like people would be saying like I don't know how to do that And so I want to get this one done So anyway. 4. 01 04 What Is AutoHotkey: What is auto hockey? It's a scripting language tool that was created by Chris Mallet. Chris was a developer for auto it, and so auto hockey's is basically a fork of it. Back in 2003 he had some directions. He thought it should go. The auto It community decided that they didn't want to go that direction. And so he created this. And if it's a wonderful thing, he did, because after that auto, it became no longer open. Source. It's closed source. You don't have to pay for it, but you can't just distribute it without doing some other stuff. There are other tools out there for doing both desktop automation and server based automation and, like automation anywhere you y path, blue prism, all three of those They I think at least two of them offer a free license version two to a minimum use, but many of them cost $10,000 per license. And so for every app or they call it bought robot that you create, you have to have a separate license. And then also if you have ah, you know, if you have one for the development, you can. You have to have one for both development and then for your actual live implementation. So for one baht, that's like 20 grand. So, as you can see, it's, ah, the price wise. It's great. With auto hockey, right? It's free. You can't sell the quote unquote auto hockey script. It's the source code. But if you compile the script, not a hockey or you share your your your scripts with other people, that's no problem at all. I do want to emphasize here, though both directions. They both you I automation, automation, they wear you. I path Blue Prism, all of those air gooey based until you have dragon drop things. Now that was done purposely to try to make it easier for people to pick up into you so people can come in and write a script like we'll have a program or come in here and lay it out. And I shouldn't say program because not programmers there. They're much more understanding what the process of things. And so they come in and they lay out how the script's gonna work. And then the idea is that people will stay behind. I'm sorry, people at the company that they've developed it at one of them will be dedicated to keeping it updated than tweaking it. Having said that, it usually doesn't happen, right. They end up happen toe higher, out back to the original copy. That did it because not many people in the office actually picked this up. So, yes, the coating programming side of things takes a little longer than just using a gooey. However, once you get used to it, I find it much, much faster. When I looked at other things compared to, like, automation anywhere or you, I path I can do stuff on auto hockey and second swears for that. It takes you can take a while. Of course, it depends on how much of a library have and what Not as well. The scripts themselves are text files, and so you can open them in note pad or anything that I read a text file. I'm gonna demonstrate here in a couple minutes. The editors will use after we installed it can be run without being installed so you can actually have executed ball like on a thumb drive and then launch it from there. But it is easy. You can right click and compile it, and so will demonstrate that here in a minute. But that's that's the gist of what auto hockey is. It's a tiny file itself. It's, I think, about a make and 1/2 super small and then each of your scripts, depending on how many lines they are, they generally speaking, they're still under a Meg, right? I don't think I have any other over Meg, so they're very small lightweight. The thing is, for the most part, auto hot key. It has some core stuff itself, but it's really leveraging a lot of stuff built into windows through that windows. AP I So a lot of the Gu Ys u use the list boxes, the tree views. Those are all actually leveraging the windows a P I. And so it doesn't have this big overhead that other programs might have. Python. I know it can be much larger and also python when you install it in. Other scripting languages like that don't necessarily come with the core, and you have to download all these libraries you'll definitely be working with. Libraries are hunky at some point, but it's not nearly assed frequent oven issue as it is with some other languages. Cheers 5. 01 05 Installing AHK: All right, so now we're gonna download and install auto Hot key. The first thing I recommend doing is even though we're gonna end up this download, let me just show you how to navigate to it. So we're going to go to their main website. I know how you dot com you can click download, and here I'm gonna go and click other version set of down the current version because I want to show you something else in this page. This one, this is actually the if you had downloaded from the first page, this is what you would get this download a hot he got zip this file. Let's go ahead and download. It will save it my desktop, and then we'll open it when it's done. Opened the screen. So just so you can peek inside here thes air the various files that after you've installed on a hockey, this is what would be there. Now when you actually go through the installation process, it's configuring a few other things. But if you're gonna run it through from a from a thumb drive, you'll want to copy all of these. Extract him from the zip file and put him into a A folder. I prefer a folder, but put him onto your thumb drive and then you contract and drop things from your thumb on your thumb. Drive on to execute a bles this Unicode 32. So you 32 said the U 64. This is the one typically that I use and notice. It's not even a Meg right. The 64 bit one is is a little bit over make, but this one is under a Meg, and so anyway, so we won't worry about that. I can close that now. Let's download the auto hockey installer, and so we'll just talent. Wherever you want to go to my desktop, I'm gonna click on it, and it's gonna launch it to run here. Now there's two options you can do an express insulation, which I don't recommend. This installs a 64 bit. I prefer the Unicode 32 bit. The biggest reason why there's two reasons the Unicode over and see 32 bit right? That's where sometimes you'll have unique characters that are Unicode, you know, like the till day over the end and whatnot in and or there's a lot of ah Emojis now is wealth that are included in Unicode and not an ANSI. And so I recommend the into 32 bit that the reason why I recommend the 30 split over 64 bit is because if you compile your script in the 64 bit and run it another computer, even though yours is 64 bit, if you give to someone else and they're running 32 bit, they can't run it. And so that's the biggest reason why that and it just really doesn't matter. So I I'd go with this one. Now it's gonna default Install to here, which is perfectly fine. Let's go. You know, I'll just go. I normally start somewhere else. But let's just keep this simple, right, so we'll go next. Now, the options. I keep all the default options, we're not gonna worry about this. Like I said, this isn't the advanced course in auto hockey. Just no leave. These three checked in this one unchecked will be fine. Install. And now Ban is done. Didn't even take a second. Um, you can say I don't know what that does. Oh, I'm sorry. This is the changes okay. I thought was saying view changes that. I was saying it was going to show you in the Scripture. But the view tutorial, Renato Hot Key, which really won't to anything. But we're gonna go ahead and exit. And so that's basically how you install auto hockey. In a moment here, we'll get into picking an editor and then started writing our scripts. Thank you. 6. 01 06 AutoHotkey IDEs: all right, So now we're moving on to an I D. E, which is also known as an integrated development environment slash editors. So the editors these air things basically, how you're gonna edit your auto hockey code? There are three main ones you can you can use. Note pad. I highly recommend you don't just use note pad because there's no intel a sense. There's no assisted and typing. There's no color coding, so we're gonna walk through installing one of them, and I want to mention to other so auto hockey studio or HK studio. It's written by May strength. He's actually a friend of mine, and we do a lot of work together. And he wrote the entire thing in auto hot Key. And it's particularly written four auto hockey, so that is the one by default. I highly recommend it. It takes a little getting used to. There's not as many menu buttons and items on it. It's incredibly functional, and I have, by the way, I have 36 training videos on my side as well, a six deep dives into how to use the tool. So there's a lot of documentation on how to use the tool on my side. The biggest thing I must say is ult M is your friend. It brings up the Army searching. That's how you can find things. Site for Auto Hot key. It's by thinks I use that one. For years, I haven't a link to the install file here and that when I also I have 18 tutorial videos, slash training videos on how to customise sites, and you can go check them out on my site here. My site S I t. Instead of a C i t. Anyway, so that's hypertensive site C i T. And it's a great tool. The biggest, I think I'd say, if you actually air programming in a lot of different languages, Site is a great tool because I have over 80 different until a sense. Languages that help me if I am using python or let's see like XML or HTML and SPS s and any files and you name it like you can pop it open on pearl and whatever, right? So I play a lot of them. I don't nestle program in them and I play in them. And having that intelligence is really helpful. No pad plus plus is also I haven't installed it and used it for auto hockey. I've used no pad plus plus for other software, but it's a solid editor, and any of these three are great ones to use. I'm going to demonstrate installing theater hockey studio because that's the one that I'm gonna be using in all my tutorials on. So let's go ahead, and we're gonna click this link. It's gonna bring us in a second to ah, the download page, um, for here for a mystery. So, mr dot com And here you can see down the links the easiest way And let's just jump right into it, right, cause you can get it from get, huh? But this link right here, this is the actual and it's, I think, like 8000 lines long, right? It doesn't treaty in this one, but let's copy it all. I'm gonna copy it. You know what? Let's do it. Just like you doing. So, uh, so actually can see Here it is Age k file. So if you can I Oh, you know what? Let me Let me see if I can just right click saving gas. Let's do that. So here we go to save because what, you want to put it somewhere on your computer? Minus under my route. See? So I have it here under on hockey studios. Like I have it twice. Let's go ahead and do This is the older version. So I'm not using it and I'm gonna other hadn't save it right here. Now I'm gonna show in folder. Now, when I run it, I'm gonna double click it. You should. Since you've installed on a hockey, you should have this icon where this little h in here that's telling you that's That's an auto hockey file, right? The file properties have been associated to auto hockey, so when I double click, it is gonna launch it, and my version is gonna look a little different. Actually, you know what? No, cause I lost here. It's local. It's funny. Opened up my main one. Let me hit new. So this is by default. This is the new settings in auto hockey studio, HK studio, and this is what it looks like and you can see them pretty intel a sense. I'm not going to go through all the customization here, but you know if there is no toolbar, right? And that's the biggest thing that people I hear complain about versus site. Let me open site for you. This is the site, and here you can see your toolbar buttons for doing a couple things. But again, I have a ton of videos on how to use on a hunky studio, so I don't want to get caught up in that. There are, you know, other ones, and you could open this same file. Let's see if I open what I want to demonstrate here. So it's open note. Pad the straight up plane windows note pad and I'm a drag and drop this into note pad and notice. So see how this looks here, right? It does not look fancy at all, and it it's kind of hard to read if we drag that into I dragged it in the studio. You can see how the color coding helps. So this is why I There's a lot of other reasons, but for just for the color coding alone, it really helps you make sure you don't screw up and do something a silly mistake. So that's how to download. Install the main three editors Again, I recommend HQ studio Ah, lot over the other two. But site is a solid one, and I know from talking to other people know pet plus plus is great as well. 7. 02 01 Joe's Crazy Taskbar on Right: So as I mentioned before, this course is gonna be about automating using on our hockey and teaching how these are the hunky. But I'm gonna pepper Ann's mother tips and advice and my 1st 1 which, if you're looking at my task bar here, this is my task bar. Most people have a task part, probably at the bottom or maybe the top. And I find this very inefficient because you have much wider of screens and you do tall and then also when they're here, especially when they start stacking, you can't see anything. When you move it up to the side like this, you can get a lot more in here. And actually, if you have more than more than will fit, it will double up and you can see both. But also I can see a lot of the descriptions of it. And the other thing I want to point out as my system tray is down here and I've gotten rid of the clock, which, actually this is my, uh, starter clock built without a hot key. So it's my start button you, and it's convenient because I don't have to have my clock down here taking up space. So and these are all shortcuts to folders. So I just want to explain this because it confuses a lot of people. I highly recommend doing it. The only thing I must say is, don't don't just try it for an hour because you will hate me for the first hour, because every time you go to hit start you're gonna go to the wrong place. But once you get used to having your start menu up here, it's much easier. You can see a lot more of the screen, a lot more of the stuff you need, and it's just a great happened to get into. So having said that, we're gonna jump in here in this next video building your first script. 8. 02 02 ahk Basics Your 1st Script: All right, so we're ready. Just great. Our first auto hockey script. One of the easiest ways to create a script is to be an explorer and right click and say new . And since you have installed on a hot key, there should be out of hunky script right here. When we click that it creates a default script here. It's called New on A Hockey Scripts changes to test one because we're gonna have a test to here in a minute. And now I'm gonna right click and edit this. And even though we've hopefully you've installed on a hockey studio, if not, maybe one of the other enters. But by default it might be note pad, which you can see. Yeah, you can read this text, but it's it's not easy to read, So I like to First thing I do is change the default in studio to tell it to use on a hockey studio. So let's do that. So I'm gonna launch out of the studio. I could well, short cut in my quick launch two of our area, and so I'm gonna launch it. And what we want to do is I'm gonna hit all to em. Now I m brings up the Omni search window and where it's gonna start searching for a default editor. So see, right here, set as default editor When I click that now it's gonna say, Auto hockey studios, your default editor. Great. Thank you. And even when I close this now, when I right click any dot HK script and say edit script, it's gonna pull up studio instead of a note pad. So that's the 1st 1 Now site. When you do it the first time you run site, it'll ask you if you want it to be the default editor, I would if you're running site, I would definitely say yes. And I assume no pad plus plus has a similar process for that. If not, you can go into your registry. Um, change it, which is kind of tricky, so I wouldn't miss it. Take that approach. You can change the file associations as well, but it has to be edit, not run. So anyway, as you can see here, there are some default values in your code. I'm gonna delete somebody's this. No environment. This is This is good that it's it's kind of Vince. I'll knock again to the why, but I would definitely leave that one. These other ones, usually I take these out. I don't use those. However, let's go back into my little church. Eat here. The one and I don't understand why this is not a default, but the single instance force Look, it brought in my B. How nice. Um, that will tell on a hot key that, Hey, if this script is already running, when I launch it, don't run a second version. Keep this version running. And so 99 point, I'd say, like 5% of the scripts that I create. I only want one version of them. I don't want multiple versions of him running. So this is something that to me should be the default and everything you're doing, and you always want to have it in there. It's just it's something that you really want to have in your default so force. So, for lack of better term, what's at a time? So those are the two default settings that I recommend you have in there. There are other ones, and maybe we'll add a few later on. But this right now these are the ones is the core. Or make sure you have those in there. So we've set the defaults. Then we're gonna run, Save an edit descript. So let's let's say we want to do a message box. And so we're going to start typing here message and see how studio is assisting you. So message box and now inst in auto hot key. If you're just using text, you don't have to put in any sort of quotes or percents or anything. So I'll say hello world. And now in Hockey Street as well I can hit alter our and it will run it. Or if I, if I do the all TEM and type run, you'll see right here run. That was the altar. That's the hot key that's built in the studio for doing it. I can also choose if I want to run it as different different versions of on a hockey. But I'm gonna hit altar and it's gonna run it. And here is my message box. Hello, world, right? That's how easy it is. Not a hockey right. It technically could remove these two other lines. So would be one line Hello world we're done. Um but when I hit OK, now notice also this green h here. Right, So that's test one. It's running when I hit, OK, Because there's nothing else in the script. It's gonna exit out of it. So when I hit OK, watch the bottom. Right. So there goes that disappeared, right? Let me introduce you gonna launch it and you'll notice when I launch it, It shows up down here There's the script that showing that the script is running And when I hit OK, it closes. So because we don't have any hot keys or anything else that keeps the script running, we could tell the state persistent. Then it would stay running. But right now we would We don't want that eso in orderto to make a change so we can change . Hello, world. How are you? Question mark now. Now, if I didn't say this, of course, if I just go to run it, um Well, actually studio, I forgot Studio is smart enough to say Hey, you know what? We're going to save this thing before we run it. Because why would you want to run something you haven't saved yet? So it will automatically do what the other tools don't do that. At least I don't know about no pet plus plus, but site and note pad don't do that on their own. So you always want to save it and then or if you're in studio, have Teoh. And so it's It's not currently running right now, but let's say it was running and I want to demonstrate this. So the little icon down here I can right click this and I have some interesting options, right? There's an edit, this script. So let's let's go ahead and close studio now. If I right click on this and say, Edit the script, it is gonna pull up studio and then focus on that script. So it's a great, easy way. If you have a script running and you want to edit it, you can jump into it that way. You can also tell it to reload this script, and there's one message box. What I should do is have a 2nd 1 here, but it doesn't matter when I would reload. You're gonna watch this thing flash, right? So I'm gonna reload the script and I just reloaded it and put back up that same message box . So that's another way that when you're doing stuff, you want to save it and reload it. Just remember, because if you don't save it, most of tools don't automatically, you know, save for you. And then when you, um if you don't reload it, it doesn't put it back into memory. So you got to make sure you save and reload, say, even reload. Um, the next part I want to demonstrate is compiling scripts. So let's let's go ahead and I'll just hit the okay. It will exit out of it. So now it's no longer running. Let's say I want to share. I have, I've written something. I'm going to give it to another person that's running a Windows environment. I can come and explore here, and I can right click and say, compile script. And so it will automatically create and execute Herbal in the same folder, and this will run. It has what it needs to run on the other computer. So a lot of other languages, it's much harder to compile scripts and can be a pain. And there are some little nuances in advance stuff with this But for the most part, it's that easy. If you're let me delete this. If you're in studio and you want to compile it, you can do all Tim and say compile and actually can choose which version you do. But this will do virtually the same thing here, so it creates it here. The other thing I'd like to point out is notice. My actual script is just one kilobyte. The compiled version is you know it's closer to a Meg, and that's because it's taking the actual auto hockey execute Herbal and and then taking this test underscore one script and merging them together basically and then saying, Give me everything I need to make this an executed And that's why the file size goes up. So, uh, let's go back to here. Um, way talked to dump. Okay, so there was the message box compiling scripts and some basic beat debug stuff. Using the message box like I showed you here is a great way when you're working with stuff to stop the script so you can see what's going on. But there are two others very, very simple. One that I wanted to demonstrate the script has to be running for it. So, you know, I can do the No one was here. Yeah, I can actually don't know. Command, right. Click here. No. So it's notice The execute herbal doesn't have the other options here. Simon, exit out of that. But I'm gonna launch this one. And now it's running. That's by the way. I don't think I mentioned you can double click the script in logic. You could highlight and hit Enter return and it would launch it. But in here, I can, um I can double click the script. And this is gonna pull up this menu where I can save you. Lines must recently executed, which is I think it was already there. It's a default. And here you can see it was its online three, and it was waiting for more. But that where it is, and then if we had a variable, it would it would show it in here. And we're going to cover variables here and a couple more things. But these air to really simple, easy ways. Let's say you had had tried to store of value in a variable in the and for some reason in your message box or your script. It's not showing it. And you wonder like a something going on here. A super super easy way to get it is just to say, Hey, double click here and let me see the the variables and their contents And it's a great, easy way toe to see what what data is in there. The other one is to, um, present the value in a message box or a tool tip or something else. We're gonna cover those in a while here. So that's it. Hope that was simple. And we're gonna get moving on here. It's more somewhat advanced stuff. Thank you. 9. 03 01 Multiple vs Single Scripts: So the next topic we're gonna cover is whether you should have your scripts in multiple versus a single script and the sounds kind of confusing. Because why in the world would you have multiple scripts if you can have a single script? E and unfortunately, is no riel? Correct answer. The answer is, it depends on you know what you're doing and everything, um, multiple scripts when I say that. So let's let's go ahead and get back in here now, where I have two scripts here and there. Very basic. I'm gonna right click on this one. Say that it is gonna pop it open studio here So this winter says Hello, Let me come back then, right? Click on this one. Stay at it. And now this is the 2nd 1 gets a world, right? So and over here, we can see. Here's the 1st 1 in 2nd 1 right? So there's hello in World and Aiken run right now. Look down in my system tray. There's there's no Green Ages anywhere, So nothing is no auto hockey script that you can tell us running, and I'm gonna run it so that so actually launched the 2nd 1 first, it doesn't matter, right? And then I'm gonna launch the 1st 1 and notice. Now we have to Green Ages. Here's the 2nd 1 Here's the 1st 1 and they're both currently running. This allows me. The one thing it does allow you to do is to have more than one message box visible at a given time. Now, this isn't something I would necessarily want to do, but it has to do with, uh, the amount of threads you can have running. And auto hockey isn't really a multi threading language. You can use some set timers, and we will cover that a bit later. But for the most part, it's a linear process. And if you have one message box pop up, that's going to stop your script from doing stuff. And so if you do have things that you want to be running concurrently, that's one reason why you would separate them and you would have like I have one, like I have this little screen clipping till I wrote, and this is an honor hockey, and it's always running. I wouldn't want that to not run if I had a message box up right So I purposely broke this one out in a separate script. The other reason, actually, why I broke this one out at the beginning I had. It is part of my main script, which, by the way, if this is this Joe here, I change the name of it. Now I'll cover that later. How to do that? But it is. If we go to the bottom here, it's over 2000 lines long, and when I had that screen clipping script in with it, it was I forget how long that one is. But it's maybe let's say it's 3000. It's 1000 itself, or maybe 800. And it was interwoven in this main script, which it all worked. Fine, because it it did what I wanted. Having said that, a couple people, you know, I would be working and people go, Okay, that's really cool. I'd like to have that script, and then I would have to go through my main script and bring out part re under disentangle each each of the little bits of it. And it was a lot of work. And so, um, I kept that one separate. If we actually go here and I go to the task menu our manager and stay start eyes here. You can see there's 123 There's three right there when I have the help file open. But then two of them are the ones that you guys already saw, right? But look at here. So here there's 12345 Mawr auto hockey strips running. But also note the size right there. They're not big. I mean, I have 64 gigs around on my computer, one point six megs. Miriam is nothing in space wise. So the easiest thing to explain is as to why you put them all in one vs together. I have a main one, which is the vast majority of the stuff of hot strings and hot keys, which will cover later. But I have other ones like this start menu I mentioned. That's one of those it's running right now. I have one. That's a spell check that's running right now and then the screen clipping. I have one to toggle. It'll Todd's on my program in any programming. When I click on it and we'll throw it to the other monitor and the so it has to do with compartmentalizing. Also about the threading of if you if you wanted to be able to run independently from other things, and so that's the easiest way to explain it. I didn't want to note that. You can have. You can see here and this one. I change the icon and a lot of the other ones. You don't see them here because I have said, Don't even display an icon because I just want them running all the time And I don't worry about having icon. So let me exit out here except here. So that's the overall dilemma of Do you want single versus multiple scripts, and when you first start scripting, it's It's tough you don't really know. So don't don't worry too much about it. For the most part, stick with one of the beginning, and then as you go on and you say, Hey, I'm gonna always have this thing running Maybe that should be its own thing. All right, so you next time 10. 03 02 Directives Commands and Functions: okay. And this aspirin I want to talk to you about directives, commands and functions. E. And we actually have a couple examples here of directives. This pound sign no and envy in pound sign single Instance Those air, both directives. And you can think of directives. There's actually two types of directives. There are positional in non positional, the non positional ones. It doesn't matter where in the script they are, whether the top of the bottom or anywhere in there, they affect the entire script. Think of it was like a setting for your script, whereas the positional ones affect the particular parts that you tell them to effect. So on example of ah positional one was put in the pound sign the albeit a pound with the win active was two when active. Okay, So inactive. And then it could be you put in the name of the thing. So we'll say what you're saying that this would be the window title and then to turn it back off, you'd say when active without any parameters. So what? Hoops. So whatever is done in here in between the 1st 1 active in the end one. This is gonna be one section and then if I had, let's say I had another one. I'm gonna copy all this and I'm gonna put this. Let's just pretend it's HK studio. That's not what this, but you get the idea right. I think it is case sensitive and I should help not to be. But things done in the script and here would affect Onley. Note pad and things done in here would affect only things in studio so you could make it context sensitive. Like if you have a given hot Kira hot string when you type something, it'll act a certain way in one program and not another. So those are the positional type of directives. And then I mentioned commands and functions so commands. We demonstrated a command earlier. A message box is a command, and there basically use commas to delineate them. You can see here the options right there, kind of the old style. There's a newer style out which are functions in. Actually, you know, let's do this instead of using message box. Let's do stir, split, stir what? We're going to spring split for the for the command. Now here, it's gonna say I put array, call ir. You know the input var is going to be my bar and then delimit er, zo. I would have that as a comma. Let's say on that's fine. So this is an example of a command now the the thing I don't like about commands they work , find their very fast. They work fine, but you can't have. You can't combined more than one in one line. And so at the beginning, it's not a big deal. But once you get a lot more, advanced functions are really fun. And there's actually a function comparison comparable. Forster split for strings, but which is stir split. So stir split the string. Which is gonna be, I think that's no a race. What were to say my var and then the delimit er again, Let's do a comma now. The difference here is we're gonna sign it. So if I want to store it in the array, that's how I would assign it a very long We're gonna cover variables here shortly. But what's really cool about these is I can actually stack these multiple times in one line , and so it could be very efficient. They're super fast. They're really flexible. We're going to cover how to use functions. There's a ton of built in functions in on a hot key that you can use and you can write your own. So there are a lot of fun there, very flexible. But I want to cover their basic of those three things that the directives again or kind of like settings and adjust your script and then the commands and functions, or how you execute things. 11. 03 03 Auto Execute: earlier, I showed you how toe have multiples scripts, combining them into one. What I should have. Also somewhere in here, add is that there is such a thing called on auto execute section in a hot in hockey and it's at the top of the code. Here is I've adjusted. Here's the oil you can go look about. You want to read more about it, but basically at the very top your code auto, he starts running, and any time it runs into any of the following here. So there's a return. An exit command. Ah, hot key. Ah, hot string or a label. After that, things won't actually execute unless you trigger it somehow am. Let's just demonstrate this because it's it's a little confusing usually doesn't come up for people until they start merging things into one script. And sometimes you'll find that you're trying to run something, and you're like, Hey, I put at the top of my script and it works, and then I move it down lower in. The scripting doesn't work. What's going on here? It's usually this auto execute section. So if I run this right now, of course, this message box works just fine, right? Because there's nothing in front of it. However, let's say I put in hot string since two Jorg period. Um, now, when I run this, I just hit my I just launched it. It didn't execute that message box. Why is that? Because just envision, there is a return. When? When I demonstrated earlier this, I think you should understand why this doesn't work, right? The scripts are here, comes down, hits this return, stops processing, right? It can't get to this. Well, this is the same. Virtually the same thing as send on, then sending that right with the return after the same thing with a hot key. So let me climate these three out, and if we put in control control T message box high. So I'm again. I'm gonna run this and no message box and I hit control T It works fine, but notice it doesn't go forward. Right? Why is that? Well, that is basically again. That is just like this, right? It treats that return there. It's an implied return at the end of the hot key. And so when you look at it this way, you can see why it doesn't work. And if we just move this thing above it and run it, we see our message box right? And then I can still hit the control t to do the 2nd 1 So the same thing with a label, a label, it it looks very somewhere toe a hot string that is a label which we use with ghosts abs, which we cover later. But just remember, if you run into something where you're like, Hey, this thing doesn't launch it all or it only runs when it's in a certain spot most of time. That's an auto Execs section type thing and just study the structure of what you're doing. And, you know, the victim has put a hot can to trigger it, and then usually you're fine or break it out in its own script. And that way, don't worry about it. 12. 03 04 Referncing Variables: all right. Lastly, in this section I want to talk to you about referencing variables. And this is ah, common form of confusion for a lot of people. Is that Let's first, we're gonna store a variable. So let's just call it bar, and we're going to start with the colon equals and with say, hello world is the value we're gonna push into that variable var ta are. So right now, I have stored that in too far. Now, if I wanted to see that Mike, I showed you one earlier. I can save this. I should have toe, um, do a message box with far in this. Run it and Oh, look at that. So silly me. That's funny. I, um I just did. Ah, silly mistake. Here. I pushed up the text of our and so there's two ways that you can reference variables. One is to ramp the variable in percent signs like this. So when I know when I run it, it is gonna push in instead of the text of our it pushes in the value that's in that variable. Right? So now we did that successfully. There's another way, though, which is the way I typically use because just for me it's a little cleaner to look at it, it's a little more confusing, but you put a percent sign after the end of your like your commander inside your function and then everything to the right of it is an expression. And so in this case, when I save it and run it notice there's a space in between the percent sign and bar. So it does the same thing, right? If we wanted tohave Hello world, Let's say how are you after this? Then we have to put quotes because we're inside of an expression. So and of course I want to space in here right, because otherwise it puts it right next to it. So I'm gonna run this again in the hello world. How are you? Right, And that worked. So that's one way to do it. And I could have done it the same thing. This is an equivalent, and both are correct. So don't worry. As far as well, Which one is quote unquote right and wrong? This is going to do the same thing because in this line here, I'm referencing it with the 2% signs, so the message box stays the normal way it is, and this is gonna be text. So when I run this the first time, we're going to see the first version. So that's the 1st 1 And now they came up with the 2nd 1 So they're identical. I've tend to find, especially when I have several variables in it, that this one is easier for me to read and to write, because often will have a lot of variables that I'm trying to reference and just a little bit of text. So this is what you're going to see me for the most part almost always doing, quite always but close to it. And I just want to clarify there's a lot of people get confused. And then there was a little bit of confusion of inside a command in the function. When do you use percent signs or not? And we're gonna tackle those as we go. But I wanted to make it really clear up front because you'll see different things in the forum side if you go to the Hockey Forum, which is a great reference or on stack overflow of how people use them both of them are correct. Just make sure you understand. They're both really doing the same thing. That's just two different approaches for it. It's one of the critiques of people for on a hockey is, um Python is great about They make one way to do things, and it does simplify over time how you do it. But of course, it means everyone has to do things the same way. But it does make it easier where you when you start reading the code, everyone understands it is just one way to do it. All right, cheers. 13. 04 01 HotStrings: all right. In this session, we're gonna cover hot strings. Hot strings are there. The to me, the lowest hanging fruit of being more productive. If I could get everyone to do one thing, it would be using hot strings because they can simplify your life and allow you to be much faster. Everything you're doing. We all have things that we type a lot. Think of them as text expansion. So on your phone, you can have it step where? If you type a couple letters, it will automatically offer you up the word, but But fill it in for you. Or like inward, the auto correct spell checking type things. It will automatically do it for you. And they're super friendly. Easy to use. Hopeful Jackie stuck, and I have you to me course on them. So I'm not gonna go too deep into them in this course. But it's one of the most important things I think that you can get to learn. So I want to make sure at least mention him, and we're going to start off one here. Let's let's make 14 hot strings. And so we start off with two Coghlan's and Then you put in some sort of an abbreviation. So I'm gonna put h s and a period. I like using 2 to 3 letters in the period. It's it's really up to you, which is I clearly I already had the same running here. Let me exit out of this because it did it for me. So H s period and now to more Collins. And then we're gonna type hot strings and I must save this. And now run it. Now I want you notice. One thing here is that even though I don't have a message box in here, there's no gooey that came up. And yet the script is still running, and that's because hot strings keep your script running to keep it persistent and will stay in memory. So as long as you have a hot string or other stuff which will cover later, you don't have to add the directive to tell it to be persistent. So let's go ahead and demonstrate which is what That one little script that popped up there did. So when I type h s period Now, when I hit space notice, it puts in hot strings and includes MySpace there, right so I could do it again and notice how quick it is. It's great hot strings that you can have paragraphs and paragraphs of text replacement. This is literally sending the text the keystrokes so most windows work. Okay, but if you have a lot of text, there's some different approaches to it, and I cover them in that, you know me. Course. Basically one of the simplest ways, as you can copy it to the clipboard and then send Paste in that way, just dumped it all in there. Let's go ahead and cover another type. Let's say we want to have multiply line so new to Coghlan's on Let's just say, um h W period and then it's gonna be hallow. And then let's I want a line break in between or a new line. So that's the tick mark end, and that makes it start a new line. And so hello and then we're gonna put world and save this and reload it. And now when I come back in here to this to note pad and type type H W period. Now watch what happens when I hit space or tab or anything so it dumps him in there for me , right? And it's Ah, it's It's super fast, reliable. And the third thing I wanted to show you is let's say you had an email address because email addresses or or passwords or things like that. Not that you, you know, tell me the uses for passwords because your I T department may not like that, but it's It's a super easy way toe to put in something Toe have is a password. I'm gonna first do it incorrectly to show you why it matters. So let's do J t a period. It's for my email address and that is Joe at the dash. I know made her calm. It's funny cause I don't only type it. I have usually have my other script running, which has, ah, hot key for it are hamstring. So I'm gonna run it and notice also when I come in here and type j t a period space, so see where my cursor is. It left an extra space here, right? Well, if I'm using that to entered into a form or put into an email or something, I probably don't want that space there right or let's say was a password, that space would screw things up. So what? And the other thing I want to point out was noticed. The capitalization right? I don't have to worry about how it's capitalized. So if you have, like the name of a company in this capitalization manners or you need the TM or something after it right, it's great because you can do this once and then it's always consistent. Eso Let's show you how to fix this. So that's easy. Fix for this is if I don't want that space, I put in an O in between here and now and let's let's put, will come in here. Um, so now I'm gonna reload this. And now when I do Jaeggi a period space watch, see where my cursor is? I didn't have that extra space at the end, so it's a simple, easy way. Teoh have have a lot of text. There's there's one other thing. I guess I should show that there are special characters in that hot strings course where you look in the forum to I'm not trying to push my of course, I just It's a lot of stuff and they're involved. So if you get into them, they're really cool. But they are pretty complex. So let's say I wanted to have, um Goodbye, world. Goodbye, world, period. Good bye. Have a cruel world world because I want an exclamation point here and I'm gonna save this and we load it. And now what I want you to notice is when I do GW period space. See, there's no exclamation point of the end, right? There should be an exclamation point right here after world and it didn't come through. There's That's because the exclamation point is a special key in auto hockey. And there's two ways to handle that. One is to wrap it with curly braces. So when I reload this and run it now, it sends it in there the other way. So I'm gonna undo, and I'm gonna put our here that tells it to send the raw text. So now when I do it also so either way, work, they work fine. There are other special characters, like the plus command, which is a shift. The pound sign is a windows key. There are other he strokes that. But like I said, go check out that other course or look at the forum under hot strings and you can find all the nitty gritty. But this is by far one of the lowest hanging fruit. If you want to be more productive today in minutes, right, you could start these. The other thing I want to say is find a pattern. I have hundreds of hot strings running all the time and find a pattern. So if you use like email addresses for other people other than myself, because I have, like, a dozen email addresses but for other people I like to put in their initials. So, like, for Jackie Stuck, the guy that wrote the hockey hot strings Coursen you to me for his email address, I'll put Js for Jackie stuck and then I put a e for email. And so I'll start his with this J S E period. And then so everyone I use their initials mine. If it was, if I was another person j g e period, I would do it like that, right? And then, obviously I put it in the being action could put it right here, but find a pattern for things that you have that use a lot that are similar and will help you remember, because the only problem about hot springs if you don't type him enough, you forget what they are. And then you have to go up and look at him, which defeats the purpose of having something convenient and the tips of your fingers. I tend to add stuff and use a pattern, and then don't add too many one time baby. Step into it. Add 1 to 2 a day at the most in just add a couple, and then it's a lot easier to remember them or do what I did. The first was, I printed them out. I printed amount of little sheet next to me, and for the first like week I would watch them and it helped me remember what they were on . And then after a little time, you start realizing that you don't need that look up anymore, and you can really, really be more productive. All right, cheers 14. 04 02 HotKeys: in this session, we're gonna cover hot keys, which is right after hot strains. It's another really great, easy way to become more efficient. There's a lot of different things you can do with hot keys. One of the biggest uses, though, is just to launch something to launch a Web page, to launch an email to launch a program to run specific things on. So let's do a couple of examples here, and the first thing you have to know there are more modifier keys, but here are the top four. The Windows key is the pound key or the hash key. The control key is this carrot, which is over the six. The altar key is the exclamation represented by the exclamation point, and a plus is the shift key. So let's let's do one. Let's see, let's launch note pad and we're gonna say, Let's say I want to make it worse, the Windows key. So in that case, I'll put Pound and I'll do n and I'm gonna put to Coghlan's here, and I must say, Run, comma, note pad. Dottie exceed now because no pad is it's in the path. I don't have to have its in the Windows path. I don't have to have the full path to the excludable here. If it wasn't in my path, then I would have Teoh include the entire path here without quotes. So I'm gonna run this and now I'm gonna hold down the Windows key. And when I hit n it launched no pad for me, Right? So this is a super easy way to have it Launch programs. Let's say if I wanted it to be where let's say, Windows E groups, Windows E. I'm gonna say, um, run e and let's do joe dot Glines Joe at the Death Eater. I should left my heartstrings running. So when I run actually sorry, I forgot this one. That has to be a little special here. It's a meal to Colon, and that's just ah html type thing. So I'm gonna relaunch this. And now when I hold on the Windows Key and hit E Outlook Oakland Open the other window here , but it sent it, wrote the two with my email address and used my default email client, which also let's say I wanted to navigate to my Web page, which is the automata dot com and http s colon slash slash Now, when I hope on, I can't have actually try to run it here and you should see right here duplicate hot key, right? You can't have a duplicate hockey kids and auto hockey doesn't know what to do about it. Hot strings you can. It will just execute the very last one that the 1st 1 So this should be, Let's say W for Web page. So when I run that now, I'm gonna hit Windows W. And it loads my website, so jumps automatically to it. Right? So if you had a specific file, you could add it as a parameter after this, with the path to the final name, and it would load not just note pad, but that specific file with no pad or word or something like that. The other really cool thing is, let's say let's do some Let's comment thes out just so we don't get confused, let's say comment. Yeah, we'll do window, see window, see. And, um, when I do that, I'm gonna send, um, the semicolon a bunch of Asterix. Oops, right now for auto. And then I'm gonna add a return and return will stop it from continuing on. And you don't need a return on these because they were just one line, This one. I have multiple lines. And so that's why you had to have that send command on a separate line. That's why it's needed. So right now when I run this gotta be launch it. Now, let me actually let me use this. What? Oh, because of the I gotta put a tick mark your there we go. That should. So this will escape the semicolon. And it was just saying, Hey, there's there's nothing here because I had the semicolon and that was in line comment. So now I'm gonna use the windows in the launch note pad. And now when I hit window, see, it sends those keystrokes to whatever active program I have opened. So if I have site open and I hit one to see it does it here, Right. But what I wanted to demonstrate was, let's get these two without overlapping. What's really cool is I can say, hey, remember the directive. So if when active and I'll explain more about this later age, clay Ah e X c up Surprised it didn't show that lister note note pad about dxc. So right now I'm making this context sensitive. So for this window, see, when that happened is gonna do that. And then I'm gonna copy this just cause I'm lazy and you know what? Let's let's do this. Let's put in in here. I want to put him note pad and in here, I might put in site. And this needs to change to I think that's how it's spelled. So relaunch it. And now notice, even though I have window see twice because this went active is present. I have two separate ones. And so let me come back in here and actively one of these and get rid of the Texas. We don't get confused. So now if I'm a note pad and I hit window, see notice it throws in the word note pad that's goes here. But with I'm in sight and I hit window, see, it knows to do something different, and it's it's a small thing. At least it seems like a small thing. But when you realize you don't have to remember different key strokes for different programs, you can tie the computer. Toto look at what program you have active, and then if it's active and you hit the same keystroke to do something different, I think it's a really powerful thing because a lot of times you end up having the same hot key, and yet you don't want you have to remember a different thing. So, like this in line common here is nice because, let's say a note pad. I'm doing one language that really needs just Teoh. Start off. It needs likely if we're doing HTML, it would be some this the like. It's not quite yeah, I did something wrong there, but anyway, you get the idea it would be something like that and then that at the end, maybe that is right. Um so I can have the same hot key. And let's say I was just always using note pad for my HTML stuff, And so when I we run this now, I can use the same thing. And hey, if I'm a note pad and I hit window, see it automatically comments out with the right wrappers for me, I don't have to remember what it is in each language, right? That's you can type program. You guys should tight that users. You can do a lot of different stuff with the win. Active are not just one active, but there's exists and if the user is different and whatnot. But hot keys are really powerful that I could spend a day talking to them about all the intricacies, and I don't want to go too deep on this. But they are an amazing, quick way to do so. You know what? I should show one more the when you want to combine them, you can use the the if it's if it's one of these, you can say Windows. Let's say windows ault, Right, so that would combine. The two are actually I. I used, like control adult so I can put him right together. However, with the AP ski, which is, if you have it on your keyboard, it's between on the right hand side of your keyboard. Between the Alton. See, there's a little box with some lines on it that's called the app ski. Um, when you use it, you have to do it this way, app, ski and let's say C and what I could do. This will say sand So I say this reloaded. And now that's going to hear app ski and see. So that was interesting. Happy and see. Yeah, that should assumed Try it Running something said someone relaunch it ap Scheer I see. And boy did not like that. I don't think it's the plus sign. No trunk. All right. So I paused the video here, and it's funny that I'm making these videos by the way. They're raw. And the point is the rock, cause I'm working through this and I want you to see, you know, some of the troubleshooting and things that happened even for a person who uses it a lot. Right? What I forgot to do was to turn off the context, sensitive of my hot key here. So right now, when I run this on and I have ABS key Andy, it doesn't. It doesn't do anything. It sends a d. But after I do this, that's going to say now, Hey, you know what? Don't try to only pay attention, actually. Could have run it in here and app ski. Andy should theoretically work just fine. It launched it right on. But if I'm back here still because I don't think I really like to get it Still sends the d right. But now I'm gonna say this and we run it. So now I have relaunched this script. Now, even in this program, if I hit AP Ski and be, it'll launch note pad. So that was my bad. It's one of those things, you know, As you work, then stuff. You start looking and then you start work on troubleshooting. Well, what's going on? And I just started looking at my script. I wouldn't got one that I had that I knew worked in something else and it didn't work in here. And I said, Well, wait a minute. I you know, I know that codes, right? And then it just dawned on me if, like, oh, I have these context, sensitive things and I forgot to turn it off. So anyway, um, hot keys are awesome, and you just there's just amazing things you could do with him years 15. 04 04 Remapping Keys: in this session, we're gonna work on remapping keys and if we want mouse clicks, clicks to your left leg, combines click on your mouse so it's very somewhere too hot key. I almost put it in with them. It's kind of like a hot string as well. So the format is, Let's say I wonder for whatever reason, I want to remap the a key to the Beaky. So I must say this in a relaxed script. So now it's running them, allows green and show up. And now I'm gonna I'm gonna hit the A on my keyboard and it sends a V, right? So I'm one. This is a good practical joke to play on somebody. But if you have a certain key that you, um the key combination that you wanted to change or whatever that isn't what you think it should be This is a way you can remap it to a different key or let's say like every time you hit the right control key, you want to send the shift key. So for that, look a little cheat sheet here, Um, I think it's just our control shift. Where to go? Yeah, Control So our ctr l colon And then I think I put the word shift. So let's give it a try. Actually, let's let's write what change into the to the right hold, E Yeah. Lets you see what this does. So I'm gonna relaunch it. I'm gonna hold my right control key and then hit a letter f So that was Here's the F on its own and the right controls keep f So it's basically every map from my right control key. And that's what this this one are here makes it the right control key to basically send the shift key. Or let's say I wanted to have it do the right mountain mouse click. And I think that's yeah. Uh, right, but our button so I don't I don't use the buttons very often. So instead of hitting the it's not gonna pretend to be the shift key, it's gonna be the right mouse button. So now I'm gonna hit my right Control Key. Oh, interesting. So it didn't breakfast rewatch it. It's not what I thought it would. Deal makes he behaves the right mouse button key. I think it's working. I just thought it would bring up the contact sensitive key. Let's try the left button. See if it does anything different. And over that. And now I hit it and look, it did it. It dropped me in there. I'm not sure what the right but was doing. But the left one. I'm gonna click it again in its dropping me in there again. Not that you want to do this, but you know what times you either have. Ah, you know, there's a key that you don't have in your keyboard or that you want to change what the three key combination is. And this is an easy way to do that. Or like I said, it's a fun practical joke just to show someone that when you type something, something else comes out. Um, but that's it. Hope that comes across easy. And that has hopeful Cheers. 16. 04 05 FileSelect and Folder Select: all right. This session, I want to demonstrate both file select in folder Select. So I got a little outline here, So we're gonna start with the first example was to file select file, and I want to do a multi select. So first we need to store the output variable. Let's just call that bar and then options. Um, em, of course I can't see my notes, but I believe in em is for Moya. Multi. Select. So in the first example, I want to do a multi stacked, so I'm gonna put em here. Now. If I wanted to tell it where to start. What, Director To start in, I can put in a path here in on the next variable. So notice I'm in here, right? So that's the next parameter for this command, and I'm gonna leave it as where it is that's gonna choose the default full George running from when it When you don't give it one, it will choose the one that's in, and then the prompt is gonna be the title bar. So I'm I say, select some files because files because this is a multi, and then I'm not going to give it a filter will work on that later here. So I'm gonna run this and notice it jumped to the folder I was in appear. It says selection files. And that's where I was adding that parameter. And then here notice I can select multiple files. Oh, you know, what I didn't do was I didn't, um, put a message box here. There we go. We'll rerun it. Now, when I select a couple files, you're going to see it put those files and it doesn't interesting thing. It puts the entire path to the 1st 1 and then the it leaves out the folder and then gives you the rest of the other ones in that directory. So you have to do a little process and this toe, the person that I think you can loop over them if I remember right on, get them. But as you can see, you can easily select multiple files. Let's let's do the next one here. We're gonna change it, and we're not gonna do multi. But we're going to do a single. We're going to save the file. We're gonna change it instead of saying actually, what did that say? here. It just It doesn't say anything. Just says, Oh, I'm sorry. He does say open to that's open right here. Well, what if What if we wanted that to be a save? Uh huh. You hear What's climate? This one out file, select file again. We want to put it in the var and then I don't wanna have am I'm gonna haven't s here. And then sometimes studio stops refreshing area. So we'll leave the path the same. Actually, let's put in the past, Peter. So it's going to start in my temp directory and then under the prompt saved one file and I must say this and reloaded and run it. And now you'll notice we're here in the temp directory and it says Save right. So if we were to click this, it's not gonna do anything right. This this is just giving you this interface to do stuff with and notice. I'm hitting files dot txt And this is going to turn the path to that that you would then use, like, file upend or something else to actually write the file to that path. But it's really cool that you have this easily accessible interface to To help you write your code. You don't have to go create all this crazy dialogue boxes and everything for this. So that's that. And let's show. Let's actually, you know, let's will repeat this one for this, but we're gonna add a filter. And so after the propped is the filter And for that, like, let's say, weakened do actually don't know if I have any star. Not h k. Um And I think here. Yeah, Default file name. So temp. Oh, save one file. This is when I was so I'm gonna put it, um, blah dot hk And now you're gonna know when I run this. Oh, I did something wrong. I have to go back and look at it. It's We'll see what I did wrong. Oh, I uncommon did the one above it. That's what I did wrong. So this is correct, right? But notice I left both these open. So did this one, and then went to the next one. And here and now it did pipe in the block as the default one, but you can still change it. It also is only showing you because I filtered it right and Actually, I can still undo this and show all. But that's what this is doing here. And if you want, I think to have multiple. I think you put in a pipe. So let's comment. That was rerun this and now it could be Oh, we're Sana filter. Oh, it's a semi colon right after it. My bad. So said Michael in here and it looks like a space. So now see how it's either one and showing both auto hot key and text files. So if you want to have, ah, multi filter and you can keep adding on to that, so that's using the file select. Now let's Oh, I hit. Cancel. Let's do the folder select. So, um, I believe that's just folder See here, possibly folder. Yeah, so there. But we'll still use far starting folder. Let's leave it blank for now. Options. This one. I don't really change one of the options with its it's I'm just trying to get, you know, a directory. And so I'm gonna leave that plank and prompt is and let's make sure we do a message box here for a viral. For what we find that I'm gonna run it. Now, this gives you a nice, easy way to select a folder. I can select this, okay? And it's gonna show me the path and those. So, basically, I'd still I'd have to do something with this, right? But it gives me the path to that directory. The the other really nice thing here is I can actually make a new folder under it. And if so, I can pick it here. And so you know, I needed and I don't have one that I want. I need to make one, and so I can go ahead, make one. So I think both these air really helpful when you're trying to, um, write a program that you want users to interact with the find a file on their computer and issue have found that computer, and you don't have to build the gooey and all the stuff behind it. Right? These are built in not a hockey. So enjoy those in Do some practicing 17. Mouse Clicks: All right, welcome back in this session, we're going to cover mouse clicks. And now I don't normally use mouse clicks because, general speaking, there's far better ways to automate things. The big concern is that for the most part, when you send a mouse click you, if you're using the mouse, it's going to interfere with the mouse click. And so that's why I don't use them. Having said that, we all start somewhere. I still do. Send them in times, and it is a very convenient, easy, cool thing to be able to do. So let's start off by just demonstrating. Look what happens here if I double click on force. Right? So it highlights the word, right? So the simplest thing we can do here hopes turned us. Besides, turn on my caps. Lock is we're gonna do it. A double click. Now when I run, this notice actually shouldn't even click there. Right? Let me click over here. Understands where the mouse is now. When I run this, it highlighted force. Why? Because it looked at where my mouse was and sent to double click to it. Right. So it's that easy now. Of course, if I have to move my mouth somewhere every time. It kind of negates the whole purpose of automating. Right. So what we want to be able to do is to detect the coordinates and then send the mouse click to a given coordinates. And for that purpose, that's why I had a note pad open here. Let's pretend this font windows open. Let's say I wanted to click this. OK, button there again. There are better ways to do this, but this is an intro course. And so we're learning just the basics, Right? So the first thing I'm gonna do is I think it's ah, get mouse position this mouse skip position. Uh oh. Here we go. And we need a store. The X coordinate in a variable. So let's put it in X, and we're going to store the Y coordinates in wide. Now, there are some other parameters here, but again, this is an entry level course, So I don't want to do too much e. And let's go ahead and put that information up. Just put in a tap so you can. This is a special way to put in a tab and between the characters and why? So now when I run this, you're going to see a set of coordinates. So there's the Axis 42 wise to 78. And if I put it over here exes 14. 37. And why is 601? Let me grab that Because I can't remember anything. And now what we're gonna want to do We don't want to double click that we're gonna want toe click it e m. It's gonna shoot us, Ask for the corners. Now, when you use things in a variable here so we don't need these and we're gonna unfortunately , you have to put them in in this format. So click. Uh, I don't want that. I'm trying. 14 37 and 437 comma, 601 Right now. When I launched this, it's gonna move my mouse down here and click it. So let me run it and notice that. Move my mouse down there. Click the button. Is that simple? Now there's like I said, there's other ways to do this. There's things were not going to cover in this course because they're just too advanced. But I'm dealing with controls. I'll have that in the next the next course. It's an intermediate at the minimum in their super handy and helpful. And the great thing about sending control both control keystrokes like instead of sending the keystrokes Where is typing it out? Sending the keystrokes using controls in the mouse clicks is it doesn't interfere with your script, whoever using the program so it could be done. The window could be offside. It could be wherever and it needs to be needs to exist. But you consent controls to it and click things and submit things. And it's a much better way than just sending mouse clicks in keystrokes. Having said that again, this is just entry level. Giving started giving us into programming, and so I don't want to cover in this course, but we'll get onto our next one thinks 18. Overview: Hey, So before we get into programming and setting variables and values and a lot of other things I wanted to revisit and just go back kind of cover some of things we've already reviewed. Yes, this is just a working session to implement some of things we've we've worked through. So namely hot springs, hot keys, maybe click a mouse something like that on. Maybe it went, activate in and definitely commenting out. So I realized I hadn't explained. There's two ways to combat things out in auto hockey oneness with the same Michael that I was in. Studio One is with the semi colon, so that is an in line comment. So notice up here, I can put it on everything to the left of the semicolon is gonna work fine to the right is treated as a comment. Now, if you wanted to send a semi colon, you can escape it. I believe it's with the till day and then it doesn't treat it. So See how that's still studio is smart enough to realize that this is commented out the second we get rid of that, now it becomes a comment. So that's one way and then the other way is a box comment. And so there's a couple ways in studio. I think it's Ah, shift F one. Let me see here. So let's do multiple lines. So one, 23 Now, if I come up here and highlight, I don't have to be at the very beginning of this in studio No, I think it's shift F one notice it starts off with this backslash star. And then there's the star slash. So anything in between these this could be multiple lines. This will be a multi line comment. And so they were called a box comic. And so that's an easy way. And regardless, I can hit. I don't have to highlight everything in studio. Can it shift F one and it will uncommon those now. Personally, I find it hard to hit you. Effect one. So I remember my hot street, our house. Sorry, hot key to launch that. Or you can just write it out right So I can do this. And, um, auto hockey is pretty good about you Don't actually have to close it. But if I had a message box down here and I go to run this it's not gonna work. So I went to run it, but it never got there because I did not close hopes on night shift. Here we go. So now when I run it, it's gonna say hello, Right? So that was the 1st 1 in I highly, highly, highly recommend. Recommend adding comments or annotating your code Because when you go and you do something in your mind in the right mindset, you understand it and you grasp It only takes you a couple seconds to document things, and if you don't do it, then you come back like let's say in a couple weeks for a month or a year and you have no idea what you were doing, what you were thinking. And it takes a lot more work to read up on what you're doing on more advanced things. So let's let's go ahead and demonstrate. Let's let's add what I didn't do before. Let's do a couple hot keys and you know, let's let's give ourselves a little So our cold are start our period space, and it's funny because I killed all my heartstrings and hot keys because I didn't want to be a conflict as I have so many, and I wasn't sure which ones would how to create new ones because I have so many already used in. So I killed mine. But this actually what it normally does is throws in a semicolon, a bunch of Asterix, and then leaves me in the center here. So what I wanted to do was skip buildable cheat sheet. I know these, but it's good to have this equals control. The leaves of the most common modifier said the pound cut key equals Windows Key. The plus equals a shift key and my missing hereth. I'm the ult exclamation point because the cult so these air the common modifiers that you'll use there are others, but for the most part these the ones that the vast majority people use. So let's let's write a couple here. So let's say let's do shift shift. I is going to want to dio I ate a big best, Okay, so that actually, um that I was I was writing like a hot string. I don't know why. So, uh, let's change just to ah, hot string. So home colon, I ape big breakfast period. I try to make him remind me of what it is I'm typing so colon, but that so? And now let's add Let's add shift. I is gonna launch. Run! I think it's I Explorer Explorer for Got the XY. Save this. I'm gonna run it now. We should see the green h Oh, no. There's an error. Oh, I forgot the second. I can see it right now. I forgot the second colon way. Go Now I have the green age. I didn't get this here. This is the output window Where the debug window in studio. And so I didn't have a air there. Now, also studio to see. No. When you type in here, you'll see if I a b B period space notice it. It didn't like it. Right? Studio doesn't. It's actually written on a hot key. And for some strange reason, it doesn't like hot strings. So we're going toe. Let's do this. We're gonna snap this one to the left and pick sites, and now it's on the right and I A b B period in our space, and we're still getting the air of air. Oh, well, first off, because I had left that saved that we run it. Here we go. I was trying to get So what am I doing? Something that's been having failed to attempt to launch program a document that shouldn't shouldn't be trying to launch that. That's just a shift. I corn corn. It's coming out to see what happens here. So that worked. Fine. Let's move this above. And I'm leaving this in cause it's important, I think, to understand troubleshooting, right? And this is this the way the world works? So now let's do shift I Oh, so it doesn't understand what I Explorer is. So here's what I would do is I'm gonna right click on Explorer Could've properties, I explore. Oh, it's explorer. I explore the exit so save we run now shift I it lost it on the other screen. I'm bringing over here a second. See at night when I close it now shift I It watches it and ate a big breakfast. See, I dont know why thats following through fall through is when it continues running. And why is that? It's above it. True, uneven. Oh, let's change this to a lower case I and it's interesting. I think I understand so How funny, right? Because I was literally sending an upper case. I and here I used shift I Well, my hot string triggered my hot key, which I thought wasn't possible. Obviously, I'm wrong on that. But obviously shift I is not a good combination, right? Just a shift, because you're going to use your modifiers. So let's do this to control I and this Put this back to I. That's funny. So I have to exit the script, right? Cause I can't type shift I because another reason why you don't want to shift I right. So let's go back to studio shift. I run now Control. I launches Explorer and I ate breakfast. Oops. I forgot my eight big makers. Another thing I should have mentioned was, If you're in ah, hot string, I a big and let's say I put a period space and it doesn't work. Oh, I can come back here Doobie period space and it'll work. It will. If you want to break the pattern, you can hit, escape or I think left click like like fleet your mouse and get out of it. But it's pretty good about keeping track of whether it was supposed to trigger something or not. So let's add another hot string, right? I had a big brick wrist. I also had lunch to me. Tom hungry. I also had lunch and it waas. Now it's, um let's put this on a new line to new lines and we're gonna say in uppercase Amazing. And we're gonna send an exclamation point. But remember, that's a special character. So we have to wrap that with the prince. So I must say this now, remember, you got to relaunch it, right? So I hit all tired to relaunch it. You know, I ate lunch. I also have lunch, and it was amazing. So dropped it down the new line. Right now this let's say we want to add another hot key down here to launch chrome so we'll do controls. Well, control. See, is that bad? Right? Cause when we lose our copy, uh, let's to control shift, See? So we're saying run chrome not exceed chrome. I think also has it in the path. So if we hit control shift, see, transfer, control shift, see, and that for some reason, didn't work, doesn't quite within their rights. So let's just try. You know, I think I know I have some other scripts running. Let's do control shift J. Relaunch it. Yeah, And then control shift J. There we go. The problem is, I killed my main auto hockey script, but I still have others running. And the control shift see is actually and just open your eyes of stuff If I'm in ah, file here in Explorer and I hit control shift. See, when I do that, it will pay it, copies the path to that file, puts it on my clipboard and then wraps it in quotes for me because I use them a lot in my file stuff. So I had forgotten that I already had a control shift C and something else and thistles. Where again? I'm I'm purpose. I would say I'm purposely screwing up, but I'm not, because this is just the way it is. But you gotta test stuff and you got to learn and use logic to help understand? How do you figure out of something's working or not? One of the easiest things is to kill a much of the other things you can and get it down to one thing. You're doing? Possibly change the hot key to something you know, works. If you're trying to launch something and it doesn't launch, change it to another program and see if it will launch that, right? If it if it if that doesn't launch, it might be something with your hot key combination. Changed the keys you're doing, right? If that still doesn't work, make sure the scripts running, maybe moving to its own script or to the top of the script. Because if you have, like, in my case, I had another script. Yeah, that was acting funny. Reeve always reboot its windows, right? Rebooting is important. Eso these are just things you need to you. Then throw in a You know, what I would have had done was right in here. I could put in a, um let's do it. Must do it. So I must say, run chrome a return. Remember, when you put it on more than one line, then you need to return to stop it from going down, and we'll demonstrate that here in a minute. But I'm gonna come back up in here, and this would have been a great, easy way, so I'm gonna relaunch it now. When I hit control Chef J notice it says, Hey, I'm online 12. Okay, so I'm right here. I know I'm right here, and it actually paused right here. So the second hit, OK, it should launch chrome, right? And this way, if I still haven't got chrome, the launch, I could have done this to make sure I'm actually in here where I think I should be. And it's just one of those things, like the littlest things. No matter how much you program, sometimes you get caught by something and you beat yourself up because it was something stupid. Another great tip to troubleshoot things is to have a bobble head doll and explain it to the bobblehead doll. And when you start hearing yourself talking out loud to something else than often, you'll realize you say it and you're your brain works differently. So when you say it out loud and you say it, it forces you to think a little bit differently. And sometimes you pick up on what you're trying to do and why it doesn't work. So let's demonstrate a fall through. Let's see, What can I do here? Um, because if we have another hot key, it'll it'll wait for that hunky so I don't want that. Let's just do a message box here. So this without the return here, the return is what's going to stop it. Right? So when I do this and rerun it control shift. Actually, let's get rid of this message box. We run it. Control ship J. It just launches chrome. Right? But if for some reason in my code, I didn't have this, which makes a lot of sense, right when you look at it is I'm gonna read, run it. And now controls Chef J. It launched chrome, but notice right here. It also got down to this message box, right? And so that's what you're trying to avoid. That's what that return is needed when this is on more than one. Now, let's actually so this is a good way to do it. Let's Oops. Do this now. Theoretically, um, this should not get to the hello World Message box online 14. So save reload. Control shift J launched that. Not notice. Over here. There's no message box. Right? So that's what I should have done earlier. To demonstrate how how the one line works. When it's one line, it just runs that line. You don't need to return when it's more than one line. You need to return to stop it from processing forward, right? And not only that, I shouldn't say that because it's it won't proceed forward. And that's an important distinction to make right cause even if this was right here and I rerun it hit control shift day, it's gonna launch that, But it doesn't notice. No message box here didn't pop up here, right? It never got to this line, and so that's an important thing to realize. The other thing you can do is used brackets and braces, and we're gonna cover those later. But you can use us to group more than one line together when your using logic and after variable definitions, when then we're gonna cover some logic. That really helps you start tailoring it to what you want. Now let's say Let's see, we're in sight and we're doing this and let's do a demonstration of site and note pad. So I think, don't be hearing out. There's no pad up, but this year and hopefully weaken shrink, no Pat at the bit Oops. Not what I wanted to do. I know there's a way. As I control up, I forget. What it? Come on. There we go. Okay. So what I want to do is let's recreate the the commenting out that I had mentioned here earlier. So first off, let's have one that works in virtually every program. And so that will be down here. So So to Colin, actually, let's do Colon. Oh, oh, Colon and our period to Collins. And now this one is going to be non Let's do this on a code, All right. And now what we want to do is, um, make one just for, like, if site is active. And so if when active and I think I actually wanted the pound sign in front of their off, the guy will just test it, right? This is how I work. Just tested And let's use, uh, we're gonna put the word site in there Now. There's other ways to match on this, and we're gonna cover later their bit more advanced. But for now, this should be fine. If when active and and now I don't want to forget is to turn this back off, which is whoops, which is what I did earlier. And let's be real lazy here. And I'm a copy of this on in the invention. And now I need a semi colon here. Unless you stars. Well, I like having him. Even so this interested easy, fast way to do this. So save reload. I think there's a problem here due to do Teoh. Let's try it with the pound sign. Which would of course, mean that we need it here as well. That doesn't look right. But it seemed to work. So in here I'm a type R period space and oh, it didn't put the right one here. It should still do the same because that is the default. Now, the question is why, if one active site millets, you can double looking right? Click here and say window spy. And this is a built in tool. Comes without a hockey. And what I want to do for right now is get this whole title here and we're gonna put that right here, save reload it way. Let it Here we go. Let's minimize that for now. Create space. Ok, so I think actually I think the title match is case sensitive, and so we contest that right. That's the best thing to do. Here is let's come back in here. I'm a duplicate that and commented out I would tell you the hot keys, but I changed him, so I don't know what the default are in here. I think I had sight spelled with the t e in lower case. I'm gonna say this reloaded. And now, theoretically oh, didn't work. Let's try the full thing here. I know it has to match, but you can turn on and off The sensitivity of it still doesn't like it like the whole thing. Um, well, I wasn't planning to go deeper on that, but let's let's go ahead and just do it, all right? So let's let's go back to the window spy. So here's in other ways. This title notice how it says, Entitled here. This, of course, would change will be different things. I want it for anything that's for site. So they have to built in easy built in ways. And there's this HK class and age K underscore dxy, right? So, um, notice in sight Here is the HK classes site window. So we're gonna use that. And instead of putting in a title, we're gonna put that there, say, even reload now. Hopefully, yeah, So now it basically is looking for its complicated. But there's these are controls. Right under control is a certain type of a class in the class. Is this in this case right here? It's site window if we click still the same, Um, it's not changing where There but here. Notice it changed to out of hockey because it's written on a hunky and note pad. It's a note pad and the new party XY for the execute herbal. So these air other ways. You can do this for the win activites. What I typically use. It was just I was planning to get to those a little bit later because they're a little more advanced, and I like starting off baby stepping it just easier. But in this case, I would have had to. Basically, there's a title match on this, and I could have changed it to where it will basically do a regular expression, which is a pattern match to think of it like a wild card way to do it and look where if site was anywhere have. Like if this was anywhere in the title and then it would work. That's what I was gonna dio. But hopefully getting the point here. The idea that also we can have multiple hot keys in hot strings and that could be inter dispersed throughout your scripture. This is also one of those things that we had talked about it earlier. Why should you have all of them in one script versus multiple scripts? And, you know, I put most of mine in one and actually, let's go ahead. Now that we've played with a lot of those who say getting a scale of how many things, let me show you my main script and let's close that here. Let's go up to the top. So I got tons of email addresses in hot keys for launching things and other programs, and like I said, it goes toe over 2000 lines. Some of the stuff is just annotation, cause I use it's for so much. I like having a handy, but, um, it's easy to have them all in one script and then, you know oh, actually know what? Let me show you other one cool in. This one isn't running. So a nice thing I like to do. Let's go back to overview is if you add in. Boy, it's been so long. I don't have to go back to my main script and find edit. Okay, so I have a hot key and let's let's go ahead. I'm gonna copy and what's Can't be all of these the and come back into overview. And now, because another script isn't running, they only work in the script that they're running in. And so if I launched this now, look, I can close studio and let's say, Oh, you know what? I want to add a hot key. Well, I can hit control all e and it's gonna open studio into that script because this is control all e. And it says, Hey, ed it and thats gonna pull this up if I hit control. Our watch that little green age down here, right control are will automatically reload. So I have this in my main script because I use it so much is really handy. To be able to just hit control V and have it pull up my main script. I don't have to go find it right. Click and edited. It was pull it right up. And then the control are If I make something, I can change it and hit control are I don't have to relaunch it. And for me, I just like having it there. And then it was my pattern trying control Ault and then the letter, So could all p will pause control p And see the little age down here turned red. If we click on this right click Sorry. See how the pauses selected but to suspend hot keys is not so we're not gonna get into the difference. Let's so I can hit control. API is gonna pause and un posit That's not that keys. Oh, however, this is why this one was commented out. I can promise Say this and reloaded Now I can hit control s and first before I do that only right click here so you can see it's not suspended. Right? So control s oh, studio has a hunky for control of this. Let me click out of it and then it should be fine. So Control s Oh, now see that change to an s, which is great. So suspend hockey's. But of course, the hot keys Air suspended. So now if I hit control s right, it doesn't change weighted exchange a pack. Okay, I don't have that works. I thought that suspended the hot keys. Okay, the SS on Let me close this control E. Well, Mr Control s Wow, that was I wonder when that was updated. Hopefully you grasp what was going on here. Which means also, I can go back to my main script in changes. Hockey is smart enough. So auto hockey is smart enough. I What I was worried was if I had suspended my hot keys than how in the world could I hit a hockey to un suspend them, right? You shouldn't be able to do that. Apparently the one hockey you have tied to suspend doesn't get suspended, which is great, because and I couldn't just turn it back on and off. So that's awesome to know that that is there. Because now I can leave that in there, and I won't have to kill my script every time when I'm trying to do these classes. Because, like I said, I have so many other hot keys and they start conflicting. And this way, in that script, I can just suspend those hot keys and not have to worry that like, Oh, now I have a conflicting one in a different script. I'm trying to write it. So anyway, I hope that helps keep at it, baby. Step into it in the next section, we're going to get into some more advanced type programming things of defining variables and using variables and input boxes and doing some really cool stuff. This was, you know, I cruise through a lot of stuff cause we could spend hours upon hours going to the nitty gritty. I'm trying, Teoh, prioritize and teach you guys the most important things to know when you're learning on a hot key and the most frequently used things. So that's the goal of this whole course is just like an entry level of the bare bones of what you need to do. And then I right now I plan to have two other classes after this, an intermediate one where we get more nitty gritty and then, like an advanced one, which I'm I'm gonna, uh I'm gonna need help with that right? Because I'm not an advanced programmer. I know a lot of the stuff, but I need to have someone help me explain some of the more complex things because it's I'm not a programmer. I play one on TV, but I you use a lot of it right and I'll borrow it. I can tweak it. So it's one of the great things with programming. And for what it's worth, don't ever feel bad about it. That's what even the most advanced programmers dio they go out in search and find, and if someone's already solved it, they go on, borrow from them and then just copy and tweak right. There's no reason to reinvent anything. So anyway, Kobe enjoyed that. We'll see in the next section. 19. 05 01 Assigning Values to Variables: All right. Now in this section, we're gonna get into assigning values to variables. Auto Hot key. It's really great compared to a lot of the languages. Many of the languages you need to declare the type of variable and do a lot of us. Other things in orderto work with them on a hockey is super simple. It also takes care of all the garbage collection is called the little free up memory when it can. So you don't have to worry about cleaning out things after you've run him. And when you exit out of the script, by the way, it's all gone from memories. You don't worry about that. So let's first off. Starting list. Let's start off with X. Of course it by X. Let's say we want to set X to the word start that's going cools. Start now. Of course. How would I know? There's a couple ways we get this right, But first we're gonna start off, which is a message box. Make sure you're throwing a percent sign, right start, Idiot. X Right now, I'm gonna run this in our message box. Says start. Why is that? Because we took a variable X and said, Hey, the colon equals right. That's how you assign a value in Iraqi clinical, say, make acts, push this word, start into that variable and then I'm gonna display it into a message box. So when I say here and now, if this was, let's say actually, let's say I start to now it it completely overwrites what's there? So this first line is gonna put start into it and then the very next line, it's going to say, Now let's put two into it and get rid of start. So when I run this, we should see to not the word start right. That's because it just completely overwrites it. Now let's say we wanted to upend some more tax to the word start. Let's let's say its end. So X. This is where use the period equals and this is putting a pipe just that we can see how close it is. Mawr. So I say this and run it and notice the A pending right. It kept the word there start and then appended more. Now, one thing which we should cover here is let's come back and say, What if this was a number, right? So I'm gonna comment this out, save it and run it. And auto hockey, it's It's pretty good about keeping track of Hey, is that thing a number? Is it a text you know, Alfa numeric type thing or nations out in America, just Alfa e M. It will convert it. It first starts off is the number because then we could do math on it, But then it converts it into a string value, which then it can depend them or to it. So that's what we're doing there. The next example I won't do is a couple with addition. Let's go ahead and let's use why for addition. So I'm gonna comment those out so we haven't handy. And now let's do why. There's no reason. I'm just you. You know, I should also go in and mentioned the different variable, the the type of variable names we can have put that I'll give you a link to the documentation of it. Basically, start off with a string value, and then you can have numbers and you can't have spaces, But you can have numbers and other characters arson characters you can't have. But for the most part, it's pretty straightforward. So So colon equals. And now let's put in a value here of 10. And let's just verify this message box percent. Why here we go and run it. That should be 10. Now let's say we wanted to add to that value, right? So an easy way would be Why is plus equals two now that's going to take the initial value and then add to to it. So I say this and run it and notice it's 12. It's not, too. And that's it's not 10 because it took the plus. Equals is a special thing so we can add to the value. Let's comment this one out and then I'm going to say What? Why cope? Minus equals to save and run and now notice. It's eight. So it's how we consume tracked. Now this is equivalent. Look, we could do it this way, right? We could say, Let me comment this out. Let's stick with the positive just easier. So why colon equals? Why hoops? Why, Plus to write this would work as well. This will still be 12 right? It still works fine, but what's nice is is this takes into account. You don't have to keep tight this over right. It's just a short cut hand way to do it. And it works from subtracting as well. It's just an easier shortcut way than writing sometimes, like when I'm starting off. I like using it this way, cause in my head I fully grasped what it's doing. But after you get used to the other way, then it's It's nice and short and tidy. So there is. There are two others I wanted to mention. So let's say you wanted to increment. Why by one. So what's really cool is you can say why plus plus. And now when I run this, it's gonna be 11 right on my running again. That's because it starts over. It's still gonna be 11 right? That's because it every time you re launch it right, it's taking you know what? Let's do this. Let's duplicate this line and then move it up above, so we'll show here. It starts off his 10 and that's what we're online. 10 right now and then the next one. It shows its 11 right, I've added one to it. So now I'm gonna duplicate that and change it to minus minus and relaunch. And so that starts office 10 again. We're online. 10 and then it's down to nine because I subtracted one from it. So it's the same thing is saying, Why equals why Colon are sorry? No, let me do it. So why equals why? Why? Minus one? Right? This will give us the same. There's 10. There's nine. If it's seen value again, it's just a shortcut way. They do come in real handy. I think we're going to cover loops at a later time, but in loops they come in really handy, easy ways to increment. What you're doing is you. You go over the stuff. So that's why I want to cover in this session, assigning variables. You're gonna it. The more advanced you get, the more the stuff comes up a lot. There are also, I say, there's probably another 10 or so different types of assigning a value that you can do, and I rarely ever used them. So I'm not covering them, you know, in this course, because they're there and even go find them. But they're just not used that frequently. If you're doing a lot of math, then go definitely dig into their There's some good math stuff for doing things, but that's it 20. 05 02 Evaluating Conditions: Okay, So in this session, we're going to be reviewing how to detect whether conditions are true false in any of the the basic logic things. And I've laid out here some of the examples there are others, and these are by far the ones used most frequently. So let's go ahead and start off with the equals. So basically, let's say, uh, let's first define up above actually equals 10. And now here we say, If I always like using the Prince to help tie it together and say This is what I want you to look at, some say if X now here's where just the equals 10 e and notice how studio automatically enemy. That's because it knows this is related to the thing of above its conditional based on the thing above it happening. So the same message Box X equals 10. So I'm gonna run this and we should see because, like this character, especially where my around here look, I had the semicolon to cross. Here we go. So here X equals 10. And of course I could have put this as Let's put a percent science. You know what? I haven't demonstrators before Let's do this. So here's a percent sign. That means we have to wrap this in quotes now. No, not the sex. Here we go. So here's what I'm a save us announced. We say 10 equals 10 because we're treating this is a variable and we're comparing that to that. Well or not, I should do the comparisons up here, but we're saying that now. What if I didn't want to use the percent signs the way I did here? I mentioned this before, and it's just good to see it at least once. So uhm, I'm going to say sense now. What that allows me to dio is get rid of the rest of these double quotes, right, because everything else is gonna be treated as text. So that's the same thing. So that was the equivalent. Now what if I saved that? I changes to be 11 and now I rerun it right. So X equals 11 and this says, Hey, if X equals 10 do this when I run it, nothing happened, right? And actually here, let's put a message box. So now when I run it, he gets to their directly, right? Well, it tried it came in here to this expression because it's one line. It'll do just the next line. And then if it's if this was true, changes back to 10 you'll see it'll do both, right because it was gonna run. It's gonna pull in. That tent equals 10 because this was true. It does the one line and then after we say OK, then it gets to hear, because it keeps going right. I would like to demonstrate here, let's go ahead and put in some brackets. And now anything I put inside here, it will run. If this is true, it's gonna run both of these. So I'm gonna run this down, is gonna do that. 10. Now notice because this is inside the brackets, right? It does the line six as well, and then it gets down to their or I should say, here in in the 11 save and reload and run. It's gonna jump right to line eight, which I should really say Line eight, right? Of course, that changes says we put stuff, but the braces is helps you tie together parts of your code on what you wanted to work on it. It's just one line. You don't need the braces. So again, if it's like this will still work, right? That actually still works. But the braces are unneeded, so you can either do it this way. Let me copy it so I can show you. So that way works as does this, right? Those this. These two lines are the same exactly equivalent as these three lines. And that's just a simple It's a built in way out of hockey. If you're if you're If statement doesn't have a brace, it will do the very next line, and that's it. And so, um, I'll use as if I know I'm just gonna have one thing there, but normally have put the used to putting the braces in and then the rackets. And then, um then you can be used to it regardless because little work. Either way, this one I've run into trouble where I forget to add, go back and add the brackets and braces in it ends up messing me up because they're not tied together. So all right, that's our are showing to say that they're equal, right? So that was the equals. X equal settles to a string here, Joe. If X equals not here, just like it. So it has to be in quotes for that, right? I'm gonna run. Watch it. And Joe does not equal 10. But you still get the idea, right? It said, Yeah, X equals Joe. And then Joe, if Joe, if X equals, quote the string Joe, then go ahead and do this message box. Right? Andi, that's actually that was did say Joe equals 10 because it was piping in that variable there . And so that's what we're tying in the, um the variable. But what I wanted to show was you do have to put in for the strings. You need to wrap them in quotes, right both in the conditional check as well as when you defined it in the value here. If we put this just as like this, it that will not I don't think that will work. Shouldn't work. Yeah, so it didn't know what to do. Basically, So it's still actually re in, which is scary. But the second we throw it back into quotes and run, it did. It works fine. So OK, so that's the equal. Now let's do it. Not equal So let's say instead of it, just if X was to Colon equals Joe. So now it's not gonna equal Joe. If it doesn't equal Joe, then say now, this will get right to the here, right, Because it does equal job. But what if this was Joey and I run it so it doesn't equal Joey, Joe. Sorry. My logic is right here on line four. So this is the logic right here, and we checked. And if it doesn't and by the way, spaces and auto hockey you can have extra spaces. It doesn't. It doesn't matter, right? If I run this, it's the same thing as if this was right next to it s. So, for the most part, white space and on a hockey not always, but most time with your conditions and expressions and things, they don't matter. So that's the not equal. Now for the for the next two, we want to do greater than or equal to or greater than, let's changes back to a number. Stick with 10 and let's say X is greater the end nine. So we're gonna run that and now acts which is has the value of 10 is greater than nine. So now let's let's actually changes to less than Oh, boy, Here we go Now, Um, now when I run it, it says it's not true, right, because X is not less than 10. I'm sorry. Nine because X is 10. Let's say X is 11 right? 10 is less than 11. So that will be true. Great. And now let's say what if Blue changes to 10 now, this is not true, right? Because 10 is not less than 10 but we can do the less. Then I always get confused if if the equal comes first after. So unless a great lesson or equal to 10. Yeah, now that comes on the true, because 10 is less than or equal to 10 right? And obviously the greater than one works the same way. Let's change just to the greater the Insein. Uh, and now that will still be true because it still has the equals in their right, Um and that that still comes up because we don't have it here. I could do it as a conditional say, if this or this, and we're not doing that yet. But for now, that will work just fine. Now the next one we're gonna dio is the end. So we contest for multiple things. So? So let's say X Clinic was 10. Why Colon equals 10 right now. Let's change us back to Let's have an end. And this is what I like using the prince for. So I'm gonna say and and and keep it in capitals. Why is, um, equals greater than, let's say, 10. So that was not going to be true, right? Because let's say if X equals 10 and why is greater than 10 said that's not true, because why is only 10 when I run this? It's gonna say Not true. However, if I changes to be, why equals 10? Can I rerun it now? It is true, because both of those conditions and we can keep adding in mawr and more and more with the and statements and weaken use other Forenza toe help tie things together. And so that's example use in the end, the or means either one of them this or this can't be true. So this case, let's go back to here. Let's say this is 11 so X is equal to 10 or why is greater than 10 now? In the end, this didn't work right because they both had to be true. But this one it will work because only one of them has to be true. And again, we could have more on there on this. But these are the basics of using logic and auto hot key again. Remember the's Curly braces? Those tie your groups together into code that are tied together so everything within this section is going to stay the same under the same threat of the same process. And it's tied to this logic here on line five. So that's the the basics of doing logic and auto hockey. There are, like I said, there's other ones or some cool stuff called a turn eri, which allows you to do some very complex things on one line. But those are advanced. They're very fun and helpful, But this is just the basics. Cheers 21. 05 03 ToolTips and SplashText: all right this session I want to cover to other things that are great and easy to use for helping either you in troubleshooting or to play display information and convey information to your users or to yourself. The first ones. A tool tip. So let's go ahead and start playing with tool tip. We're gonna now. Actually, I should bring up here. This persistent will keep the script running way. Didn't have to do that before because we had a hot key or hot string. And that in itself, being inside of a script will keep it running in memory. So naturally I run this. You're going to see the Green Age states here. There's nothing else here, right? So but it stays in memory. If I commented out, save it and run it, it goes through it and then exits because there's nothing called to stay there. A tool tip in this last screen won't keep it persistent. And so this is why I wanted to have us on here. Just helps us keep it active in running. So let's start off of the tool tip tool Tip. What touched do you want? By tip? There are other parameters. You can tell it where you want it in which type of tool tip Let's not worry about any of that stuff, E m. I'm gonna say sleep 2000. That means two seconds. And actually, let's just I don't even need to do that. I'm gonna run this on this and let me just run it and you'll notice Here's my tool tip Literally. My tool tip. He and it stays up here, right? Well, we wouldn't necessarily want to always stay visible, right. We wanted to go away, usually after some out of time. However, if we just the way you do that is to say, tool tip without any parameters. Now, the fun part of this is when we run it, it's gonna do this line and then jump right through because line six is in there to seven and then disappear. So I'm gonna run it and you won't even see it. Blink cried. It's so fast. But what we want to do is we want to put a little sleep in here. So it's descriptors. Gonna basically take a little pause, a breather for two seconds. And now when I run it, it's gonna pop up, say my tool tip and then it's gonna disappear. Rights of the sleep. That's what the sleeps helpful for. And this is how you nothing here is displaying. So that is how we're doing those three. And I'm gonna comment those out and we're gonna do a splash drink, uh, splash text. So splash Notice the splash image there. There's also one of those to swell slash text on the with There are the default for the width. I think it said I forget. Let's say it was 200. I thought I forget it should adjust. I think someone but so the width would say is 200 the height hoping 50 now a title. I'm a call my title just so you can see it And tax is going to be This is my next from a All right he And now again it works very similar to the tool tip Some asleep for two seconds and then we're gonna turn. Actually, this one is a little bit different. So there's a class slash text off, right? So Nama save it and run it in here. You're gonna see a pop up. Here's the title I guess I should have done in front of a longer, huh, sir, Four seconds. So here's the my title. And then here's the text on here, and then it disappears after four seconds. And that's just because we have this sleeping here. We could have put a message box that's instead of doing this. So now we have the tool tip along with the message box. The second I hit this, it's going to continue on and turn off the tool tip. So those air very easy ways you can adjust where you want the tool tip to be even. Have it following and fits in a loop. It'll follow your mouse around. It's very convenient for troubleshooting, especially with something when you're looking at the value of variable and seeing how it's proceeding in a loop. But like I said, these air are super easy. They can be great to help inform ah, user of a script that it's actually doing something because often they don't know it's running or not, and it's helpful when you tell it to go to go do something to have a little splash thing, come up and say, OK, we're working on it. Give me a second, right? So hope that helps keep playing with him 22. 05 05 GoSub: All right. This session's gonna be on ghost subs now go. Subs are very, very simple. He probably actually know already have a good idea what they are and to go to a sever team and not a hockey. You can call it a subroutine or on the label. And let's put a message box here. They're saying Hi. I run this and hey, it says hi. Right now we're gonna put a label down here. A label is a description like, let's say, call my team and ends in a single colon. Right? So don't confuse it with the two Collins. So it's a single colon, and that makes it a label or something can receive. It goes up and then I'm gonna add a return return. And inside here, say, inside my goose. Um, 18. I forgot. I put this in front of a message box. Now again here. When I run this, what's gonna happen? Well, it still says hi, right. And then, actually, it'll go through and jump down. It falls in on line seven and gets inside my 17 which is fine. That's the way programming works. What I would really want to do is to have a return here to prevent it from dropping into that goes up unless I was on purpose. Right? It is possible. So now when I run this Chris, say hi and that's it. But what if I wanted to jump down to the ghosts up? So I'm gonna say Go sub. And then we give it the name of the labels to see how studios offering up and we start typing my look. There it is. My subroutine said Now, when we won't run this, what's gonna happen is it comes in here and when he gets the line, three is going to jump down tow line nine and then do what's inside line nine through 11 until hits that return. And that's going to come back up. Tow line four comes right back where it was and jumps toe right after where it went to. That goes up. So I'm gonna run it notice. Now we're inside the ghost subroutine. So it came down in some 9 11 Since we don't have anything else there, it's going to turn back and then go toe high, right? So think of it as it's going to go somewhere. Do whatever is in that section, which is between the label, the start of the label and the first return. So here to here, and that's going to come back up. Now. The cool thing about go subs is let's say we went to it twice, right? There's no you know, and that stupid I'm typing it. I'm gonna do that. Here we go. Now it's going to call that I will do it three times just to be annoying. So I'm gonna run it and it goes down to my 17 him He got in there the first time. Now when I hit. Okay, it's gonna come back upto line four and then jumped back down the line 12 and then come back and then do it again. And I were back again and then finally were in the high and we're done. So it's a simple, easy way to do stuff. Now, the next video, I might start talking about functions, functions you can think of them. For the most part, they're they're basically go subs on crack because it allows you to, uh, personal, not personalized, adapt in ad parameters. So when you jump to a certain section to pass certain parameters and to customize it. We're not going to go too deep into them because they get pretty advanced. But they are a core functionality and what the thing is you'll see but functions built in functions without a hot key, so you need to know how to use them. But I'd like to at least understand a little bit the basics of building your own. But more importantly, when you borrow ah script or someone other stuff from the forum or elsewhere, it's great to be able to understand what's happening with the functions. And so we're gonna do a high level overview, so look for that. 23. 06 01 Function Parameters: Hello, everyone. And today we're gonna be going over functions. Functions are to me the lowest hanging fruit as faras. If you want to step up your game programming, they're very easy to get going. It does have a little bit of learning curve, but they're super, super powerful. We just covered go subs which are handy and helpful, and they definitely can be very convenient. But functions are basically like go subs on crack. They allow you to do so much more in customize what you're doing. So let's just jump into it here, and I'm gonna go ahead and create our own functional auto hockey has built in functions that we're gonna level cover here in a couple in the next session, probably, or the one after. We're gonna go through some of the most common functions that I typically use, and I think they're used. But we're gonna create our own here to help you understand the whole concept of functions. So let's just start off by creating something called my Funk. And now these two prints we haven't created functioned the second you add this part. Now we have a function and there's no these. If we have like a X comma y comma poops Z These air parameters Each one of these is a parameter that we were passing to it. And so let's do a message box percent x little changes to why, you know what? Let's just throw them all in one and a sapper separated by taps and or scorer Tad, this is a built in variable, so to speak of it in sort of tap. So x, Why a under scorer and Z the case doesn't matter now. A function itself. If I run this, nothing happens. Functions in themselves. Don't do anything. You have to call the function in what's interesting and functions I can I can do it below it. So I'm gonna call my funk and let's put in one. Come on, two comma three. I must say this now when I run it now you see, it created this. It got to hear it went past this saying, basically defining it. And then it came down here and said, Oh, call my function or my funk and then it's gonna jump in here. It's gonna pass. This is X. This is the why this is the sea right, and it comes in here notice so I can change us to three things toe to this one. To Joe must change entirely. It doesn't like it doesn't matter, right? The order matters The order of these Aaron matter not what the in this case, I'm passing text to them. I could pass and get outta. Hockey's pretty flexible. So if I changes to a number and run it, it doesn't error out where a lot of languages would say that's invalid value for what you're doing. So right now, we're just passing variables to their E and let's let's demonstrate if we want to call this twice. So here's my folk, and I'm gonna call it again. Office changes from the first on this one to second, so save reload. Now it's gonna run again. It skips the top part. It doesn't skip it, a process that I should say. So it comes through here, and then it gets to hear online 11 and does the 1st 1 And now when I hit okay, it's gonna get to the 2nd 1 writes. This is a great, easy way to have multiple things and to be able to adapt what it is being done inside here that is going on. So in a ghost of you can go there. But you're not changing parameters. You're not changing anything in it. And so it has to be identical in that way. When I first started using hockey, I was creating a lot of ghosts. UBS very specific. And I realized, Hey, you know what? This this go sub and this goes up these labels, I'm jumping to their virtually identical except from changing, like one or two things. And that's what functions are great for. Now there's some more complexity we're going into, but I want to keep these sessions, you know, nice and short. So this is just the intro to using functions. I also let me point out here. Whoa, Role hockey. Here we go. So if I move this up above the definition of the function, it doesn't matter. Nothing changes. So the way all hockey works will go through and basically look at the entire script first, it will say, Oh, here's a function definition. I'm gonna use it, but I'm not actually gonna launch it. And then when you got to run it, it goes and says, Hey, let me call this function It knows what that is. It's a memory and it will go on bypass the parameters to it. So after this were moving on to scope because scope is confusing and I want to keep that separate because it's a little complex, and that's one of the things you'll run into doing. This is, it's It's one of the things that the first couple of times you use it and get confused. You'll hate this, but it's worth it, trust me. 24. 06 02 Scope: Okay, so now we're gonna deal with scope, which is a little complex and confusing. So I have actually pre written this out, and hopefully it's gonna help me stay on track of making sure I hit all the points because there's a lot going on here. First off, let's go ahead and define. We're going to find the X and Y variables cat and mouse. So X equals cat y equals mouse. If I run this, you see the best spot right here. Pre function X and a tab. And why Cat Mouse. OK, no surprise there. Right. This next one, we're going to call my funk, which is the function note. I'm only passing the X to it. Right. So it's gonna come down in here passing a parameter, which is X, which happens to be cat, I think. Yes, Cat. And then you're going to see message box inside function again. I do the x and y, but notice Onley cat is there, right? This is helping you understand that that mouse isn't Why isn't defined inside the function . That's because the scope issue right function variables are defined inside of a function are used inside of functions their local unless you pass them to them or define them in its global. We're going to cover some stuff here in a second. Um, And then let's see here. I actually change X two equal dog right in this one. So right here on line 14 and this is gonna shows the message box where now X has dog in it . So after inside the function, after redefining now X equals dog. Okay, now, here's another important one. When it now it's gonna come back out of the function. And remember, we were here, so right here is gonna be after the function. And here is X And here is my function var, which we didn't define yet I should have commented that, but it's fine notice. Instead of saying dog, it says cat and it says cat because of scope, because the variable X here was actually different than the variable X inside here. And so it's one of those things that can really trip you up when you're dealing with functions and understand that scope and saying what you're passing back and where things are So let me demonstrate a couple other things here. What I want to do is to come in. Let's go ahead and use the list. Far is, this is one of the easiest way. So I'm just gonna rerun the thing. And this time I'm gonna show it's gonna pop here with the list bars, and this could help explain it. So look here. The global variables notice there's an X with cat and a Y with mouse right in the local variables. Inside of my funk, there's an ex of dog, but there's no why, right? This is why it popped up without having anything there, right and why it didn't work. So let me exit out of this because that's all I want to show their. We go ahead and hide that, and then I'm going to add this 2nd 1 here. So all we're doing here is inside of the function call. It's gonna jump down, and here we're doing the same stuff. But we're leaders wanted to find a new variable right here online 17 to say function var, and it's gonna have this text from inside function. Right? So you would think you were going to show it. Let me just do it right now. I'm a Show it. Run it! Here's the pre Here's inside function cat. Okay, This next one. This is inside function after we defining dog. Oh, sorry. Should coming on it, Harry. Oh, from inside function showing new variable from inside function. So that is this line right here. Line 18. Right. So function var is a variable. Now when we come back out of it, this should pop up here just like we did here, right? However, it doesn't show it right. That's again, because the list Fars that's inside here. That's you know what? Let's move. List faras down to here. Let's get rid of this one. Um, and that one, I'm gonna rerun it, so Oh, I didn't comment this out. And let's go ahead. Move it about that one area. Now, when it runs now you will see the local variables for my funk. This is where the function var is inside here. But there's nothing outs, Actually, you know I need to do this. My bet is I need to move this list. Farr's up to here toe after inside here. Of course, it hasn't come back out, so it wouldn't It wouldn't have worked the way. I was hoping it too. Let's for him. Leave that one. And we'll we'll leave that one to someone that we got there. So inside function can't right now. Now we're back outside. We just hit this, which is after the function. Call and notice. This is actually I'm really glad this and I did this because notice there's no more variables for the my funk, right? That's because we're actually passed it and it frees up the memory. They're gone, right? You can't access them. And so it's a really critical thing to make sure you understand. Now, if you wanted to have access to this my funk far, what you can dio is throw a global command in front of it. And now, when we re run this, when we get back to that, now we're getting this next one, we're gonna show, um, function var. Now it's available cause it's a global we've defined. It is global, which means it could be outside. We can also do that here with, um which one we're passing in. And we didn't We didn't pass in. Why? So let's get rid of this one. Oh, actually, no, that's it that is fine. We don't even need to get to these. I turn all these off. Um, we'll leave that one. Okay, so now we changed. Why? To be global. We could change. Excel my to be global. It wouldn't really matter in this example. So when I run this notice cat and mouse mouse even though we only passed on X right, we didn't pass the white but because I defined why is global? That meant when it came in here, my function would have access to it. It said, Hey, make make mouse make why global variable So my functions can have access to it. Now, One question to come to my mind of like, Well, why wouldn't I just do that with with everything right? Make him all over? Well, having them locals really, really helpful. First off, when you're starting, write scripts, then you get more, more complicated. You might accidentally reuse a variable in different functions. And it's great that that keeps it local because you don't have to worry about variables having the same names. You can actually have them have the same name. It doesn't matter because it keeps track of what I like to do is in my head. I think of like, if this is this is X here, right? Think of it is my folk underscore X right, Because it's not the same as the X up here, right? The like here. If we don't find it right here, I should have used this example instead of here. Right? But it's it's right here where we're setting that value. Mrs. Pacific value inside this function, which isn't gonna be the same, is outside the next topic we're gonna cover anything is returning some values, which you can sort of do a global. But that's that's not the recommended way. But I hope this is I would say, Just play with this over and over. You're gonna get hung up on it. I know I did it. It's it's complex, but it's worth the effort. Trust me. 25. 06 03 Returning a Value: all right, so in this video, we're gonna cover returning values from a function actually specifically a value because you can't return multiple values. Although it's it's much more complex. A ceased the way I do not buy stuff him into an object and and honestly, that's just it's it's a lot involved in the most part. Generally you want to return one. Values is very, very common. So let's let's do like a calculator. Let's let's create a cop killer called my couch and we're gonna get a function. It takes two parameters. Let's do X and why? And then we're gonna put in a little curly braces. And now let's say Z equals X plus. Why? And let's put a message box here of Z actually, let's do Okay. Uh, was two X we'll play, Plus, why equals? Yeah, Z now when I so that's just defined in the function. And now we're gonna call it right here, right? So, look, say my coke and our first panel say it's 10 in 20. So save this and run it. So 10 plus 20 closer T shirt. Sam. Right in this, by the way. So state 60 we run it. Okay, so 10 plus 60 equals 70 right? This is a great example of how parameters for functions are so much more powerful than go sets. Because obviously to go said you couldn't do something like this. You'd have toe create a whole different one for each subroutine. And of course, you wouldn't use 17 but it would be ludicrous, right? This is a very simple, easy demonstration of life functions rock, and they're so easy. But let's say I wanted which we just covered here a second ago. Message rocks Z. I'm gonna run this and inside the function, it's one thing outside its blank. Right. Well, that's no good, right? What if I wanted to actually use that in a value and what you can simply dio is instead of let's change just Oh, actually, we don't want that undo what's gonna We're gonna have a return. So, like, a type return Z now? Oh, actually, that I It's funny cause I do so so that will return Z. However, it won't store it in a variable by itself. So let me what's the best way to do it? So let me just say this. I'm running and we're gonna see is blank, right? That's because while this returned Z I didn't store it. I didn't save it right now for simplicity sake. I'm gonna save this. Set it to the value here now when I run it, Z has a value 70 right? I didn't return The X plus y equals all that's texting. I just turned the value. That's all I was trying to demonstrate here. Having said that, I could make this be taco in here. Say Taco Family, run it right, the actual The fact this says Return Z, you don't have to store it in that z variable. You can use it however you want. Now here's a really cool thing. I also love about functions is let's say I wanted to perform this calculation, but I didn't actually want to store the value. I just needed to use it in another parameter for another function or something else. Right? What's really cool is I can just use it right here, So let's let's put up a message box right here off of. So this is on the call, right? This is the call of the function, and I'm just going to show what? It gets returned and I run it Notice it's still returned 2 70 It still shows it. It's a value there. I could use that as part of a parameter for another function call. I can use it in however I want but there is no variable. Let me see how I can do that. Let's Yeah, let's do a list Vars Right here. So when I run this, the 70 is showing here When I hit OK, I don't know where it went. That was weird. Was tries again. Apparently there are limited where this is so weird. Oh, it's exiting this. Go. Oh, I'm yeah Duff. Sorry, my bad. So this is again I could go back and re shoot this video, but to me it's better to have it in here s so you can learn from it, right? So I didn't have anything stopping after it showed this message box on line four. It blinked. I did see a very quick blink, but then it just exited the script because there was no reason to stay open. So I could neither do a message box here, or I could tell it to be persistent right, So let me get in here today. So now when I run it 70 and now let's Fars and notice There are no variables right on this , a r eggs that apparently I have an object somewhere. Possibly. There's no air level, but there's no variables. But there is no Z, right? It wasn't stored anywhere. And this is a great thing of using functions. Is Aiken access the value returned from it without storing it? It's a very simple, powerful thing, but returning one value there are are other ones. If you're interested to advance stuff like using a by reference allows you to do different things with it, as well as what I typically do now is, I'll create an object inside here and return the object in an object or array can have a bunch of things inside of it. But those were those were pretty advanced, and I didn't wanna weigh this down with that. So that's on returning values. Hope that helps. Cheers 26. 06 04 Defining Default Vaules for Parameters: in this session, we're gonna cover having optional parameters in your function and granted. This doesn't come up too often, however, it is super simple in very handy. So let's say for whatever reason, you don't always want to pass a second value to your grammar. Sometimes you want to default, Value writes. Let's change the why Teoh equal by default. 10. Now I'm gonna get rid of the white parameter in that common notify. If I put the common here, I try to run it. It says it's missing a parameter so you can't have it with the common there. But when you get rid of it and run it, it's gonna say, Hey, there was nothing here. Let's let's use this default value of 10 that's defined in the function, you know, definition. But if we put in a value of 60 when we run this, it will use a value that you passed to it. So this is really helpful, especially when you have certain default things that like Yo, I don't always know what I wanted. I have an idea what I wanted to be a but it isn't always going to be that. So I'm gonna set a value there, and then I can choose after the fact or not after effect. But it has a default value there. If I provided Great. If not, use this that value. And the other important thing to realize in this is if you have more than one parameter you can't have. I'm sorry. No, that's fine Here. So let's say Z was here and Z list. Let's train because I already have a Z down there. So let's do w. And, um, we're gonna say 10 here. And you know what? Let's just put it in the message box right here to show what it is is w um So the defaults will be 22 when I run this. Since we passed the value, it's gonna be 10. But if I don't include it for either of them eso I should say my spot w books. Why? So now if I know pass either of these and run it so it's 22. Intend. However, if I do pass values, I don't want to pass to the felt like this. It will change. I promise you. When I was 22 in that first numbers to help. Keep it clear. It's in 22. Now you can on this one, You know, we can have it. Leverage. I know this won't work. So that's the issue is like this. You can't run. Oh, wait. You can't. I'm sorry. All right? So you can have it missing that That was the complex part. So it's 18 and 10 and and so you can have it missing in the middle, but not on the end. Right? So that that was the point I wanted to make. So anyway, creating a default value for your parameters can be very helpful. And if it was a text string, you put it in quotes instead of just having it. You? No, without the quotes. So if this was a text, you say Joe running. No. Look, I passed it a value here, so that's why I did that. So now when I run it, it's gonna say, Joe, right, cause that's the default. Live there. So you'd put it in quotes is the big thing. I want to point out, but I hope that helps. Cheers 27. 07 01 Includes and Libraries: in this section we're gonna cover out of the frequently use things, not a hockey, and start off with menus functions now before actually get into the frequent use functions . I want to demonstrate a couple really simple and easy ways to use functions that actually works for other things as well. But functions is how I mainly use it, and there's one is using an include First, let's go back. Let's build a function so we can see it's on my phone. Yeah, they will put a message box. You're saying high, so we know when it runs. Right now this function is in this file, and if I run and of course it works just fine. But what if I have a lot of oceans? And wouldn't it be convenient or let's say I want to use this function in a different script and I didn't want to keep having the same function in every script. It'd be great if we could put that summer and then access it as a separate file. So I'm gonna You know what? Let's see here. Yeah, I'll do this. I'll get rid of this top part. No, it is. Copy it and that new pieced it. But I want to borrow. Let's go back to here. Copy filed pass and then we'll go back to this one, and we're gonna save it. Now What I'm gonna do is I'm gonna say I want to save in that same directory to start, and I'm gonna call it the name of that. So it's called my funk. The function name is my funk, and this is important. You need to name it the same name. The file name needs to be the same name is the name of your function. And so in this format, you can have one function in the file. There is another way. It's more advanced. I'm not going to go into it. But you could have multiple functions in a file. But this way, this is just the one. Now I noticed I started in that folder, and now when I come back to this one, it's not actually gonna run. Let me let me demonstrate it here. No, si includes. And so now I'm gonna delete it from here, and I'm gonna try to call my funk and save this, and when I run it, it says hey called a non existent function, right? That's because I saved it in this local folder here. But what it really needs to be, there's three places you can put it. I'm gonna build a new folder and call it L I b capitalization doesn't matter. So if you want it, that's fine. And I'm gonna move it into here. So now notice it's in here. And now when I run this, it works just fine. Right? So there are three places. Let me give you a little cheat sheet. One is the local script folder slash L I B. And so you stuff it in there. The other one is under my documents, which I don't I don't actually even use I don't know how to navigate on my computer, but they'll be a folder called Auto Hockey. And you can put an AL I bi folder there and then under the currently running version of auto hockey. So let me actually show you here, and we're going to cover this later. But it is a cool thing, So I'm gonna do a message box percent. And now there are built in, um hey, underscore. It took a path so. And you know what I'm going to do is I'm gonna store this on the clipboard, so I'll have it on my clipboard. I can just paste it. So when I run this, it shows me this is the path of where I have auto hockey. This script is running from now. I can stick it. That's what this is represented here. This B colon slash products Ashoka hockey slash l. That is the folder that I would want to use in place to hear. She actually has a whole thing here, but we want to go up and we want to put in a l. I B folder. So now if I come in, it's open a new Explorer window, which is Windows E, by the way, and I'm gonna navigate to here, you'll see there's an AL I bi folder here and I have a lot of functions. I actually clean them up. I don't have admits that used to, but I have a function library here of different functions that I have created or borrowed and copied over time. And I can put any file I want in any of these three locations, and I don't need to use and include which we're gonna cover here in a second to access it. So again I can create that my phone function, whatever the name of the function is, and stick it in one. Any of these three locations and mice cripple Run just perfectly fine. Well, let's go back to theory Journal folder. I'm gonna cut this. We're gonna move it up. I'm gonna put it here and, you know, just to show that we can get rid of this now I'm gonna relaunch it. And it says, Hey, this is a non existent function, right? That's what I demonstrated the very beginning. We can get around that by using an include statement. And actually it's funny and asked Studio does this not of the ones? Don't. But it asked, Which ones do you want to include on DSO? You can include it this way. Now this could be Well, I'll do it here just to demonstrate. So save it and run it. And I notice I'm not sure why it's not running. It is not running, you know. So here's a good thing in Trouble Street, right? Let me put another message box and you see. So for whatever reason, it's not running. You know what? Let's just go and double click. So here this is again. This is just good way to troubleshoot, right? So includes this is what we're doing. I'm gonna double click it here. Now it ran. Something happened with my old are apparently because So that's the high attention and affection. Oh, look at the what happened to my file. This is weird. Something happened to my file. Let's go back in the end of this, that the path I've noticed that the top of studio this somehow got monkey. It was missing, So now it's working high. Oh, I noticed it didn't it didn't actually save this part. So now it's gonna do both so high here and again. This is where we can say now, if this wasn't a local file, this is the path we can put it in. This could be anywhere, right? Let's Let's take, um, this my funk file and I'm gonna cut it. And just for fun, let's put it here. It might be might be drive its just a fake drive, By the way, it's for my dropbox. And so I'm gonna put it here and now it's notice. It's not in any of those locations again, like the other ones. And I'm a changes to B B colon sash and save it and run it and it still works Fine. Why is that? It doesn't have to be in any of those locations. I can put it wherever I want. I can reference it this way into the work you can actually include. You could just create a whole different file. It doesn't have to be a function name. That's for a function library. You can if you wanted to call it anything you want and then give it the name here. It's going to go there and you can have files in there and that will it will include them. It's a great way toe break up your code. When you start writing longer programs, I predominantly use it for storing functions and let me show you real quickly here of how you can have multiple functions inside of a script. So, like my haven't Excel Library I've created, and what you do is you name the file. Just don't have any underscores before it, right, So it'll be like excel, right? So that's what I did. Doesn't have to be excel. And then every function inside your library needs to start with the Excel. You know, that abbreviation and then the underscore. This allows me to have one file having all of these functions in it in auto hockey, then knows Hey, when we go here, this the thing that begins with Excel is going to be in this exile, this excel dot HK file. So it's a great way to build up a library of I got state least dozens of functions for using Excel, and that way I just have I don't actually have to include it because it's in. If you look right here, it's in my my main auto hockey library. And so that way I don't have to use the include command, and it automatically goes in. Search is there, so I hope that makes sense. It's ah, it's a great way to be able to keep your main script clean and parse things out and again. One of the big things about functions right is I can put something here and then for all these, like getting the pointer or opening Xeloda. I don't have to keep those in all these different places and then have to go find it and then go paste it in my file, right? I just point to my library and saying You use my Excel library and then when I make an update, it updates for every script where I've used that as a reference. And so it's just a much cleaner way to develop code, and then you it's easier to stay focused and to stay up to date cheers. 28. 07 02 Scripts and Windows Paths: all right. In this session, we're gonna cover dealing with file paths. There's file special files, folders and windows that you can pull up with auto hockey e and our hockey, some great built in variables, virtually everything. Let's start typing here that you start. It starts off with a underscore, and then you can see that there's a tricky path h conversion. But there's a lot of them. There's too many to cover. I am gonna go and some other ones later. But right now I want to get with specific. One was to script. Script Directory is a good one on Let's throw this into a message box. Now when I run this, you see, this is the directory that this script right here and actually it's pretty cools in studios . You can see it up here, right? It's the same thing. Here is decoding slash you to me more, and that's the directory doesn't have the backlash at the end, but you can automatically pull that up, and then we could save that and using a variable or use it. No, save another file in that folder. If we care, too. Eso what's come down? Duplicate that and script full path. This is another really cool women. So this is the entire path. So it's not just the directory. It's the path all the way down to that directory. There's a couple that are really helpful for dealing with Windows. A message books they we're win directory. So that's the directory or Windows is installed to. Sometimes you want toe automate getting to that directory or maybe the What's It like the wind 32 subdirectory and their on. And then there's also the program files. Were comic that out? Program files and let's just go ahead, throw in a time here on and score. I think it's my documents. So you know what? Let's put this on a new line. So this is put the tick mark, and that's gonna put a new line. And between that, and so you'll see when I run this, the 1st 1 is the program files to the six sorry 32 bit version and then the where the location of my my documents are, which is kind of funny. Now they call documents and my documents, but that's the way it is E. And another one I want to demonstrate was a command called Split Path, and it's It's a little it. I'm glad I'm showing this because it's a little confusing. First, let's let's get the full path of this and I'm gonna shove this into the clipboard. Remember, the colon equals means we're going to set the value of the clipboard equal to the directory , and then just to demonstrate it, message box clipboard. How do you know what we don't need? The clip work. Let's just call it. Uh Ah. Well, say, keep it nice and simple. We could use a report. It doesn't matter. Path. Come, Save it, Run it. So now I'm just demonstrating We got the value. We stuffed it into this thing called path and then were putting the value right here. We're displaying the value of the variable path. So now I'm gonna do a This is one, because it because it's a command. Well, hold on. I copied that right now, so we're gonna do a split path comma. Now it says the input variable. That is path where we actually could have used this full thing here. We don't need distorting something else, but to me, it's just easier to kind of not confuse you with that. And now the out final name. That'll be the, um let's just given information out O f m. So each one of these things you're creating a variable that's gonna represent what the parameters shows on the screen. Right here. So the output directory, let's say out, oh, TV and then extension. This is calling e x t and out name no extension. So that's the file name without the extension. So say following May spell file name, no extension and the Dr just call that drive. Now, I could go through and, um, put a message box for twenties, but I'm gonna use our little friend list Fars and definitely put up a message box here. Just deposit that way. The script hasn't end, or I could have said persistent, and then it would stayed. But let's go ahead and run this. And now you're going to see here. Let's let's get this so we can see the path. So here was the extension, right? That was age K. O. F. In was the, um out file name. So notice here. It's the it's just the file name, right? It's not the entire path. The O T. D. I believe that was a directory. And there's the directory. And then drive. Where's drive up here? It was the D D drive, Really? The d drive from my oh, I am on the d Drive, so I don't normally work in the drive. And, um, the here's the full path, so that is how you can grab. If you have a path of a file or folder you can go and get. You can automate parsing it without having to try toe use like a radio expression or store strings, but or something like that, which which we are gonna cover that in love it later because it's it's a very powerful thing, but I just want to demonstrate some of the built in variables as well as how to parse that path. Cheers 29. 07 03 Reading Writing Text Files: in this session, we're gonna cover writing and reading text files. There's quite a few ways, actually, not a hot key to write in read text files. I'm going to cover the one I use most often, which was, I think, what most people use. We're gonna use a file read. Actually. Sorry, we first we have a credit file. So if you look in this folder, there are no text files right now. Right there. All files we've been working with so far. And so So we're gonna do file upend, which is a It's a great one. I use it a lot. The texts This will be just by example. So that's literally the texture going to write to it. The final name. Now it's going to default. If I want to place it elsewhere, I'd put the entire path, but if I want it right in this directory where the script is sitting, I could just make up easy name, so example dot t x t and then encoding. I like to store everything as utf eight. I leave it up to you to understand if you need utf eight or not, or or any other encoding I think the fault is ask your maid. That fault is the version. Your writing with the version of auto hockey, What version running. But I like to use utf eight, and I like to control that and said it just that way. I know because I did with a lot of other interesting characters in this way, I just take care of it. So I'm gonna save this and run it on notice. And here, Now, look, there's an example dot txt file will open it in sight, just toe having a different program and so you can see Here it is. Now I want to point out one of things I often mess up on is, let's say I was writing a log file or something, and I wanted to write the next line to this. Well, if I rerun this, what's gonna happen is it dumps it within the same line, right? Because I didn't tell it to put in either Align return our new line. So what you really should do is in here is put in like a tick mark end and let me go ahead and clear this whole thing out. I'm a save it and I'm gonna run this once. And of course, nothing new is gonna be here. Although we do see there's a line to now. Now when I run it again now they're on the second line, right? And if I ran again, I would put in the third line. Of course, I will be changing this. The other thing is that let's say if you didn't want to have that here, I'm gonna cut this and put var and then which I need to fix that in a second far. So I conduct in the text and then put percent signs. Actually, you can, I believe, put just one on the left in the space. But we're gonna do it this way. So from this will add it on. Let me double check here before we do it. So we only have two right now clicking and make sure. Okay, so when I run it, that's how you can save. It is a variable using a variable. Sometimes the texture ducking in there is pretty big, and you don't want to put it in this command, right? So that's an easy way to do that. Now let's say I'm gonna stop writing to it. Okay? Wrong. Wrong. So I'm to stop writing to it. And I am going to read that file. So I'm going to a file read. And now we need to stuff that thing into variable var. We'll call it out far, just so we don't get confused. And in the final name, which again? Because it's in that same directory. I can just say example dot txt. And, um, I can save this and run it. Oh, and which wouldn't do anything. Why wouldn't I do anything? Well, cause I didn't do anything with the variable, right? I read the file, hopefully stored it in this variable, but I didn't display it anyway. So here's I'm gonna put a message box out of our. And now when I run this, it goes and reads that file, pulls it into memory and then displays it. And here's where I could do some text manipulation. I could grab certain things if I wanted to. I could do whatever want it. You know, it could be any any type of a text file. I'm not gonna go into what a text file is compared to a binary file. the vast majority stuff that you probably working with her text files or for trying to read them. And so that's that simple. Now, if what? One thing I want to add here and honestly, I can never remember it. So I just have I use this tool called Quick Access Pop up and I've programmed these things for myself and notice I have a file read with utf eight. Sorry. Utf encoding. Um so let me give rendering of that one that was using was a variable. But here, call it out of our And just so we can see what I added here. So up above I'm gonna changes toe example Txt So both of these are virtually doing the equipment. The difference being in this one this weird star p 65001 Thesixties five years or one is the code page number for utf eight encoding and often on a hockey will detect it properly him Read it in and render it in utf eight But sometimes it doesn't And so I don't like to take chances with it. So I stuffed this thing in here So I recommend if you're using utf eight use this line that have it in there. Like I said, I can never remember it. So I have stored somewhere I could have a hot straight actually did have a huckstering. I noticed it when I popped up there, but I don't type it that often, so I use the DUI to go find it and pull it in. And again this will run. You know, if I had a special characters in there like a tilde any a or, you know, some emoji or something, and it didn't properly recognize that it was utf eight. If I had used the Line eight, it may have balked at it and shown like a question mark or a square on. You'll see these when, when their problems. Sometimes it's a fun sometimes it's encoding, and we have a great webinar on encoding. If you're are nude encoding and confused on it, and it is a very, very, very complex topic way beyond, it's still beyond me, and I do this a lot. A taste. I understand. I have to deal with it, so that's how you can read files. Like I said, there's there's file loops. You can also get just a file. A line from a file if you want. I rarely do that. So that's a little more in depth. But check out some of the other comedians around file reading and file looping. But this is a quick, simple way to both. Read it in write it. And actually, no, I forgot was this one should have been down here. So let's do one more. We're gonna check if a file exists. So there's a function called file exists. And then we put in the file pattern and so that's just gonna be example dot t X t. And so what? I want to do those see if it's there. Right? So I must say if and I'm gonna throw this thing inference. And now if it's found, it's gonna say I'll do a message box here, remember, Because it's it's a If commander is just one line. I don't need to put the braces toe, bracket it together, Teoh say it's one thing. So Mrs Box found file and let's build a 2nd 1 and we're going to say so. That's if it's not found right this Empress Ian, I'm sorry. Exclamation point says if it's not. And then the next thing So it's not found when you say didn't find the file. So I'm gonna run this and hopefully we find we get a message by saying found file I didn't find Found what? Ideo example Don t x t o I didn't put him in quotes. So, um, that needs to get wrapped in quotes. Double Hutz. I should say way go, we run it. So now it found this file and that's why we're seeing this message box. But notice we're not going to the next one because it did find the file. This is a didn't find, so it doesn't show that one. If I change this to say, let's say this is too. And this is a two which doesn't exist, right? This file is not in that folder. When I run it, it's gonna skip the 1st 1 so it doesn't show up because it didn't find that file unit shows the 2nd 1 And so this is a nice, easy way to check to see if a file exists before you try to do stuff to it. I use this a lot when I'm going to write a file for Ah Sanderson, data scraping or something in I want toe. I want to write a header unless there's already data in there. So ahead a row, right? So if there's already the file exists, then I don't want to write a hetero. But if the file doesn't exist, then I want to go ahead and write ahead around and data. And so I'll use this to see first pregnancy. If the file exists, and if it does exist that I just write the data. If it doesn't exist that I write the head around in the data, so I hope that helps Cheers. 30. 07 04 Manipulating Files and Folders: There are some very simple, easy to use commands. Not a hockey for copying files, moving them, deleting them. So let's go ahead and demonstrate. Let me pull up Explorer here. And you know what? Let me, uh, no, we're gonna We're gonna decide what we want to copy was going copy. The, uh, ass trick is a wild card. So copy everything that begins with whatever and is a text file, which is just are one example file we just worked on in here. We can see you. So here's the example dot txt file. We're gonna move it. So, Adam, the common now the destination. I'm gonna put it into the If if we had a full another path, we put the path right. But the fact that the L I B folder is in this directory, I'm just gonna put l i b in a backslash, and then this next one is if you want toe override files already there, you can put in a one or a zero, but I'm not gonna do it, so I'm gonna leave them blank now. I'm gonna run this so it's gonna move. Come back in here. Help. Hey, example where to go. We moved it to here, right? Was that simple? I'm gonna cut this and move it back up to here. He And so now let's copy that file instead of moving it. So it's really the same format. Asterix? Txt! If I just wanted that one file, I could put the name of the file on this to me is just a little bit easier. And then where am I gonna put it again? I'm gonna put in the Allied d folder, save it and run it. And now you noticed example stayed here, but in L I B There's the final. And now let's go ahead and deletes that file we just copied. So final delete. It says file pattern. I'm gonna, um I'm gonna rely on that. It knows it's in this directory. Him? I say L I b slash And then start not txt now that don't delete all files in the subdirectory. L i b And so when I run this and there goes and so it's it's that simple. Like I said before, there are other ones. There's looping over file patterns, and you can use these in conjunction with them and they become very powerful, but that's pretty advanced on, and I just want to cover the basics in this. So this is just the simple copying, moving and deleting files. 31. 07 05 Working with Text: all right, this session we're gonna be manipulating strings and strings being text. So I I do this a lot. It actually it was really surprised me how much I end up doing it, but it comes up a lot, so there's ah lot of other ways to do it, but we're gonna covers from the big ones that come up a lot frequently, so string will place. This is a really simple function, and we're going to replace the haystack is what you're looking in. I just think it was a haystack. Never needle. Right. So that is gonna be very since we're inside a function, you don't need the percents. So the people txt because that is noticed. It's That's what's up here. What's what. We're storing our text into what we're going to search for. That is gonna be a string. So we're going to search for let's say Brown, and that's what we're searching for. And we're Atacama and what we weren't place it with was say, blue. And now I'm gonna do a message box after this And you know what I'm since we're gonna be using the same string, I'm gonna dump it down here. And just so I don't have to keep moving it. So when I run this notice instead of saying that aside, this up the room Brown from Oh, I didn't I didn't sign it back to Rio. So it did it. I just didn't store it. If I had done a message box right here, like, if I get rid of this and put my message box right here, it's fine, right? I didn't change the variable, but I'm displaying it. This is what I alluded to earlier with using functions. Um, but I'm gonna go ahead and stuff it in here. I'm pushing the results back into a variable. Doesn't have to be the same. Variable. Could be different. Variable. This could be Bob for all that matters. As long as I put down here, Bob, when I just play it right, But notice it replaced. Now let's get back into it. Replaced the quick blue fox and blue dog. Right. Well, what if we just want to replace the first occurrence of it? So that actually is a functionality here. This is the Count Palace. Will going stuff in here. A variable called CNT and the Limited We're going to say one if if you put a minus one, that means don't limit. But we're going to say the 1st 1 So here now, let me let me say this and run and the first thing one notices Now it says the quick blue fox in Brown Dog would only replace the 1st 1 right. But what would could also be cool is let's throw in a tab and then say CMT should show us how many occurrences it found right? And I guess because we had this limited the one. It shows that the recurrences that did, apparently. But let's change, just let's just get rid of that. We run it. And so it replaced twice and says, I'll tell you how many times a replace that which sometimes is very, very helpful, Right? So that's the replacing of text weaken trim things. And so we're gonna trim text, and it's, um, which will run at first and noticed. You know, what I need to do is let me fix my message box down here and do a couple things, so we're gonna put a quote in a pipe and then another quote. Pape. And this will help us see. See how these pipes are right next to the text. If I turn this off and we run it, their spaces in between those rights of the trimming is it defaults? The trimming whitespace. If we wanted to change that, we can add a character after it. So let's say what's just Liz Elice. Let's leave this one as it is and let's make up a new txt because users do you write that and then, um, txt colony cools trim. And then what are we trimming? We're gonna trim the txt, and now we're gonna admit characters. That's what the admit cards. I don't really like that turn myself. It sounds like I things I don't want to do. But let's put in here a zero and run it and notice it trimmed off the zeros right from from there. If I put it on the right side as well, you did it from both sides. Now let's say we just wanted trimmer from the left side, not the right side. So there are two additional easy ones. We can say l trim. Well, just trim it from the left side. So notice the zero on the right side. The 2 to 0 right? It's still there, but or let's say which one on the right side we can do right side, right? So it left the zeros in the left. It will work with the spaces with whatever said the l trim our trim and just trim those air . Three ways that you can easily get rid of characters that are, you know, on the on the ends, which happens more often than you think in string, is a great way to see if there is a value inside the string you're looking for. So, um, let's do so. Actually, we don't want that. We're going to a message box here. This one. We're not changing anything. We're just checking for a value. So So what are we looking for? The same txt. But let's go ahead comment that out, you know, Let's see, in just two and B and A and B and up with a message box here in this way, let me run that. Make sure it works. So when you guys see this, they're different tone looking. I broke so I didn't finish my own area. Okay, so that one still works. I just didn't want to mess with the original one in this way There they're separate. So back to this one. So txt and the needle, This is what we're looking for. Well, let's look for Fox on notice. It says Case sensitive. Oh, I gotta add the comma if I wanted. So do we want in case sensitive is your are a wonder is probably what we put there. Let's leave it not case sensitive starting position. If we only want to look a certain spot, we would put this in there and the occurrence. Let's say we want to find the 2nd 1 right. We could put that So for now, let's run this and it's saying 18. What that means is, and let's take I should should be right there. I think that should be Copy this peace to here. That's 16. I would have thought that this should be Oh, it looks like to that. Carm 16. It's interesting. Ism studio is automatically trimming. And so this is where foxes and the up above and notice right here. The F is the 18th. I'm looking down here. Calm. 17 again. Position one drew for in a column a team. So this column right here that's saying where it's starting, right? So that's what it's returning. So the fact that returns any sort of a number, let's say this was Fox DD and we re run. It won't run because this the assurance zero means it didn't find it right. So that's a way to check if it's in there. If it does come back with a value, then you know that it's founded in. It tells you where it is. We could also just changes to Ah, not and run it. And it comes back as a one because it is correct. It did not find it, which is what? That Sam, which is weird. It's a negative, checking for a negative. So so that's in string, that one. That one could be combined a lot of other ones that you're really helpful, just restored length just tells you basically txt how maney characters here Texas. So this is 35 characters long. If I highlight here to hear, I believe down below here we should see calling for Here we go count 35 right? And that's what that message box was telling us that's the length of that value. Sub string is really cool. We'll call this sub equals sub string. And here we're gonna say What? What string? Um, we're gonna look in t x t. That's what we're looking for. And the starting position. Let's say we'll just start with one. And the length is gonna be What's our first word? That so we'll say three and save this. And now let's show a message box. I could have done it right on that same line sub and it picked up. That's interesting. Oh, I'm sorry. Because, look, I have that space at the beginning right here. So the 1st 3 really are 123 Right? So it is the th that we see here. So I should have said four. Right? So if I wanted that, but then I actually should have trimmed it. Now, let's actually say, um, let's put the pipes in here like we have done below to demonstrate that the space is on the left there. So notice how there's the space between the pipe and the T. What we can do. This is a cool thing with functions. Right? Is we can actually wrap this in that other function, right? So now when we run it noticed there's no space there. Right? And it worked. But just to be clear, right? This this is what we had in the line of above. And then we wrapped it with the trim function, and so it can all be done in one. And even then, if I didn't need to actually store that, I could just use that in a comedian. I don't have to have it. Colon equals here. I could just put a message box. Um, right here and just display it, right? What I do playing 14 0 Noticed. Come on. That was the problem. So now in a run it so Oh, but I didn't have the pipes, but anyway, it does run. Fine. It would use it, but we don't have toe store. It is the point. So let's put that back there. Okay? So stir split. This is one of my favorite functions. Very, very cool. Let's say that we wanted to split the txt, and when we split up were split on spaces. So we'll put in a space here, right? And, um So what parsed and now parsed dot one. I forgot my message box in front message box and run it. Oh, because let's do the 2nd 1 So it takes your string and parses it on what you told it to parse on, right? So we said Purse on the space and then the unfortunate, very first thing is a space. And that's why the 0.1 came back with just the space that ought to is the Let's go ahead and add. Oh, I forgot us putting a tab, then a 1st 4 So what is doing is it puts it into an array on and then you can see here I can keep incrementally a am it is parsing this on the spaces, right? So that is how that is working. It's a really helpful, easy way. Do you have a really cool thing about this? One is like I said before, right, If we didn't really need to save that variables of, you know and then use it, we're gonna delete it. I can just call it straight up and say, Let's get the 4th 1 And I don't even need this story in the array, right? I could just call it directly, and I can use that in anything. So I contribute to the 5th 1 right? So if you're trying to grab a specific thing, it's a really, really helpful function to be able to split things and you can split it on. You know, that's what Let's, let's first say whatever reason we want to split it on every evil, Let's say E noticed. What are many? That's kind of funny. I think they'll studio B C couple of these and sell us to get the second be So notice it took out the be right cause because it's saying parts on it. But it's fitting everything to the right of the second B, which is brown fox and up into the next one. Right? So three is going to give us round dog because it's pursing off the bees and it's gonna give us everything up until the end, or until the next B, which didn't run into Citrus, gets us to the end. So that stir split is, ah, wonderful function. I use it a lot. The next one sort. It's ah, not necessarily for manipulating text. However. Let's say you had a multi line no Let's just stop. Bring that down here. It is quite different. Quick put the whole bird text. Copy that. So I don't have to keep typing it. This is a you know what? Let's let's do it. I'll finish it this way. Then I'll convert. It will die more time line. So let's put up a message box. Say you've written. Run it, I think. Look, I forgot my equals. I can't take So this is a multi link text, right? So I was using the tick mark end to break it across lines and now, as well. Go ahead and leave it of that. Let's say I wanted to sort text and I just leave it at that. And the default, I believe, is a sending. So notice how it changed the order of everything right. It's a great, easy way to change the order, and it automatically will parse it on a line break or a line return or a new line. I forgive. It's like trendline. Obviously, it's a a new line because it's working fine there. I think we use either having said that that was for the A sending and then I think de is descending, apparently not options. So let's looking out right for one. Pretty help. Bring it over here. So sort case sensitive, numerically c consorted numerically, which is sometimes comes up. Reverse oil. That's interesting. Why would you? That's weird. Okay, but it's our is the one I've taken of you, which will also demonstrate here congee do pit, which also comes in very handy. So our when we run this so it sorts it descending, I guess, because they have the numeric sorts. That's why they said, you can reverse the sort and they don't have to worry about hastening descending, I don't know, but there's that. Let's put in a you and let's put in a couple of I'm gonna duplicate this and put one above it. And then let's do. We'll do this a couple times in a couple different spots from there there and there, and when I run this, notice how we have a multiple times now watch. The next one is only listed. One. There's actually a blank line somewhere, apparently, but it's only listed once on, and that's the you makes it unique or de duping it, which is very handy. It Zaveri cool functionality comes in super handy in is super easy to use for the most part , all right, that's the other ones. I'm not gonna get into them. This Reg exe stuff down here rejects maximum rejects. Replace. It's a really complicated topic, but I do want to bring it up because regular expressions are their pattern matching things , which I will use them. I try to use them sparingly because it's somewhat complex, but they can solve problems that, like you would never believe. So they're really helpful, and that could be really save you a ton of time. They're trying to use a lot of the other stuff, right. 32. 07 06 Built in Variables: in this session, we're gonna talk about some of the shortcuts in writing syntax as well. Some built in variables. Auto hockey has automatic has a ton of built in variables. I'm not gonna cover all of them. I'll show you where you can look them up. But some of the one that I use a lot I'm gonna at least described, maybe demonstrate a few. So right here, let's pretend like you had this message box and you really wanted to go multiple lines. You wanted to use one message box. But you wanted your syntax rather to go on both of the lines because we're getting kind of over two right here. And let's say it would keep going. And it's just easier to read it if we put the continuation part. Like right now, Distrust says Hello. How are you, man? Great. What else was going on with you? But let's say we want to have some more text in there and notice I have the two line returns, actually, from new line feeds, what you can do is put a period and then that is going Teoh combination kind of thing. It's kind of it's gonna depend what's above it. So, um, how much are you? So I'm gonna run this and you'll see now it threw it in there right in again. Aiken. The new lines, they're not required. They're just helping me see how it's breaking. So I'll run it again and again. This is just to help you, you know, be able to go back later and read your code and have it easier, more concise. Sometimes you have something long and it gets very confusing when something is way over there or it's off the page and after scroll and you can see the other side. So I like using that. The other cool thing. Weaken Dio. The one thing I don't like about this is that I have toe I could do the shift F one in studio that'll commented out. Otherwise, I got to come out each line, but a comma can be used to Let's say you were defining two variables. And for that reason, he knows you wanted your ex con equals to be 10 and your why to equal 20. And now here I put up a message Box X, and actually, let's let's incorporate the ones below. There's some special characters and I've demonstrated, like a tab, a underscore cab that's gonna throw in a tab. I could do this at his equivalents. Doing this with the tick mark T That's a tab. But to me, typing the double quotes just not is pretty to read in in. I gotta make sure I close my quotes. Which student is a better doctor? Take care of that. But I like using the a underscored tab and then it just it reads. It doesn't jump out at me the way other cept us and why? So we run this. What did I forget? I forgot my percent sign. I do that a lot to make it into an expression. So 10 and 20 right? Well, what you can dio is you can put a comma here and move that up into the same line in hot key Will actually say, Oh, you know what? He's to finding two variables here and you could just have them on the same one. Not not everything allows for my command still now for that. But functions defining functions or using functions I shouldn't say defining brushes, using functions, function calls you could do that stuff with it. If you define a bunch of them again, you can just have, um, actually numbers. I don't have to put him in that. But let's use the A underscore space here to show this shows E. And so now you can see the 20 and 30 or closer together cause I use space instead of a Z. Another thing I like to do is I put it in my file that I included everything you know. What I do is I come in here and I say, a underscore I called Enter his It's just cause What is it, a bad name? It should be like line return, um, equal that, too. Till day. Uh, tick Mark, Uh, let's do our pick, Mark. And it can probably be one of those. But now what I can do is I can use that down here. Oops. Underscore Finster. Now, when I run it, you'll see it puts down the Z on to the next line, and again, it's There's no trickery here. It's not a special. It's not a built in variable cause I created it. However, I just stick this into a file that I always include, And then I could just throw in the line break without having to put the quotes and this this kind of stuff in there, not a big deal, right? But for me, I just like being on a have that. I wish that was the default thing. So that's what the special characters now let's look at. The other thing I should mention, is not that stuff that most people do without a hockey performance. Just it's almost irrelevant. Right? Things happen so fast, we do simple things. It doesn't better. But apparently, defining of variables this way is opposed to this way. The other way can be a bit faster in the efficiency. So when when you can, you might want to do it this way. Uh, again. It really won't matter for what we dio said. Special prayers. Now let's get into the built in variables. Let me pull over here the help file, and if you if you search for help on like built in variables, you'll see there are a lot script property. Here we go. So here's special characters, and then here, the things that begin with a underscore right? These air built in variables, and I'm just going to show you these quickly, by the way, these date and time ones super, super handy. Also, auto hockey has a built in calendar that you can use toe pick a date and time. That, to me, was a bit advance because I didn't really touched him. Goodies, goodies to me. Everyone I talked to there, they're much more complicated. So I don't want to do that in this one, this training course, but maybe another one will do entirely separately. But you can see here there are what I'd say at least like 100 built in variables. Eso I'm not obviously not going to cover all of them, but it's definitely something, you know, if you're doing something you might want to look at, I do want to highlight a few. So we covered earlier. I believe that working directory and script directory. Actually, no, I don't think we cover working directory. That is just You can change the working directory to be a special place, which isn't where the script is running from, and so you can look at what it is, and then you can set it as well the script directory. It will say where that script is. The script name that when I believe we also showed, and it will show you the name of the script that you're currently running those air. Nice. This here are a bunch kind around, like Windows and Things with Windows. So it's that the OS version right? The type. I think that's the bit nous like 32 or 64 bit the screen, height and screen with which is really cool cause on a program. You're looking at you. I'm sorry, mentions of your your computer screen and with on hate where your documents are, where your startup folder is. So if you're installing things or if you want a check of the program's been installed, you can get an idea where that path is and go look for it. A programs I demonstrated the A Programs files earlier, but this one's a little bit different. The APP data. So a lot of programs will save data into your users APP data, which and I should have put in here. But here's a computer name, and then there's, I think it's a underscore user user name, and so that will show the user that's currently logged in and sometimes like the computer name in the user name. If I have the same script on running a multiple computers and yet the paths where files are installed, I'll use that computer name to use some logic and say, Hey, if it's computer name is Godzilla, which one of my computers was, then look here, too. Lots of program. If it's, um, Smith, whatever another name, then look elsewhere, right? I also did with user names where people I was writing a similar script, but they have a little bit differences they wanted, but I didn't want to have multiple scripts. So I used a user name to look at the user name and say, Hey, if it's if it's Jim, you know, do this thing If it's John, do this thing And if it's Joe, do something else right? So it allowed me to have one script, have it all together, and yet it would look at the computer and look out your window settings and acts differently. The here are some of the date time stamps, so I think the 1st 1 a D. D. D. Is the day day of the week on the month. Let's do this is to message for us now. I should have them all and do a search. Replace here, especially cause, uh, yeah, search replaces a much more efficient. Actually, we know what the our minutes seconds is gonna be. And then let's throw. Let's move this one over here. Comment this out. So I'm gonna run this so Thursday. That's the month. The day it's a 27th of June 2019. This is the A now, which is a great one to know about its ah timestamp that you can pull from the time you could do math on time without a hockey, it's really easy. Once you get the hang of it again, it's it's a little advance. But there are tutorials out there for doing that. The other one to that, I wanted to mention is we touched on earlier in the clipboard. A index. I'll leave that here for a minute. So let's say I want is I want to see what's on the clipboard. Actually, let's, uh, let's stack the back right. Let's copy that. I'm gonna copy that, and I want to run this and Hey, I just shoved. I copied it, but I can see what's in the clipboard. But let's say I actually wanted to, um, set the clipboard. So now let's show the clipboard. So now I have said it and then I'm displaying it. And there are things that either is Ah, um, a way to check to see first if the clipboard has value in it and first have to blanket and then check to see if its value against a little Marvin. But if you do have run into problems putting data into the clipboard, just know to look for a thing that says, Hey, is a clipboard have data in it yet. If it if it doesn't, then we'll pause until it does. And then you do something. But But why would you do this? Well, let's say, um, you were working in a program. Put a hot tea here. We'll do control teach, because I know I don't I don't have anything to that. So and you know what? I actually, this shouldn't really be inside here because I don't want it every time to copy it. Every time I hit my hockey to go stuff, something in. Oh, no, I do. I do. My dad, Um, every time I hit the hot key, it's going to go Because the problem is, of course, I could be running this later. Something else might have overridden my clipboard. So each time I want to shove something into the clipboard and then I'm gonna say, send And then if you remember, the carrot is the control. And then v So I'm gonna save this and run it now. Nothing happened right now because I made a hot key for But if I hit, come out of here and hit control T it pasted Ascend Control V to wherever I am. So I can do that anywhere. Actually, that I'll put windows. If I say that, I could do anywhere in them, that output wins a little funny. So if I hit control T right there, or this one should work from sight, Um, I accidentally twice, but any windows in Sometimes when you're trying to send keystrokes it, um it doesn't like sending the, uh sent the control you're sending the keystrokes to Doesn't like to receive keystrokes. Having said that, often you can click there and hit paste and will dump your text in. And so sometimes this is the way you want to go. If you're having problems sending place, the other one is if you have paragraphs like when one of my examples win on hot strings and the enemy course. I think I dumped in the Declaration of Independence. Or maybe it was doesn't matter, but there's no closure in Penance e. M. Into the clipboard. And then I was trying to send keystrokes, but that's a lot of text to be sending. It's literally sending those keystrokes right, and it takes a while. When you send paste, it just dumps that text in like that and it's it's over with. And it's a much better way when you're dealing with Big Tex that you're sending something. The very last one, which we didn't cover loops I'm not gonna cover in this course just cause easily can write a course on doing different types of loops and on a hockey, and I probably will. But a index is something that you will end up seeing a lot, and so just so you know, it's basically every Scient time you're doing a loop, it's going to increment the annexes where you are in that loop. So if I just say loop, this is one type of loop that might be gonna have anything here I must say, a message box. So I didn't put any sort of restrictions on how many times is gonna run, But I need to get rid of this because it would never get to it. Right. So here we guess I'm gonna run it, and I notice is 123 So all it's doing is between lying 27. 28. It's going. It's looping there over and over number because it's one line. Otherwise I'd embraces and just keeps incriminating. And so that's what the A in next does. It just shows you what increments you are on that loop. And so I'm sure you'll see. I wanted to show it, because when you go to the Forum, you'll probably see examples of other people having done stuff with it. And I just wanna make sure you intercept of a us. All right. Cheers 33. 08 01 Activating windows: this session, we're gonna discuss the wind title and some other things that we can use with similar to win title. But it's basically want toe, activate a given window, are connect to another programmer, hide it display it, minimizes whatever you want, right? There's a lot of things you can dio, and it's a little confusing, so I want a baby step into it. First off, there's a setting called the set title match mode, and you have There's the options are kind of weird to me. There's fast, low rejection than 123 the fast and slow options. The default is fast, and that works for the vast majority of what you're doing. So don't even gently speaking worry about putting fast or slow. Just leave that blank. The other one's the 123 or rejects. The one is the Windows title. Must it must start with that. So, like this one, it would have to start with HK studio because at the beginning part, right? If if we were looking at site like this one, they would have to match example dot txt and then have the full you know, we could look, for example, not to exceed. It would activate this file because that's what starts with it on the, uh, the two is. Generally speaking, it's Ah, it's a great approach, unless you have a lot of windows that are similar because it can. The text can be anywhere in it. By the way, they're all case sensitive and less than regular suppression. You tell it not to be case sensitive. All of these are case sensitive. So you got to get the case right. And so let's just go ahead and do a couple of examples here. So let's start off with Let's do one and we're going to demonstrate on Let's do Flynn activate. And now this is what we put in our title. So if I put in, let's see one was what when this had on my start with. So let's to the example example. You know, if I run it, it just activated site for me, right? But let's let's say I put in this site instead. Actually hot stream for that cause I take a look when I run this It didn't it didn't activate it. Why not? Well, because we're at one and one says it has to start at the beginning of that title. And since what we could do is use the to write, the two is going to be It could be anywhere. And so this is kind of like a wild card, a viewing. That is when I run it now. It matched it. But But here, let's say I I forget to do the case sensitive when I run this right, It doesn't. It doesn't activate you gotta You got a match. The case. So it's very, very important. Remember, that's case sensitive projects, regular expressions. I'm not going to go into that. It probably this one. It would work just fine if we I think we changes to a three and run it now. Every putting a allowed card in here. Yeah, regular expressions. Take a while. That the star is means something. The Asterix mean the wild card. But let's not worry about that, because after oh, and I was doing an exact match because I'm an idiot. Okay, for here we go was trying this again. So because there is no for its Reg, Exe I obviously don't read nearly as much as I should. No, and looking that actually activated it just fine. Uh, now there's some other things. When you look up and you search for this, you'll see it says There are other things you can do with this. This is matching this title and now let's let me show you here. If we click on a running auto hockey script, you can say Window Spy. And that is one way to launch this. I have a hot Kino launches because I use it a lot. But if you go toe wherever auto hot, he's installed and look up HK. You'll see here is Window Spy, and that's another way you can launch that. This tool is one of the ways you can go and look and here's the title so I can copy it in here instead of trying to type it. Or, you know, look at it. I can do this and copy it, but they're these other items here now the p I. D. And I'm surprised the ideas that listed, but maybe it's just the P I. D. And that one it's the I D for that instance of that program. But forget about that because chances are at the beginning or not, I'm using it. But these other tooth is HK class in HK. Underscore dxy These can convey very helpful as well. So let's comment these two out and now we can demonstrate here. So instead of putting in a title So let's say you know you're running. You always want to activate site and you don't necessarily know for certain the program's gonna have the name of the program in the title. This is a great way as you would you'd use this tool, the windows by tool in activate. So we're gonna activate site And now I'm gonna see Oh, here is this class site window, right? That is what I put in here. And now when I run, it activated that window, right? The other options. I could have used the XY, but I'm gonna copy both of these and let's duplicate this and then comment that line out and pesos in there. So now when I run it, it's using this parameter and that executable, which I grabbed from Well, I was on insight here so he can see it. Here we go. So that's getting that now. There are a lot of other comedians that you utilize these classes and the exes, and that's why I want to do this one first. Just Wells with the title. But for now, I don't want to have the video too long, so I want to break it down. But if practice with this, you could even you know a simple way would be, Hey, you know what? I'm gonna I want to make a hot key toe to activate site. And so let's do what? Um, let's try Windows A And now and now when I hit, when does a it activated site for me? Right? So it's Zoe again. Auto hockey. It's amazing how easy this could be to do what you want, so that activated. But even then you could have it send certain keystrokes or or if you get really advanced, you could say, Hey, send something to this window without even activating it, right? So it's a lot of great stuff. Video features 34. 08 02 Window Existance and Activation: in this session. We're gonna talk through and use some of the cool tools for looking for programs and see if they're already running. If there's a gooey ah, window existing for it, let's go and start off with win weight when weight is a command. And let's say we're gonna wait for note pad notice in line for up above. I've set the title match mode to which, if you remember two equals having the search the title be anywhere in the name said the word that you look for a note pad could be anywhere in that title bar. So right now we don't and and of course, this wouldn't do anything. But we're gonna put a message box right here. Towns. All right, I'm gonna run this and notice the green age down below. No, it look. It popped up. It's running. And actually, if we double click on this thing, we'll see it's sitting here online. Five waiting for something for there to be a note pad. Now when I launched note pad, I don't use no penalized various. So the second it launches says, Hey, I found it in it moves forward. So of course, this, you wouldn't put a message box. Maybe it would be to activate something or you want every time like a window exists. Let's say you want a pop up blocker, and every time this wouldn't do exist, you want to close it. And so we could automatically send like a nen turkey or send something to this control or or click the find the okay and click the default value or something like that. Right? So that's Ah, good one for a win weight. Right? So it waits. And of course, this takes the the title. Or we also could have brought up our handy tool, the wind spy in grab either one of these. So actually, the HK classes the same This way. Note pad here is gonna work the same way because it's it's no pad was exactly the same. And even the XY would have to add the XY here. Perseus. No pad dot Txt. So what? I run this out. Just run. It should pop right open with the message box because note pad is running right. It doesn't undo it. So let me rerun it. Launch it. It's sitting here waiting right now. We launched note pad, and then it finds it Jericho's So that works with all these, by the way. So the HK class let's go ahead and turn that off and let's put this down one. Now, here's another one. If we just want to activate it and, uh, this let's go ahead and borrow right from here, right? I'm gonna put this down here, Save it. We don't need the message box because it's just gonna activate it. I'm gonna minimize this and let's see what it does here. So save it and run it. And it was an activated and notice where my cursor is, especially if, like right here minimum well, we can leave it there. You'll see it. See, my cursor is here in the studio and I run the script and now it's activated. Note Padden, and it puts me into wherever you know that the default spot is so that's the activating those work the same way off the title or class or XY on and let's do win weight active. So here's I think I demonstrate this one before when we active, So we're gonna come here and again. I think that's in my clipboard. So this time we do want the So we wanted to have a message box. So I'm gonna run this and right now notice Nothing's happening, right? The scripts running and it's waiting and waiting, waiting, But watch what happens when I activate note pad, then bam! Then it's active. And so you can. You can wait until that windows active. You can detect that programmatically detect it. And then when it does become active, you know, do something you want with it. The one exists also, I think I cover that another one. But this one, because it's a function. This one is a slightly different that you gotta wrap it in quotes pad. And this is gonna be a logic. So if when exists, that's its box. So when I run this, it should find it right now. Right away. It ended. Wrap this whole thing. And Prince Well, it's interesting. It's not Well, let's make sure we were sitting in the right spot low it active when we active. Oh, look at that. I didn't bring it off. So now it says, Hey, it exists. Let's close this Rerun it now. It doesn't do anything now here's that the difference and that is this is an if statement. It's not waiting. It's not waiting for that become active. So it's just a logical test. So you wouldn't use this to to wait for that one of the big ham active. It's just a check. And so it's a nice way. Let's changes to be not if, if not when exists now it's gonna pop up because that would know doesn't exist so again. But once it runs notice down here, get access out of the script because it's not like the other one to says when, Wait, wait for it to happen. Even those will exit after it gets past it. But that's, Ah, that's a 35. 08 03 Moving Hiding Showing Windows: in this session. We're going to show you how to get the position of the window to move it around, hide it, show it on, close it or kill it depending on the program. He and let's start off before I actually begin the session. Notice I have Ah, hot key road appear. It's controlled t So the carrot is the control, right? Control T and I'm gonna run Note pad. This is because I don't have ah button up here for no pet. And plus it's just convenient, right? I'm gonna keep launching note pad a lot. So this was makes it really easy for me to launch it. And the 2nd 1 I want to point out is the set title match mode we just covered is set to two , which means anywhere in that title you can put the name of. That's what we're looking for and we're gonna be using note pad in this example. But this works with virtually any other Windows program. So let's go ahead, E. And let's see is a running. I got a green age here, but I'm not sure what version is something We launch it that's are in control t. So I just launched note pad that just ran it for me. Now let's say I want to get this position and get other information about it. So says when get but pls But we can get the X. And why was store that? It's asking for what variables Darwin stored in. So let's just store those on the X and a y variable and then the width. Let's put that a w and H for heightened. Right now it's asking for the title thistles where we put in our note pad. We could also use that the HK Underscore class or the HK underscore Dxy that we also learned right on this example here. I'm just going to use in the title bar the name so note pad. And then, of course, we need to show. So let's say let's do list Farr's And then let's put a pause here. You know what? No, it's gonna state running because I have a hockey appear right. I was gonna put a message box, but we don't have to worry about it cause it's gonna stay persistent. Where I could add it persists up here because of that hot key it's going to stay running. So I'm gonna run this and oh, you know what? I don't have a way. That's funny. So I don't have a way to get to it. But if I just move this one down here, so see, what's happening is that control t appear at the very beginning. It got to it and that stopped executing things beneath it. And so this moving it down here, it's gonna run through this first part and then I'll get to here and so I can do it the same way. Now, when I hit all our it is going to give me that in Here are my height with X and Y So though the exes at 1000 wise a to 68 in my height is 5 82 and I with this 6 16 I'm gonna little screen clip of this here, so Aiken cheat from it because I'm gonna adjust some of these in the next one. So let's go and get rid of this list. Farr's, um and let's we're gonna work on moving that. So we're gonna move now. Here. It asked for the title in the second parameter this is why it's so important to pay attention to your parameters. So, note pad. I mean, it's gonna ask us the text. We don't worry about that. And then X is gonna be where we want that. Well, the X was 1000 Let's sense in 900. So that will be a little bit higher up in the screen are now a little further to the left. And then why at 2 68 So let's let's make that 2 50 And that was gonna move it up some. And you know what? Let's just start off with with that and let's do it this farce after, so so we can see those. So I'm gonna rerun it. And did you notice? Unfortunately, that was far is covered it up, but it moved it. And so now my X is one 1000. You know what? That's interesting. I saw the thing move. Um, I'm gonna be run that interesting. I think what happened was this popped up so fast, it got the value before it finished moving. And so it had moved forward and auto hockey. I should have had a little bit of asleep in here, so that's a good to note if you're going to go get the values right after, you might want to let it sleep for, like 100 which is one thousands of a second. Because I saw it move. It's just it moved after the fact. And so I moved, If the 900 to 50 so that got registered here. Now let's go ahead and get rid of this. And let's not use a list faras just cause it covers up everything, but let's go ahead and change. We're gonna use the same one instead of changing the height than the start of the X and the Y, Let's change the width to be what was the with before, which was 6 16 So let's make that 700 let's just run it. We got that. We just saw it got on the lighter on. Then let's change the height. The height Waas 5 82 will say 6 50 and we run it. And so this is how you can control the height them with and everything else, right? So it's super easy to do very convenient and just make sure that you, if you do go get it after you move it. That you maybe you wait just at 1/10 of a second. All right, so let's go and comment that out. Now, when hide is pretty cool when you run it, it will hide and notice. Notice, Note. Pad over here in the task bar. Right. We can see it, but I'm gonna add in. I guess I should make a hot string for note pad because I type it so much. So when I run this notice it disappeared and not just disappeared from, you know, the screen. It's over here too. It's gone, right? And I can show you it's still actually in existence. Let's, uh I'm gonna run. This is going to show it. But what I wanted to do is just to make it very clear. Now, this is gonna hide it. Wait a second and 1/2 because that's 1500 seconds and then display it again. So I'm gonna run it and see this. This is the same one. The text I wrote in here when I run it tonight. Oh, I was I hit my hot key, but I was inside Note pad, right. I hit all our which runs my script, but that is inside. That doesn't work outside of studio, cause that's a built in thing, right? So now when I hit it, mount hides it and then it comes back. So that's demonstrating these. That the last two, There's no riel. Clearer. Easy to explain difference between the two. They both pretty much do the same thing. It just depends on the program, and some things don't like to be closed. This one, it both of them, they should. One of them will close it and when will try to kill it and they have the 2nd 1 just a bit more extreme. But let's go ahead when I do this. Since there's I haven't saved, let's get rid of everything in here now. It should be just fine. So when close, of course, we're gonna add pad and it's coming out these and now run it And it closed. No pad for me, right? So I may hit control t to bring it back. Yeah, that just we launched it. And we're climate that out and here and we'll add no pad on Run it. And that kills it. A swell control t you bring it back Now if you had some text in here If I type something in when I run this notice, I haven't saved it. So when I when I go to run one of these, it doesn't close it. If it's asking you Hey, there's a file that has been saved yet. So doesn't override that. I thought the wind killed did, but it doesn't. So you can hit cancel here and then it won't happen. But that's the one close. And when kill these again, are all these things? I think I'm pretty helpful. You can decide where you want a program to open every time you can change the size of it every time. If you don't like the dimensions of it on Bouvet around, just hide it. You can what I like hiding idea to doesn't even show up here in your task bar. If if that's what you want, it's really community 36. 08 04 Setting and Getting Info: in the session, and we're gonna cover this win set command, which has some pretty cool stuff. You can adjust the transparency, even enable or disable windows. You can have it always on top or turn that tunnel it, turn it on, turn it off. A swell as the getting text. No, I don't. I highly recommend this. Overall, there are better ways to get text from window. But this is this is one way. And then also the status bar, which is on most programs at the very bottom here. Sometimes there's information that you like to see. What it this So first for the wind set. Um, that s apparently I haven't always on top, so let's let's do that right now. It's let's move site over studio. And so notice. When I click back on studio, it goes behind it. Right. So I'm going to put on ta go. So I will turn it on first, and then we're gonna win titles. See, I e and notice up online. Three. I have it with it matching anywhere in the pattern. So I'm gonna run this. And now it almost made it look like it's active, but noticed my cursor still over here. However, even when I click studio right, it doesn't matter. The stays on top, others. And now I can turn that off and we run it. And now it goes behind it. What? Another cool setting here is just the toggle. That's funny, but the ta go will alternate, so I'll run. It turns it on. So now it stays on top and they are running again. And now when I looks one, here we go. Now it turns it off. So that's the toggle. Just flips it back and forth. A zay said There's transparency so we could we could make. Let me see here. I don't I don't use the transparency that often, but so we're gonna leave the site here. I think so. Trends current and let's set it at 1 50 So now when I run this, it is going to not work. I don't think I suppose to have a common here. No, that's supposed to be there, said Prince Parents Teoh, trim, transparent Trans. Oh, I forgot to get rid of always on top. So notice now, even when this when site this in front of studio I made it somewhat transparent and you can just a justice number. Let's say it's 50. Save and run. It makes it really transparent. So you can barely see it versus I actually don't know what the highest number is. It is 300 2 55 Here's the value. So to 55 is a solid background. So in a case that I think that's pretty cool, the enabling disabled is also pretty neat. So it's get rid of this. Yeah. What? Seeing abled? Actually, I guess we got a first Disable it this and thrown another common there. So when I run, let's see him. Make sure in the right spot. Always on top. Yeah, So I'm gonna disable it, Okay. And I was in a bold, so I'm a disable it, and now it runs him. You probably can't hear it, but I can't even activated. I can't do anything with it. Basically, it's kind of like it locks it right. It disables it, but I can turn it back on. So now when I run it, then I can activate. It apparently should have turned off the transparent, made the transparency back to solid. Um, let's ashy lips do that here. I'm just hitting. Undo a bunch Prince Parents to buy five. I could just closed it. Reopened it. That would have been fine. So now we have macro window. Um, I actually I don't know if this works with studio. Sorry. Site Um, the wind get text. This'll site window for some reason, sometimes is a little different. So we'll stop it into a bar and then when title is going to be five e and then we need, of course to the show when it wa So now when I run this. Oh, look at that. So here's a good example why? I don't recommend it. It got every note noticed did get This is the tax to in this window. So here's that this is a Texan this window But it also got a bunch of other texts that is in sight. It's in here. It's just not easy to parse it out. Right? So there are ways to get controls and connect the windows. Haven't said that like I use this note pad and no pad. You get the text of the window so it can work there. The last one I want to cover with the status bar and well done this in Navarre also. And then the part number there are on some programs. There's more than one status bar, and if you don't enter one, then the fault toe one which is the main one that you want and again put in sight. And I want to run this. You notice what they got here. This this down here, which, by the way, I customized my status bar, which is the great thing about site. It grabbed it and put into a text mark. So sometimes in a program I'll be waiting for to execute or I want to check the status of it. This is a great way to see what's going on with that program, and and often it's available and you grab it. So I hope that helps years 37. 09 01 Troubleshooting: Lastly, when you're trying to troubleshoot your script, here's a general some questions to ask from process to go through the very 1st 1 It's silly , but I've had this happen to me, too. Is ISn't running right? Do you see the Green Age? Which I have one Here It's run. Is it in the system tray? If it's not there, you know, chances are that that's part of the problem, right? Maybe you launched it and then executed and exited before you even have a chance to anything the very next thing. Just cause it's Windows reboot Windows, right? It's a very simple way to test it, possibly stop all of the scripts and programs. So maybe just after you reboot, don't watch anything else. Just have that one script on. Have any of the program open unless it required for the program. Try it on a different computer. Sometimes it's just it's just these airways to narrow down to see if it if it works in a different environment or something that helps you pinpoint what the problems might be. You might want to try running as admin. You can right click on the script and say, Run as admin e and that is, Ah, one way doesn't necessarily cure it, but it can help point you in the direction of what's going on. And then you can basically build into elevating your script to run as admin. You can temporarily turn off the USC and just Google that you can find some things about the user account control. Generally speaking in last year, someone expert, I don't recommend turning enough entirely. I turned mine off. But I am also understand. I'm the only person using my computer, and I know not to run militia stuff, and I download from the Internet. Is your script contact sensitive? So if you've send it to do a certain thing in one program and not the other, No, turn that off, just try to see if it will work, and if it works, then you know, then you have in a direction of what you should work on. Does it work in only certain places of your script? So there is the auto execute section in the very beginning of the script, and if you put something nominees here, it's not getting to it right. That could be the problem. Try moving and up into the higher point in the script. If it does what you think it is, maybe you have a problem with the auto execs section when you're actually troubleshooting. The first thing I do is do your best to narrow down to just one thing, right? This is the thing I'm working on. I'm not doing all these other things. Sometimes it takes a little work to customize your code to do that or even take what you're trying to test, put it in a separate script and run it there and just pinpoint use message boxes. I mean, there are more advanced tools in which I didn't cover, but like auto Hockey studio site, I believe in a pad plus plus has debug features which are really helpful. But they're they're advanced, and I felt they were beyond the scope of this course, But they can't help you peak and decides, especially tracking where you are when you run it and it goes to go. Sub eso question everything. Question what you're working off question your assumptions question. Does that variable actually have the value and I think it does. And that's where using this message boxes to help show you boys so often. It's funny you think it's something else and it's not really that it's It's somewhere earlier where you were out of scope in the function, something like that. It's something simple. And there's this other thing called air level. Ah, lot of the commands and functions have error levels, things you can check, and it will return to zero. If there were no errors and a one if there was an error again, I didn't cover that cause it gets starts giving advanced. But there's a link here. I'm gonna put all of the links to to this stuff a swell and then I have some more here when you when you go to seek help, right? 1st 1st confirm it's repeatable because if you can't get it to repeat, you can't really explain, explain or ask someone else for help with it. I would typically start off searching the Auto Hockey Forum stack overflow. Read it. Those are good ones. Those are the main ones I go to to see if anyone else has reported similar issues or, of course, just used the hit F one and whatever editor you're using and bring up the auto hockey help . It has a lot of great great documentation. When you goto ask for help again, trim it down to the simplest thing possible. And if you can include, like if you're going toe website or whatever, if you conclude that it's not P I I, or too much information or you know something private, then great included in there because people need the context that need to be able to test it, like in the environment. Also mentioned the OS you're doing the version of on a hockey or currently running what other programs you're connecting to. What else is running. If there's a major thing running, and then here is the order, I would go in depending on you wanted your timing. So, like discord is a live chat where people hang out and often that they're the people. They're very helpful. They're very patient on bacon, give you some live support, but you got to be ready to work with them. Stack overflow and read it. Those air decent ones. I would actually go to the hockey form if you weren't in a burning hurry for an answer, because the number of people to hit the forum is really big, and you can often give the response. I'd say same day easily the stack overflow and read it. Read it. Also. People tend to hang out there so it. But it also has a repository of past people, things that people have solved. Beacon search for a solution there. But you can pose you no other questions as well. Stack overflow is for the really minutia, like little snippets of stuff that's using what I go there. I also might even a stack overflow look at other things. Like if I'm doing more advanced stuff, I might look at some other languages and see how they solve it and then try to adapt it. But when you do it, you know what's great is is break it down. If your script is 1000 lines long and you're only having trouble with these 10 lines, extract out the 10 lines, you know, set, make away, maybe have to add two or three lines to help make it it run on its own. But give those the people cause it really helps the person. We don't help you in a lot of people. I see that work and support. They do amazing amount of stuff, but if you don't give them the right information, it's really hard. It's one of my favorite stories is a short question, requires a long answer, and a long question requires a short answer. And so if you spend the time writing out a longer question saying, this is what I'm working on, here's the context. Here's the version about a hockey in the version of Windows that I'm doing it in the environment, and this is specifically where I am. This is what I've looked at, and this is the problem. You know, when someone help the chances of someone giving you help in answering that for you are greatly increases posters saying, Can someone fix my script? It doesn't work right? Also, obviously, for both for SC on just for human interest, the title you give that question really helps dry in the right person. It make sure it's it's meaningful. It's relevant to what your problem is. Usually typically mentioned, the the commander of the function that you're working with, and it's a really it helps people's experts in that area, you know, realize my ears would perk up if it was a specific area like Web scraping that I'm very fluent. And I would go and look at that question supposed to you have a vague topic. And just with, like, please help fix my code. I don't personally would never go look at that because I don't know what it is, and you didn't spend the time to help me understand it. So spending time up front and it will help you in the back in two years. 38. Wrap Up 2: Hey, so we're wrapping this up. I wanted toe have one more working session just goofing around, showing him or examples because, honestly, I think learning by examples and not just examples of how things work properly but how things don't work properly and how you troubleshoot. So as I did with the rest. Of course, I'm just gonna be developing code live. I'll make mistakes and then I'll fix them. Hopefully e and we're just gonna play around. All right, so let's start off with a hot keys. Obviously Super, Super helpful. I think I covered this earlier, but here's the carrot is the control key. So we're gonna control are still lower case. It doesn't really matter, not tradition, but typical people use lower case and we're gonna say control are is reload. That is a specific commander, not a hot key. So when it runs, it is going to reload this script for me. So I don't have to go down, right? Click and save Reload. It will automatically with why? Because it's in this script and let me do one more control E and we'll make that one edit that puts my feet. So this is hope things. So if I didn't have let me go ahead, I don't notice. There's no Greenidge down here. I'm gonna run it. So now it's running. Now let's say I minimize this. I could actually can go ahead and close it entirely. Now if I hit control E, it is gonna open my default editor and bring it into this edit mode where I can start typing. So if it's one I like putting that in, what in my main script that I'm working on a lot because I'm playing with it. I don't like having to go in here and right click and hit and everything so it pulls it up for me, The control are if you watch. Actually, I noticed I did test this one other when I hit control are well inside studio. I have made control our refresh on the stuff so it doesn't run because studios absorbing that hot key. But if I click outside of it and I had control are then you'll notice down here it blinks for me. And so this would This would automatically we load my script for me up. I was back in again, but we loved my script and something have to watch for right? And so how would I test that? Right. Well, let's say you know, I was hitting control are and something seem weird since gone, but it's not. We learned script away. I think so. What I would do is you gotta either return what? You make it more than one line. You need to add the return, and so I'm gonna put the are. But I'm also gonna put a message box and say here now, I'm gonna re launch it. So now it's running. And now when I hit control our notice. Hey, I didn't get my message box. Why issue? No. And then I would realize I'm not in here. For whatever reason, I didn't make it in here. If I click here and hit control are Oh, look, it came up. Now I understand. If I'm outside of studio, it works inside. It doesn't. And so the simple way there's two ways I would fix this, right? Maybe I would use control shift our because control are is not exactly the best hot key for that. So maybe, maybe, and what I like to do is to keep the pattern rights of control Shift our control shift. He now when I run this as long as I don't have there we go as although they don't have another control shift. Our which from memory? I don't think I have. Ah, hockey. Then I can do that inside studio now, And it's not conflicting anymore or overlapping in the control. Shifty would, of course, bring me into it to edit. So those air to hot keys again? Hockey's air. Really cool. They're great ways to trigger sub parts in your script or launch other things or do what you will. I did one. I don't see it down beneath here. You know what? Let me Let me pull it up. So my previous scripts and then I just to this work, Of course I'm not seeing it. I think I have on my desktop. Let me bring him in here, because it Yeah. Oh, no, That's the text file. Um oh, yeah. Uh, not sure. Way saved. All right. So I finally remembered where I saved this file. It was kind of a temporary thing. I had an idea where I wanted to get a list of words and So I went Teoh this Web page And of course, I could have made this dynamic where it would go on update it. But this list of 100 words isn't gonna change. So I came in here and and more importantly, might even disappear. I copied these, and I stored these into a text file, which is the path right here. And right now it's just sitting on my desktop. So that is the file path. And then I said, Hey, let's loop right And I didn't cover loops. But you still get the overall concept, right? It's going to go through and read that file, and in this one it reads each line in this a plus plus, right, that is gonna increment. It won every time it goes to the next row. So at the very last one could tell me how many lines now this? Because it's the 100 words I know it's 100 right? I really don't have to do that. I could just come in here and say this random A random is a command. We didn't cover it, but it's just to come in and you could say, and I want the low of one and the high, and this is a variable to use from how many rows there were right. So I could because this is static. I can comment this out in this out and let's do duplicate comment that out. And we're gonna put 100 right here, right? Because that doesn't I don't have to do this because I know it's a hunt roast, right? This is built. What? Schools? I can point to a different file, and it doesn't matter how many rows there are. This whole program will work. And so anyway, so I go in, pick a number in here. Let's throw in the message boxes is again. This is how you troubleshoot right? So or understood, Learned what a script even does. So random drone. Now I'm gonna run this and said, This time is three and I'm gonna run it again. And then it 78 42. So each time groups each time it's picking a random number between one and 100 it stores it in random row. That's what I'm displaying right here. And then I use this command file realigned again. We didn't cover that one, but it's another cool command in hockey. It says, Hey, go read this file from this file path. So I used an expression here, and this is the path of the file. So that's where it's giving it up here. And it says, Hey, go. This is a number at this point, right? So go read like that. Last example was 69 I think. Yes. So go read Rose 69 in store What you find in Row 69 here in this variable called word and then go run by default html browser and go to this your l and put in notice. I put in here where it says word with the percent so that uses it is a variable. And then, actually, so if I hit OK, it should actually take that next step for me. And so for some reason that didn't it didn't included it. Let's try it again. It was close. The whole thing now Yeah, and it is not picking up the word. So let's troubleshoot. Um, so that is 1 to 100. It's coming back here. So the first thing I would dio is let's see, but actually, let's leave this here So we get the random row and then let's do a message box here saying word, Right? So let's see what the word is cause that should be coming back with a word. So this time it's Rose 61 0 interesting. The word is blank. Oh, I know why. Because I changed the file path after I hit it. This I changed the file path because I was testing some stuff and when it happened, was the file that I saved Initially wasn't Unicode eight Eso utf eight. So it wasn't Unicode format. And in the words like deja vu, we're coming up with little question mark boxes and check marks. So I had to troubleshoot and see what's going on. And once I saved my file, what I did was instead of overriding original file I saved is the new file and then with the one here. So that's how I didn't override it. But I saved it in utf eight format. Then everything worked fine. And so when I did that, everything was taken care of. What I should have done I was now would still find this. This all worked fine. I could have because in this one. I'm not really. I'm using the, um, file read line instead of reading the entire file, which is what I believe. I demonstrated earlier this just reading one line. But now I think that's the name of the file Past or 67. And ogle is going to be the word. And now what? I hit, OK, it is going to run 9 12 with ogle. So notice Ogle was here and ogle, um and I have my definition staring in the electrics manner rating What? Northern Electric's I mean, I know toggling is a perfect example. Um, so that was a script I thought up in wrote in a couple of minutes. Right? So So that was a good example of how you troubleshoot something. And the other one, By the way, this last one I have here commented out I did that in this because what? I wanted this kind comment this out in this out. Right, cause I don't want this message boxes every more every time. But right here, I'm shoving it there. But then online 13 is where I decide. Hey, you know what? Maybe I would like to have the word that I look up copied to my clip word. So if I'm trying to be really smart, I can use it in some sentence or something right away, and I don't have to type it. I can just paste it right cause I'm lazy and I missed type things all the time. So this one coming in right here says, um, store shove the variable word into the clipboard. And so that way, it's available for me to paste later. Now, if I had this set up where I was doing it straight from, like writing an email, I could have automatically told it to send paste, you know, to that email. But right now this is really flexible, and I don't mind hitting paste. So what? This is this was close enough for me. But that was when I just did the other day. All right, let's get back to our wrap up script. So now we can Let's get rid of this, put this back on love line, which means I don't need that return. These these two here now, these air kind of setting files. So also I can ah can remarked, those keep them separate, right? So this way. I know there's really what I would normally do is like, get rid of this entirely and this is all the start. And it's just something that's included in my base file, and so I don't have to worry about it. I want to leave them altogether because it's not what I'm working on. Let me see what? Where did my Okay. So hot hot strings. Let's cover a few more heartstrings, um, their super powerful. You know, I better disable to spend the hot peas, and I should I can't remember words. It's possible script as well. So let's say I wanted my main email address. So, uh, true theon a meter true at the dash. Come, um, so here notice I took the time to get the case. The wide want it done. And actually, it's my email. So you remember the parameter I put here If I don't want to have the space at the end, that being oh, right. So now when I run this and I remember studio actually doesn't really like heartstrings, it's kind of funny. It's really one of the very few programs that I know about that that I have issue with hot strings. And but now if I type ta ta period and space it dumps in my email address noticed no space after it. Um, again, if we had paragraphs, let me let me show one here another way, which I didn't cover earlier, because things get, you know, when things when you cover things that are really advanced to just confuse people. So I don't like doing too much. But let's say you had the declaration independence. I don't want to go Google it and find it or something big about actually the declaration. Parents. I would I would say that as a file and then read in the entire file. So let's do something simpler where there's, like, four lines and so we're do there. Colon equals and what I want is multi line typing. So there we go. So what I'm doing by doing it this way, I can shove things in here, and it will be very, very close. I think I can have double quotes aside. I think the viral with percents of the only ones, they're little funky if you want to use a variable and actually let's cover that here. But Let's go ahead and first. First thing I like to do is let's just test to make sure that it's getting pushed in there the way that I think it's getting pushed in there, right? So when I say this way, run it. Actually, no, I don't have a, um Do they have have Eric? Or so I always forget? Maybe it's this way. There we go. And let's make a hot key to trigger this. So what do control t run it now? When I hit control T. So there is my texts notices on multiple lines. And let's say I had something in here. Now reload it and then control t so notice I can have the double quotes in here. Let's shove in a variable into this. So here is where I want my variable. Right. So what you would do, I think is we could just do it this way was to give us a try. Not Joe. Uh, bar right now. Control shift Our watch. The little green H pop. And now control T. Um, it did not show up there, so that did not work the way I thought it would. Um Oh, because I'm a moron, right? This is name. And again, this is I could go in and I could add all this stuff. But it's much better to see that, like things just this is the way it goes, right? Here we go. So notice Joe, that put in here. If I change this to Bob, Reload Control T. And so that's how I can have a variable, including here. And so if I was trying to go for a big list of things, I get loop over these things in shove in a different name and then dump that into, like, an email or something like that. So those are hot hot strings again. Super powerful baby. Step into them. Use patterns to help you remember exactly what you're hot spring is. Let's look at the next one, which I had was, if then logic. So let's go ahead. Let's leave this And the other one I wanted to demonstrate was adding a bunch of stuff into one script. Right. Like I said, my my main one has thousands over 2000 lines. All well, I was just comments because I add Stafford, then leave it there so I can uncommon it and use it or it's just a referencing. So let's add in some if then logic just to do. And I didn't dio else. So let's let's do something with that. Let's say one now, Now this. I think I hinted on this. I don't think I covered entirely, but we're going to ITV are now. What you should be thinking is this should be if r equals one, right? And let's do it this way the first time. So that's the proper way to do this or the main missed box high. And I'm gonna move, are controlled t I'm gonna use the same hot key. Someone put it right here and now I'm gonna run this. And now when I hit control t So notice the message box high came up because of our equaled one Right now, here's what I don't think I covered specifically. So if we just say if var now this logically doesn't make any sense But basically auto hot key will take a variable and say Look, if it's zero, it means no. But if it's anything other than a zeroth and it means yes, So I'm gonna run this control Tisa knows that still came up, right. Let's change Varda 10 control T still comes up, right? But let's save R equals zero and run it. And now control T. So it didn't come up right. And because of our doesn't even equal anything other than a zero is the best way to phrase it. So if our must do that, let's, let's say 10. And then let's say if R is greater than five message box high Now, let's do, uh, was to an end. Well, say lesson 10. Actually, it's between six and 10 right? Because it's greater than five. No, it's between between. So it's between five. And 10 because it's less than or greater. So that will show up here, this one. So in this case right now, it won't work. So that's if that, um, else can never know. That's python else. Um, if I'm gonna borrow this one here, lets put um, good Lynton, unless san 20 in the final one is just else. All right, I'm gonna run and control T so far is over 20. Oh, I can't have an or Ah, and this or that. This is This is why you troubleshoot, right? Actually, so far is great of five. And for instance, that's fine. Far is greater than 10. No, that is AM are greater than 10. Okay, Um, yeah, that's funny. That was some bad logic. So that you're on this control T So Viers So what happened was I happened to pick far. It should have been greater than or equal to 10 in because I put in 10 right? So it didn't it equaled 10. It was, wasn't greater than 10. It was less. It wasn't less than 10. And that's why they didn't work. I should have had it as either have great, great of the end or equal to 10 and greater the less A and R equals Well, let's keep it just on one less than 20. We'll see that far is 20 or more. So now it's 11. If it's five. Well, let's say six right t. So it's between five and 10. Yes, it is. If it's ah, 15 t. So it's now between that and let's say it's we can say it is 20 because this is less than 20. So it's gonna check this. That's not true. Gets to hear it's going, check this. That's not true. Then it's going to say, Well, this is the last one else just means otherwise. If it's not either of these than whatever it ISS, it doesn't matter. It's gonna be true. So we're listed. This is 20 save rerun control. T Environ is 20 or more, so that's a little more complicated logic. There's a lot more advanced things you can do, and there's other shortcuts for writing some stuff. There's also something called a turn Eri, which is a lot of fun. I'll give me an example of it here because I have a hot string which may or may not work here on. This is what things I can't remember unless it didn't trigger it properly. Oh duh. Because I turned off my heartstrings. Um, let's go ahead and there we go. And let's change this language toe hot. Few circuits island it properly, and this is a complex logic one again, its advanced. So I don't want to cover in here, but one let you know what's out there. But basically I break it on several lines to help me do the logic. And once you do that, then you can combine them all under one. And so this saying would allow Let me go. So this, this all this logic? It's if the if else logic All Dina one. I'm setting a variable here. And it's one way where you can do this all in one thing it's really cool. You can nest them. It gets really complicated, though. So I didn't want toe cover in here. But if you're up for it, right, take a look at turn Aires or very cool. So that was there. Functions all right. I'd love functions. What can I say? Functions are amazing. No, let's add a little bit in here. So this is, uh what's, um, here. We'll call the use so that right there, if you noticed it didn't supply the text, it just basically, it replaces it too fast and that it gets lost. So studio, for whatever reasons, doesn't like him. There's a different way to do them that we built into it. But I still have my hot strings that I haven't adapted because I use those elsewhere. All right, Um, what were your functions? So this one is gonna be functions. Let's play with some functions right? So again, to create a function, you can you can have it before or you can have Call it after weaken, store them different spots. But we're gonna Let's call my folk on this would be inside the function Let's give it to parameters A and B. Okay, bbo um unless let's change this instead of am let's let's do some math there a plus the equals. And now this is where we're gonna add the two together. So a plus B and I notice, um, this is this is math being done here, so it's fine like this, but, um, I am going to return a plus B now, I could have created a new variable. Then we turned that variable. But I'm just gonna do it on this one. So this is I'm gonna return it. So when we call the function first off, let's just call life my folk and let's just seven comma two that is going to show us a message spots hopefully of nine. And I need to bring down this guy. So we run it control team. Oh Oh, I have runs before. For whatever reason, when you have a hot key right before this. It does not like it. So let's go ahead and get rid of this. And, um, we're gonna move the whole thing. Well, let me see. Here. Let me see if I can remember if I could Let's see if that'll fix it. Okay, so that that fixed it. This is one of those weird little, subtle things that you can't have a hot key and then directly in front of it to find the function. I guess what I could have done was had moved this up here and let me get into this. This should be fine. Here we go. So, control team, so seven plus two equals nine. But that didn't return it. Actually, it did return it. However, I didn't store that I didn't displayed anywhere, so I could have said mass value. And then I'm gonna put up in a message box here Now, in a controlled T inside the function, we're going to see the seven plus two equals nine, and that's that is literally that's on here. Line 34 at the moment. And that's gonna hit. 9 35 is gonna do them. It's going to return a plus B as a value which is going to come back up here and store it in line the beginning of 30 here in this math value function that's are variable. And then display it right here on 9 31 of just nine. Right? So right now I can turn this off on, but actually will do the same. I'm gonna run it control T and now will to see the total. Right. So let's change. Just value. 21 patrol T. And so I made my own little calculator here where I can combined to, you know, something like this. Maybe you put in a very variant, uh, parameter Very attic. Sorry. Okay. Very attic where you can allow as many as you want. And so, as you add them, it would keep on adding things to it. That's a bit events. So I didn't want to get into that, but they are very cool. Check that out. Another one I wanted to do was to demonstrate using a phone can like in your library. So let's see. It was continues. Stir slip. I think I had to use that example. So let's do another one. Let's do I have this one. They're called, uh I know we'll do it right off of this thing, right. So climate that out and notify. I don't know if it's gonna My hot stream will work properly here. There's this function that I like and it didn't work, you know, I'm gonna That's when I I have to go back on some point. Fix that. So here we go. So that is the proper way. And I'm gonna bring that back into here. So this is gonna be the title and notices in quotes. And this is the message body, and it's it's in quotes and I can have lying breaks. But here, let's say, actually, I don't have the other parameter. So, uh, well, say, your answer is and then we're gonna put in the variable, which is math value. All right, now that each of these parameters here, actually, I can't read the five, I think, is how long it stays on the screen. Um, no, the S ice over here. I'm a little note to myself in my my heart string to tell me this 1000. That's how long it stays on the screen. That smaller is faster and it's It's a speed. It's moving, that's what ISS and then this is the like the size of the fonts and the color of the front . Let me go ahead and run it here. Let me re launch it now controlled TV and I watch what it does. So it puts it down here right in little display. I think that's what the five is forced displayed for five seconds. Let's changes to to see if it happened if it gets rid of it. Faster control T Answer is 28 I think that's a really cool looking. It's a great way to notify you of things or to keep your users to understand things going on. But again, I don't have to go put this file into my folder here. I don't have to use a include and point to it. Why is that? Because, um, let's navigate to my function folder I like to use I'm on the row. That wasn't the right one here. Rio. Right, So under auto hot key Ally be. This is the phone. This is the folder where I have a lot of functions, right? I used to have a bunch more, but I move some of amount. But Notify is in here and in here. This is, Ah, long script. It's got a lot of stuff if it but it explains the parameters and it zee, it's pretty complicated. If we looked at the entire script, it's It's quite long, yes, over 400 lines. But it's very functional, right? You could do a lot of really cool stuff with it. Actually, I don't I don't remember. You see if I hit control T now? Oh yeah, multiple times. Notice how it's stacking them right so it can. It can have multiple going and will keep track of it. You can have it. Stay on the screen until you click it. You can have a display icons and pictures. It's really cool. Don't want to get out, but I do want to cover that look that's in my library, right? I don't have to go point to it or do whatever I do have. Remember how to use the parameter in the name of the function, and that's why I like the hot strings and hot keys right is it's easy to pull things like that up so that was using. Notify Um, let's go ahead and get back to our thing here. So that was that notify function, and that's just what it does, right? And again, let me see if I changed. I don't know. I don't know the default colors, but we'll see if that should change it to blue. Yeah, that's a bit dark. I don't know if I could put light blue or something, but there's, You know, I think that will even take a Hexi decimal color range. But again, and it's not the point of this tutorial. It's just to show you that, like it's really cool when you have a library of functions that you can easily call to them and borrow from them and not have to go find them and use, and especially the ones you use a lot, right? So it's very cool. So that's functions. Let's do actually the reading the text file that was in my notes to do. But we covered that right cause we looked at the Thesis one. Now this was a different one and lets you know what. Let's cover this one. Let's let's do it. Since I have a path here Let's let's borrow. This was to file read and I picked fire, was called viral. And then it's the file name. So that's the file path, right? And actually, I think for that I need NC. I don't memorize all this stuff either. Right? So you just play with it, and then I'm gonna put in a message box with far gonna save us and run it. And lo and behold, it went Read that file, got my 100 letter words, dump them all into a text box for me because now I know. Hey, I grabbed right file earlier when this was a one. That's what I was considering. Ah, that I could have showed you. It was when this was the past and I run it. Look, it comes back with nothing. And that right away would have been like, Wait a minute, that file. Why is that foul not coming back with anything, right? It should be coming back with a bunch of words. And but because I had used the read file line, it wasn't gonna be a simple to demonstrate that. So I didn't cover it that way. But this file read, it's really quick and easy to go to that you can. It doesn't max out on final size, but it's it's pretty big on what you can handle. The file read Linus. Nice. Could you can have a really, really big file. It still actually does. If I remember correctly, it will go through it. It doesn't load the whole thing into memory, but it does. If the file is, you know, five gigs, it'll take a while to get the line that you want. Having said that, you're probably not working with five big files and auto hunky. So where we go, that guy show excited, just to be sure, backs up in the wrap up. Alright, writing a text file and we covered that a fair amount. But it is really handy, you know, to I didn't mention where in any read on any right, those were really great ways to be able Teoh store files. Think of them as like a file read the file upend. So look those up if you're interested in having stuff, but you know any files there initialization files in windows and you can easily store text and then have them and key value pairs and use a name and pull stuff in and saving. It's It's a very simple way toe. Basically configure a settings file for your program and so you can have it right to a text final locally and store values. Then go read them back in with any reading, right. It's a great easy way. Think of it is like a smaller databases. Only I think about it. They're very handy on that would be any and they read any right any delete any read in any great. So those they were just a bit of the Answer them again. I don't want to cover too much in this first course. That will probably be my next course, because it's they are very helpful, like an intermediate level thing, though, but they are. They're great. So if you're thinking about having settings available for e file, their greatly to store things and troubleshooting. So this whole thing we've been troubleshooting right? It's one of the most important things to be able to learn how to do. Studio has some great built in debugging features, and you can look see here I am tight debug, debug curse for So it's like I'll be is my hot key. I think I changed it, though, for this. So initialize, is it? Here I can click this and it will show me variables if I have any. So these air the variables that are currently available and as you step through it so lt would continue I don't know right now if we because I have these hot keys up here, it's just sitting here, and so this is a bad example of it. But you get the idea, right? So it's It's a way you could You can step into it one row at a time and especially inner loop or something. You can see exactly where you are, see what the variables are, see what their values are. It's a great way to be able to check out what's going on, um, into jump around quickly, and especially if you have an object which we didn't cover objects. But if you have an object, it will show you it's got a built in automatically show you the text in that object. Oops. There we go. Um, and remember how you No, um I had a good how to get out of the debug mode. Uh, look at that. That's easy ways just to relaunch the script itself to that'll That'll stop you from the line five when I deal. Oh, look, cause I that reload, There we go. And now just finished this, by the way, this output window here, mixture of built in a cool little feature. So let's let's go back. Let me demonstrate one thing to you here, this 100 words and right? No, I got rid of it, but the file read. Actually, Miss, if I can do here we go. So instead of doing a message box here, there's this debug window and that's what that's called. I'm gonna shove in there this this variable that we read that path and now when I run it Oh , I don't know why they didn't work puts. I'm at a return here, so it doesn't do the rest of it. Oh, I see why this is funny. I did to any unders. And here's the one again. Right? So, again, this is this is common nature and stuff. Just you get better and better at thinking about the logic of what's going on and why things aren't working and you start playing with it. So notice this output window got filled up with the words. Unfortunately, you'll notice in here they're not utf eight. So this output window don't worry about that sort of problem. It's just not utf eight compliant or Unicode so but here you can see the output. So it's great. I don't have to display these things in a message box, and I can come in here and copy them. I can't search in here, but I can copy from it, which is really handy, but it's a super easy way. I also have, and I don't think that one will work in there. But let me dio. This is a function that I wrote eso instead of using that output window, and I happened tohave That's the right variable. So I'm gonna save us from running, and it creates a gooey um that is actually even adjustable. Right? That has the text creates all highlighted. This is a function again. It's in my library. Aiken, Right click here, Say, open folder and the re sizable. No, that opened, though. Of course that open that folder, not my library. I think I don't have it up anymore. Let me see if I peed out Lib. Oh, that's my linked in stuff. Here we go. Re sizable. Gooey. Let's take a look at this. It's not overly complex. Oh, I could have looked over here. So that one is roughly 17 lines long and it it creates Ah, window defaults. So notice I have some parameters here. The default excess 900. The default. Why is 600 Aiken changes by adding a parameter right? Are you changing the parameter as I feed it? And then it first kills the gooey and then resize is it makes it and I'm sorry. It allows it to be resized. Efforts created, I tell it to set the font Teoh blue to size 12 to use courier New. I forget that the hue five does the number of rows by default, I don't recall. And then the width and height. This is where I'm passing in the x and the Y right from appear and sir, Then I show the data on and intel to show And then I built in. So if I hit escape or I close it, it will kill that gooey. And this has to do with the resizing. I believe so, Mr.