Intermediate AutoHotkey / Windows Desktop Automation (RPA) | Joe Glines | Skillshare

Playback Speed


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

Intermediate AutoHotkey / Windows Desktop Automation (RPA)

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

90 Lessons (5h 27m)
    • 1. Overview of Intermediate AutoHotkey

      1:15
    • 2. 01 01 Intro and About Joe Glines

      1:39
    • 3. 01 02 Why Learn AutoHotkey

      5:20
    • 4. 01 03 Course Outline

      3:50
    • 5. 01 04 AutoHotkey Resources

      7:26
    • 6. 01 05 Installing Unicode 32bit AutoHotkey

      1:28
    • 7. 01 06 Selecting your AutoHotkey Editor

      2:02
    • 8. 01 07 Programming Resources

      2:26
    • 9. 02 01 Important Recommended Default Settings

      2:44
    • 10. 02 02 Non Critical Recommended Settings

      1:38
    • 11. 02 03 Using an #Include

      2:14
    • 12. 03 01 Adding Hotkeys to the Default script

      5:47
    • 13. 04 01 Send, SendEvent, and SendRaw

      3:37
    • 14. 04 02 SendInput and SendPlay

      2:32
    • 15. 05 01 SetTimer

      10:12
    • 16. 06 01 Intro to IniWrite IniRead

      2:33
    • 17. 06 02 IniWrite Keys and Values

      3:21
    • 18. 06 03 IniWrite Key Value Pairs

      3:57
    • 19. 06 04 IniRead

      3:14
    • 20. 06 05 IniWrite IniRead Working Session

      8:07
    • 21. 07 01 Overview of Windows Registry

      2:58
    • 22. 07 01 Reg Read String Variable

      2:35
    • 23. 07 02 Registry Read MultiString and Expanded

      4:34
    • 24. 07 03 RegWrite

      3:43
    • 25. 07 04 RegDelete

      1:11
    • 26. 07 05 Registry Working Session (Running as Admin)

      6:07
    • 27. 08 01 Controls What are Controls

      1:17
    • 28. 08 02 Advantages and Disadvantages of using Controls

      2:44
    • 29. 08 03 Additional Resources with Controls

      2:11
    • 30. 08 04 Path for connecting to a Control

      1:50
    • 31. 08 05 Tools for working with Controls

      5:57
    • 32. 08 06 SimpleSpy Find and Tree View

      2:05
    • 33. 08 08 00 Over 40 commands around Controls in AutoHotkey

      1:00
    • 34. 08 08 01 ControlGetText

      4:52
    • 35. 08 08 02 ControlSetText

      2:28
    • 36. 08 08 03 ControlSend

      4:22
    • 37. 08 08 04 ControlSendRaw

      1:51
    • 38. 08 08 05 ControlGetPos

      3:32
    • 39. 08 08 06 ControlGetFocus

      1:45
    • 40. 08 08 07 ControlFocus

      2:03
    • 41. 08 08 08 1 ControlGet List

      1:26
    • 42. 08 08 08 2 ControlGet Selected

      1:50
    • 43. 08 08 08 3 ControlGet Line

      1:52
    • 44. 08 08 08 5 LineCount

      1:18
    • 45. 08 08 08 6 01 List ComboBox

      3:39
    • 46. 08 08 08 6 02 List DropDown

      1:38
    • 47. 08 08 08 6 03 List ListView Selected and Column

      3:55
    • 48. 08 08 08 6 04 List ListView Focused

      2:29
    • 49. 08 08 08 6 05 List ListView Count

      2:50
    • 50. 08 08 08 6 06 Control Add and Delete to Lists

      3:04
    • 51. 08 08 08 6 07 Choose from List

      1:52
    • 52. 08 08 09 ControlClick

      2:17
    • 53. 08 08 10 ControlMove

      2:38
    • 54. 08 08 11 1 Control Check and Uncheck

      2:43
    • 55. 08 08 11 1 Control Disable and Enable

      2:06
    • 56. 08 08 11 1 Control Hide and Show

      1:07
    • 57. 08 08 11 1 Control Show and Hide Dropdown

      1:36
    • 58. 08 08 11 1 Control TabLeft and TabRight

      3:27
    • 59. 08 09 11 1 Control EditPaste

      1:12
    • 60. 08 10 1 Controls Working Session

      27:58
    • 61. 09 00 WinMenuSelectItem

      3:13
    • 62. 09 01 WinMenuSelectItem Sending Words

      6:19
    • 63. 09 02 WinMenuSelectItem Sending Numbers

      2:26
    • 64. 09 03 WinMenuSelectItem System Menu

      7:31
    • 65. 10 01 01 Normal loop

      7:54
    • 66. 10 01 02 While loop

      2:03
    • 67. 10 01 03 Until Loop

      1:37
    • 68. 10 01 04 00 Parsing Text Loop

      2:47
    • 69. 10 01 04 01 Parsing Text Loop

      3:20
    • 70. 10 01 04 02 Parsing Text Loop with CSV

      4:51
    • 71. 10 05 00 Loop Files and Folders

      2:51
    • 72. 10 05 01 Loop Files and Folders

      7:38
    • 73. 10 05 02 Loop Files and Folders Working Session

      2:30
    • 74. 11 00 Arrays

      1:36
    • 75. 11 01 01 Simple Arrays Explained

      1:39
    • 76. 11 01 02 Simple Arrays

      3:09
    • 77. 11 01 03 Simple Arrays Accessing and Setting One Element

      3:46
    • 78. 11 01 04 Simple Array Using the Debug Window in AHK Studio

      3:22
    • 79. 11 01 05 Simple Array Inserting at and Pushing

      3:09
    • 80. 11 01 06 Simple Array Removing at and Pop

      4:00
    • 81. 11 01 07 Simple Array Additional Methods

      3:47
    • 82. 11 01 08 Simple Arrays Working Session

      11:19
    • 83. 11 02 00 Associative Arrays

      1:52
    • 84. 11 02 01 Associative Arrays Initializing

      3:28
    • 85. 11 02 02 Associative Arrays Adding new pairs and changing values

      4:48
    • 86. 11 02 03 Associative Arrays Removing Keys and Values

      1:25
    • 87. 11 02 04 Associative Arrays Additional Methods

      2:36
    • 88. 11 02 05 Associative Arrays HasKey

      1:10
    • 89. 11 02 06 Working Session

      12:04
    • 90. 12 Wrap Up

      3:02
  • --
  • 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.

38

Students

--

Projects

About This Class

AutoHotkey is an amazing tool that can help automate programs on your windows computer.  In this course we take a deeper-dive into programming with AutoHotkey.  The skills learned in this course will help you develop better Robotics Process Automation software.

I highly recommend you either work through the Intro to AutoHotkey Udemy course or have ~6 months experience programming in AutoHotkey as we hit the ground running.

We cover a lot of great tools in AutoHotkey in this course.  But don't worry, you don't need to be a programmer to understand the course.

Meet Your Teacher

Teacher Profile Image

Joe Glines

AutoHotkey / Automation Expert

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
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.

Transcripts

1. Overview of Intermediate AutoHotkey: Hi, and thank you for your interest in intermediate auto hotkey. In this course, we build upon the foundation I laid an intro Dato hockey on how to work smarter, not harder. So I spent over 20 years in corporate America and last ten, I was using on a hotkey to automate my life and make my life simpler and easier in automate a lot of the programs that I worked with daily. And there's just so much you can do in auto hockey is not a difficult language to pick up into use. It's also free compared to a lot of the RPA solutions, robotic process automation solutions, many of which cost tens of thousands of dollars when auto hockey is free and can honestly often do a lot more than those programs. Can. I have the table of contents here, kind of the stuff that we cover in the course. It, it is intermediate. It's not for beginners. But I'm not a programmer and I explain things very clearly and in a non programming type way. So if you have any fears about you're not a programmer, you're not gonna get it. It's baby steps through the staff. It's not rocket science. I think it's just something is could you kinda practice with a little bit and give it a try? The first few lessons are free and see if you think it's going to help you. I can guarantee you it will. I don't know if he's an amazing tool. I wish you the best and start automating tiers. 2. 01 01 Intro and About Joe Glines: Hi and welcome to this beginning course auto hotkey. I want to start off by telling me about why I'm qualified to give this course. First off, I'm not a programmer in the kinda sounds counterintuitive. However, the great thing I think that I bring to the table is I don't have all this background knowledge and use terminology that programmers use. It can be very confusing. I'll be teaching you the basics of how to use auto hotkey. The intro course that when that preceded this course is really gets you to started with it. This one is we're going to start actually doing some coding. The other things that I've done over 45 webinars on auto hotkey in over 60 podcasts on those go up. The podcast every week in the webinar's are monthly, There are free check them out on YouTube. And then I have credit to other huts, auto hotkey courses. One is into it, auto hockey laters mentioned. The other one's on hot strings because strings are the low-hanging fruit for on rocky. It's so easy to be more productive on. I definitely recommend you checking that out. Make sure you take the intraclass first because I'm not gonna get to the nitty-gritty of doing the stuff that was covered in the intro classes at the beginning, which is a bit above intro. And then I also worked in corporate America for over 20 years. And so I've done a lot of stuff with auto hotkey over I've been using on hockey for over ten years now in, in corporate America. I always tried to apply it using to work smarter, not harder, and get things done faster. And so amazing tool and I come at it with a real purpose, full use, not a programming US. I like to give them to the how to use it and how it's helpful. Not here's the actual code, but here's what it's gonna do for you. So hope you enjoy the course and thank you for signing that tears. 3. 01 02 Why Learn AutoHotkey: So why should you care about learning out of hotkey? Write what cannot hockey deal? The question should be more like, what can't it do in Windows now it's only a Windows-based program. And for the most part also, by the way, it runs on Windows 1087. I still have an XP machine. I can fire it up and run stuff on that. And so it can automate a lot of different versions of Windows in so many things in Windows, I've put together a list here to talk through real quickly. It does even more. It's just, I consider it the Swiss army of Swiss army knife for Windows. It's an amazing tool for doing stuff with windows. So there's first-off just connected that Windows API. An API is an application programming interface. That's a way you can programmatically interact with windows in many of its buoys and controls and, and actually pull information out of windows. I'm just depending on what you're doing. It's, it's an amazing amount of stuff you can do with it. Hot Keys or a super simple, easy to use tool for remapping keys. So if you don't like the key combo that you have to hit in your certain program. We can remap it or you can automate having it where I hit a couple keys and it will launch a program for me. Or there's many things you can do with them. Hot strings or Texas mantras is another great one where I can type a couple letters and bam, it expands into paragraphs if I want, whenever you want. I'm file and folder manipulation. So there is a ton of stuff that you can do. Even one is just editing files like text files and stuff or creating your own files, but also moving files around and backing them up for you automatically copying things, writing our programs to, to do these things for you can save an awful lot of time accessing the clipboard. There's a lot of stuff. Now. There's more advanced ways to do this, but it's often you can just send to copy whatever is highlighted, do stuff to it, and then send it into a different program, right? So you can copy it into the clipboard is an easy way to pull it in if you can't programmatically interact with it and then manipulate it however you want the stuff in the clipboard and then push it back out to what other, other program he wanted to do. You can connect to a lot of Windows based programs using calm. That's this Microsoft's Component Object Model. So things like Excel and Outlook and PowerPoint. In Word, you can automate programmatically. It's very somebody using VBA and the code is actually very similar to it. But you can programmatically do your automation in it. And it's one of my favorite things to do because in corporate world, right, There were so many things that used Microsoft Office programs and you can automate a ton of that stuff. You can also connect to controls like like a radio checkbox, you know, those kind of things. You're going to be that or just GUI and you can automate clicking. Those things are getting, checking if they are clicked or not clicked. Sitting there value is setting, sending texts to an Edit fields. You can automate a lot of that stuff. There's these things called the post and send the messages. A lot of programs and programs were to have all been developed by different people over 30 years. The E and they have different interfaces. Auto hockey connects to the vast majority of them. They go through them differently, right? So you have to learn the different approaches, but it can programmatically do it instead of just sending mouse clicks and keystrokes, which if all else fails, you can default to that one. So there's that, the automating menu. So older ones like Notepad have that menu at the top, right, that's kinda like this, but these are a little different. This is a different ribbon. This is doable and it'll hockey, but it's pretty advanced. And so far we don't have a good library for it yet, but I'm sure it'll become. And then the Windows registry, if you wanted to constantly set your registry or check it or updated or removed something from it. You can automate that without a hotkey text manipulation, as I mentioned earlier, you can go in and read the file, look for certain texts, delete certain things, or you can do regular expressions which are super powerful. I'm going to do an advanced course at some point on regular expressions without a hotkey because it's such a great tool. I have a lot of the stuff on my site for free. By the way, if you go to the automator, the dash automator.com, and you can see examples of especially that the roject staff, I got a full page on that. But there's a lot of stuff on using calm. Then connect to the web service. That's another one I have on my site too. But you can override, say, over 20 thousand open APIs out there. They're called web service APIs, and these are online things that you connect to you and you do HTTP requests to them, generally speaking. And you can send and retrieve data from these online servers in it, it's a great way to interact. A lot of you are using tools at your vendors. They have APIs and don't even know they exist. And it's so much faster than using a browser to click buttons and do stuff. You can automate that process and it's the time you take to do that stuff is nothing compared to what it takes if you're using a GUI. So it's a great way to do it. And you can also create amazing buoys in auto hockey. I'm a lot of you probably watch my channel and you'll see mixed-race author about hockey studio, which is written in auto hotkey, right? The whole editor is built in auto hotkey for auto hotkey. And it's what we'll be using in this course. But it, auto hotkey can create some really good, powerful buoys. And it's pretty simple to create them compared to other languages. So I hope that gets you interested in excited. I get really excited when I start doing the stuff. And this is why I'm creating these courses as I love teaching people how to automate stuff II. And I just want you guys to soak it up and automate your worlds away. Alright, Cheers. 4. 01 03 Course Outline: In this course, we're going to start off just talking about who I am, my background, why you should listen to me. I've done a lot of stuff without OMG. I'm not a programmer, but I play one on TV. And why you should there not a hotkey, it's an amazing tool. So we get into that some auto hockey resources both available with this lecture series but also with external stuff that you can go and use. And then also we're going to just make sure you cover the basics and solving on odd key and studio, just in case you didn't do the Android Auto hockey, I really recommend you do. Not that I want the money for it, but it's just this is we start off kinda running with you have some basic understanding about a hotkey and we're not going to go back and cover those things. Then we're going to talk about some recommended default settings that I recommend you have for every script you run, or at least when you start and you're developing it, maybe later you tweak it after. There's a lot of different types of send in. I didn't go into depth before, but there's different types of sands on why you use one over the other and the benefits. Using a set timer, which is really cool and allows you to feel like you have multithreading. And in auto hockey, even though you don't creating and reading and writing initialization files or any files. Auto hockey has some great tools for built into it that allow you to, like, let's say more often not save your user settings, have a min of configuration file for you and you don't have to write the whole background to do this. It's very easy to access and to utilize working with the Windows registry, this is a dangerous one. I don't recommend it for anybody who's new to working with the registry. However, auto hockey has built-in stuff for reading values from the registry and updating it. It's really a great thing to be able to know. I'm using controls. This is a really, really long section of the course. But there are, controls are basically a window inside a window. And most of those windows are things like buttons and things that you can clicking do. These controls auto hockey can programmatically connect to. So instead of sending keystrokes and sending a mouse-click your programmatically setting it or getting texts from them. And they don't work with all especially like the newer types of programs, but the older programs, which oftentimes we have a work environments. You can programmatically connect to them. And man, it's amazing. When we talk about using the built-in select menus are menus at the top like a notepad that the different things across the top right, you can programmatically set at the select those. And it's just a great way to control a program. Those, both of those more often that they don't interfere with a human using the computers that can be run in the background are often even a minimized Program, which was just amazing. And then we cover inside loops. We cover what is this 12345 types of loops. Basic loops are just your basic loop that you can do it in. And then there's the while loop, the until loop, parsing text loop, which is pretty cool, especially if you work with CSV files and then looping over files and folders, that's another one that's really helpful depending on what you're doing either. But if you're managing files and folders in your computer, that's a great one. Lastly, we work on using simple arrays. This is where you have like a list of items and they don't have an order necessarily to them. It's how they go into the array. And then we deal with an associative array which is more like a dictionary or map. There also called. And those are key-value pair stuff which are incredibly powerful and programming both of these are super, super powerful to learn how to do. And we cover both of them also, I want to point out I didn't list it in the looping section because we use a for-loop which is another, it's a sixth type of loop. But I didn't cover it up here because we didn't cover arrays yet. So that's down here. I think you're going to learn some really, really valuable information in this course. And now that I got this one the way I can't wait to start working on the next one because that's we're going to start doing some advanced stuff. But I think you're going to enjoy this course and learn a lot from it. Tears. 5. 01 04 AutoHotkey Resources: So in this lesson I want to discuss some of the resources that are out there. Yeah, this is this is like an entry level Auto hotkey horse. We're gonna cover a lot of stuff, however, you know, it's just the beginnings and there's a lot of questions you might have, and I'm happy to try to answer them when you have them, but honestly, there's so many other great resources as well. I wanted to mention some of them here so you can go look for yourself. There. I do have two other courses. There's the intro to how to hockey horse. So make sure that's a predecessor to this course, right? So make sure you take that one. Because I'm not gonna go through and explain a lot of the stuff at the beginning here. I also have a course on hot streams, Jackie stuck and I have a course on hot strings and hot streams are the low-hanging fruit of being able to automate things without a hockey doing text expansion stuff. Then Jackie and I have put on 46 eras of right now 46 webinars on auto hotkey in him and I also do weekly podcasts were up to 55. Now, you can go to those and just search, notice some keyword searches if you have, if you're trying to learn a given topic, right? There are a great thing because a lot of the webinars, we had very focused things that we gave a lesson and we had a PowerPoint deck. Everything's free or almost everything that the Udemy courses aren't free. I wish I could do that easily. But the everything else here is free. There are free resources to you. On my site, the automator. If you go there, you'll see I have stuff. I have a lot of videos on web scraping, on using Excel. I'm using the functions and auto hockey, which are incredibly powerful, regular expressions, controls. I created a tool called automate my task. And it's, it's odd, helps you automate finding an image and clicking it. So this is the, it's not the way I prefer to do it, but sometimes it's quick and simple, right? I'm also a web service APIs which is connecting the servers that are online. And we did several webinars on that and I have a bunch of posts on that. I also walked through using auto hockey Studio and I have, I think around 40 videos teaching you how to use the editor. It's an amazing editor. Having said that, I also used to use site for odd a hotkey, I still haven't installed and I played with it but I don't develop on it because auto hotkeys to HK studio is just far more advanced, has built-in functionality. It does take a little getting used to those. So some people that are News auto hotkey prefer something more like site or Notepad Plus, Plus, but I don't have any training on that. I'm sure you can find it. But these are all these ability, skill you'll have. If you click this, you go to my YouTube channel I have over, it's, I think it's really around 600 videos on, on a hotkey. And I add to it, you know, fairly regularly. Again, all free, right, if you can put up with the ads. And then this one, I actually wanted this Ultimate Resource. I wanted to quickly review it. So this is on my site, this Ultimate Resource page. As it right here, it says the 12th podcast, Jackie and I walk through a lot of things below so you can play this and actually listen to it and watch it as a video. And it covers a lot of the discussions of why you pick one over the other. I want to briefly touch on it. Obviously, here's the main hockey foreign board and the people are amazing. They're so helpful. But they also have, if you speak German or Chinese, I think that's traditional simplified Chinese, possibly, I'm not sure, but Spanish, Russian, French, Portuguese, they all have their own subforums, right? So you can go there if that's your native language, right? Go there and find someone that speaks your language in. You know, you can you can. Much clearer, get better answers. Stackoverflow, superuser, github, these are all really good resources for doing searches when you have a specific need. It's things that people have already solved and the help and the forum is nice about is you can post a question and the asked for help section in that people will try to help you and often they do. Then it's amazing. Read. It's another one is like that. You can post questions or see what people have done and post questions, but people actually hang out on Reddit and we'll answer it. Versus like GitHub and superuser StackOverflow, people aren't really necessarily actively responding to you. But, but these other ones are, discord is a great one on. You gotta use this link to join it. But the discord, if you haven't used it, it's a great people hang out there live and a lot of times I'll even share their screen and we'll help you dynamically answer your problems, your questions, what you're doing, it's a great resource. A lot of people hanging out there. The IRC is similar to that, but I don't think you can share your screen, but people do still hanging out there in YouTube, just do a general search for auto hockey. You'll see a lot of videos. I think I have the most I have. Like I said, over I have yeah. Anyway, over 500 videos, 600, probably somewhere in there on auto hotkey, hell-bent slash slavery born channel. He covers a lot of GUI stuff. So him and I, we've done we've done videos together as well. And he does a lot of stuff on Gillies. I'm not duties are not my straight. I don't I don't create them a lot and I just don't use them. So he's a great one to watch some of his videos about script. I don't think he's mainly thing recently because that's a really good tutorials as does H K22 or raptor ex. He, he's got some more advanced stuff, isn't really good information there for some blog. So Jacks auto hockey blog, he also has some books which I list down below on amazon.com that you can get if you'd like to read them and download them where you can bind directly from his site and I think he makes a little bit more money. So if you want to help them out, go to his site. I've bought several straight from him and I've never had a problem with worrying about whether I get it or not. Jackie site has this is my excite, the automator. And there's a lot of stuff there. Squamous what our software, this is a great way. It's kinda policemen a little stuff that you can learn. There's a cures, a couple of LinkedIn groups, a couple of Facebook groups. This one is the largest one and someone I, I created a few years ago and there's over, I think 7800 people there and they are pretty active to at helping you. Here's a Wikipedia site about auto hotkey. Rosetta code is a really cool example of you haven't seen the Rosetta codes really cool because it, it goes across different languages as how do you solve, how do you do x and our hotkey? And then you can see how it does it in JavaScript or Python or whatever, right, and jump around. So it's interesting. Now, I mentioned the two Udemy courses. Here's some more tutorials, links to tutorial. So these aren't necessarily videos, I lie. I prefer video, obviously video tutorials. But if you're comfortable reading the code and working through it, these are some good, really good recorders. And this pullover macros recorder that is by far the most common. When people talk about auto hotkey macro recorder. That's, that's the one they're talking about. I mentioned that. It's funny, I have to add it here. The automatic, my code. It's similar to that. Mind does stuff a little differently. But this one is definitely a good one if you, if you don't want to learn program too much into good one for you. And then there's some stuff like I said, on Amazon, I actually created some merchandise. So here are some books on Amazon and then I created some merchandise. So there's stickers and plastic bottle and aluminum bottle and a stress ball. So if you want to get you out of hotkey declined, you can order those or just write me directly and we'll figure out emailed me a check or something on value. The thing that I keep plugging along the there's a lot of resources out there. I know this result lot crammed into this time, but I just want to know. I'm happy to answer questions as they come up. However, I have found, the more that I do on my own to try to answer the question, the better I learned something, right? So vessel that within this things. 6. 01 05 Installing Unicode 32bit AutoHotkey: Alright, I do want to demonstrate installing on a hockey. I'm even though this is, we have a predecessor to this course where you should have already installed it. But let's go ahead and do this again, right? So open a browser of your choice. Go to q0.com. And right here, bam, download. I will click Download current version. I've already downloaded it. I don't want to wait for it to download, so I'm gonna click this. It's going to say See how it's saving us one onto my desktop. But I'm going to close all those. Pretend I saved it and I'm going to launch it. In here is where you're going to want to a customer installation. So this would have installed the 64-bit Unicode, but in reality, I believe the 32-bit Unicode is a better. Nowadays. I don't think it's safe to use ansi anymore. There are too many UTF type characters that end up getting botched. So use the Unicode 32-bit. If you truly want this history 4-bit, you can use it. But note that some libraries you'll find a line which just may not work because they're built for 32-bit. So the default places fine. I like solving mine elsewhere. I'll change my inherent. Wow, Hobson Stalin, who cares, right next. Leave all these selected next. And as done, right, that's it. So on hotkeys installed, it doesn't have a default program. So in the sense of it doesn't just launch something right away. But now we're done. That's it. Tiers. 7. 01 06 Selecting your AutoHotkey Editor: In this lesson, we're going to cover what editor or IDE, which is the integrated development environment you're going to use. So the ideas is to fancy way and said editor just has built-in stuff that integrate with the language, allow you to do certain things. I highly recommend auto hockey studio or HK studio from a STF. On my website, you'll see I have I think over 40 videos on it. Let's go here to Hawaii studio. So here I walked through how to install to it. And then basically everything. It is a steeper learning curve than other editors. But it does some really amazing stuff. Once you get used to it, it's worth the trouble. Now granted, you might set your if your newdata hockey, you might want to use that her like site or Notepad Plus, Plus. Both. Those are lighter weight and there they have a lot of menus. Built-in. Auto hockey pseudo doesn't have built-in menus, although I do walk through somewhere in here how to create your own toolbars. Adding a toolbar, which is one of the things if you are using HK studio, I highly recommend you create your own at the beginning. And the other one site that was the page I was on first sight for auto hotkey. I used it for years. It's still, it's a great editor. It has a lot of great functionality to it. I have a lot of training videos here walking through how to configure it better, make tweaks and stuff and use it, utilize it properly. It's, it's an amazing editor. It's just I prefer HK studio for some of the more advanced stuff it has. Notepad Plus, Plus is a solid at a very, if you're already using it, you can definitely use it and stay with something you're familiar with. And also a Visual Studio is a solid tool from Microsoft. It's free, you can download it and he can get this a auto hotkey support file to customize it. So auto hockey ball will be integrated in with it. All of these are solid ones if you have a different wonder used to, it's great. Just note in this course, I'm going to be using auto hotkey studio for tailoring everything. So some of the things might be a little different in the language you're using. Tears. 8. 01 07 Programming Resources: Alright, lastly, in this section here I want to talk about a couple of things. When you start programming, a couple links, you might want to bookmark each one of these things here. You can click them as you like, but I'm, we're gonna jump down here. So the first one, this quick reference sets the documentation One. It's a great reference source for doing some stuff and auto hotkey come over here and they have had a higher-level kinda concepts. The next one is this is the Commands link. And here is a breakout of all the basically like commands and functions. You can do another hotkey. There's other things you can do it I'll hockey, but they're more complex, right? But these are the built-in commands things would be trying to do. It's a great place to come in here. And you can also do like an index search or just searched in general. So those are great ways. The last one is, oh sorry, the list of keys. This is where when you're using hotkeys and trying to send key string, key combination, presses and stuff. It's just a good reference to have because this is where people start out oftenly in this is a good linked to have handy. I have them. And if we go to my home page, I have, um, uh, here's the documentation and commands and keys that I use regularly. And so it's just very handy to have a here and also dot hockey forums. Notice I have the IRC and discord there as well, but the forums are a great place to search, especially tutorials, scripts, and functions ask for help when you have problems, right? Just make sure you give enough context for people to help you. But lastly, what I wanted to demonstrate is what I mentioned here is, hey, hit F1 in your editor or your IDE. So if I'm in like studio gain, I'm in my, in a word that's a function. I can just hit F1 and it's gonna go and pull up the command. And I can click this to me and tell me how to use that, right? And that the documentation, this documentation that you get to by hitting F1, that's why it's an IDE, not a editor, right? Like Notepad, you can use to edit files, but you can't hit F1 and pull this up. There are of course, on a hockey scripts I can do that for you, but it's, this documentation is I won't say it's top-notch. It's a very good, good examples at the bottom. Every time you go to the bottom, you'll find examples of using it. And more often than not, it takes a little bit of work, but you can work through it. And if not, that's when you maybe use the forum to go find an example where someone else has used it. But before we started going down actual programming, I want to make sure that as you get stuck or you get troubles, try hitting F1 or try looking at the sources to work through something. Peers. 9. 02 01 Important Recommended Default Settings: Alright, in this session we're going to cover recommended settings that you have in pretty much everyone who your scripts or at least when you're developing a script. I do want to emphasize one thing that these are recommendations, right? Everything is different on what you're doing and it's your preferences or things that I've looked online found and the autarky forum, people mostly agree with it. These are some really good default settings. I do want to remind you. Some of these like this with a pound sign in front of it. It's a directive versus these are commands. If you care to go back to lecture ten in the Android Auto hotkey and take a look at the differences there. But let's walk through some of these. These are the ones I think they're the most important, right? These are ones I would more often than not having almost everything you are doing. The single since force. There's one is critical, right? Cuz I'd say like 99.9% of the scripts that I write are I want them to run only once when I launch it. I don't want to launch it and then launch again and have it launched. A second instance of that script. I want it to go check to see if there's that script currently running. If it is, just restart it, right? So that's a very critical one that I don't know why that's not the default to me. That should be the default. That's what I use and almost everything. But it's not. So make sure you want to have this one and that of course, to say single instance, there's only one instance running the set batch lines to minus one. This basically has to do with how often your computer will sleep in between it's doing stuff and auto hotkey. Minus1 tells it to go as fast as possible not to sleep at all. It again, as a preference, it's just when I'm working on a script. I want it to be as fast as I can because I'm spending my time and I'd rather have it be going as fast as possible. No environment this one will help. It does speed it up a little bit and I think save a little bit of memory, but it's more about the speed of not checking to see if you have empty variables and if their environment variables. This is one. This is the default URL. It should be added as what it recommends. The forum, it's not on by default I think, but it should be in every script. And this set working directory, your active script directory. Again, this one should be on everything. You eat more often than not, you want the working directory to be the same directory where you're running your script. So these to me are the critical ones you want to have in there on every script. Now this would mean you'd put them in the top or the bottom. It doesn't really matter where you put them in your script, right? But these lines would be in here. I'm going to cover in the third, third session on this group of videos, this section, how to have them on the include and then that way you don't have to have them in each one. So that's going to round it up for this one. Let's jump into the next one's going to be on not so important, not critical settings. 10. 02 02 Non Critical Recommended Settings: Yeah, in this lesson we're going to cover non-critical recommended settings. Again, this is for every script. Again, I have both directives in commands and here go back to lecture ten and odd, odd, to see the difference between those. Not that it really doesn't matter, but if you want to understand it better, it's good to make sure you understand it. I'm not going to walk through each one of these. These are the settings again, I have an every one of my scripts. Sometimes I will turn them off on a very particular one, but it's very, very rare. Let me, let me get a quick view here. Let's see the max threads. It's, it's rare I go above one anyway. So honestly that probably could even be less max memory. That's a good one, right? You're not going to allow it to eat up too much of your computer memory. Send mode input. Definitely that's a great one for the speed and reliability that there's three different types of San mode, right? We want to just input being the default title mat matching behavior. This is a good one because the default is, I think very specific in this one says to match when you're looking for the title, to match it anywhere where you find these words. And to me that's much more how I used the thing. So I like having that is on by default. Ba, ba, ba, ba, ba, these other ones, or you can read right here what they do. They are, they are good defaults to have in your script. I'm going again, this group of things and tied with the other one, the critical ones are everything that I put in my every script that I'm working on, right? And this is why I'm, in the next video, I'll show you how you'd be using include. And we're going to add some hot keys to it too. So let's go ahead and get rid of that next one. 11. 02 03 Using an #Include: Okay, so we just reviewed all the settings and I have this is my actual, the thing we're looking at here is mice default settings file. And imagine happening right now. And I mean, we're starting on line seven because I have some stuff up above which I'll share in a minute. But this is 20 lines of settings that I would have an every one of my scripts. And to me it's very annoying to have to have 20 extra lines inside the script I'm editing because I just started getting distracted and need to find what I'm looking at, right. So I'd like to minimize it. So what I like to do is to create this. And you can see here in my path that's my default settings file. Go check. Lecture 27 in the intro Dato hotkey for talking about using includes. You can have them in three basic places. There's the LIB folder of your current script, which of course probably wouldn't apply this one right, as we want one everywhere. The LIB folder where auto hockey is actively running, so probably where you've installed it, there's an LIB folder there that you can shove this thing into and then you wouldn't have to use the input. Well, you need to include it, but you don't have to have the full path here. The documents in there under your documents, there's not a hockey folder and LIB folder there. So in all these, what you'll do is you'll put a file there like I've done, and then go back to your main file. And you can include it in one of two ways. So let me, let me go back and do here. I'm sure I'm going to get a copy of the file path, so this will give me this. So here's the way I do it, but you can also do it like this. Put the path to the file. So both of these will are really the same. This one's just a little more concise, so that's what I have as my default, what I do in it. When you do this, let me go ahead and get rid of this because I don't want to include it twice when you run it. So if I was to run the script, it's gonna go out and run that other script with all the default settings and it first, and then come back and this one and him basically behave as if it is in this script. So there's some really big advantage that one is, hey, I have one line here and now I can start to in my coding and I don't have to have all these settings and I went on by default. The second one is, is I like to have some key hotkeys to work with my code, and that's what we're gonna cover in the next video here. 12. 03 01 Adding Hotkeys to the Default script: As I alluded to earlier, I have some default hotkeys built into my default settings. So this is for the scripts that I'm running developing, right, is not one that I would be. After I'm done developing it, I would change some of these settings because I don't want it to be this in every script, right? This is the one that I'm working on right now and it just helps me work faster and work smarter, not harder. So I got four of them. There's Edit key, a hotkey, hotkey to exit the app, a hotkey heat to reload, and a hotkey to run. Instead of walking through what they do here, let's jump into the code and I'll show you. So as I mentioned before, this is my default settings file. Here are my four hotkeys up top. In control, ie is set to edit and that's going to edit the script. So if it's, if the script is running, so I'm gonna hit all are right now which in Studio will launch it and see my little green eight showed up down here. Now, if, if I have studio closed or if it was minimized and I hit control, ie, it will pull up the active script and notice it didn't pull it up in my includes default settings. It pull it up in the script where that is mentioned, right? And that's the one that I want to be working on, right? It's a little counterintuitive because you would think it would pull up the default settings one and that threw me for a while, but know it pulls up this one that you included or from remember everything use an include is based as if it's running in this file, right? So I love this one because as I'm working on with something, I don't have to go and find studio or finding the editor. I can just hit Control E And it's going to pop open. That's active script. My may not know hockey script is Control Alt E. I have one for that one, a different hotkey to pull it up. So because there's a, your built-in may not a hotkey script, right, that you probably have fronting. The next one is exiting the app. So I have that built-in where if I hit shift escape, notice the hotkeys here, right? And now I'm going to hit shift escape. Well, let me, let me click out of studio shift escape there. Notice it exited the app for me, right? So I have an easy convenient way. I could have had it set to just escape, but unfortunately, I use escape for a lot of other reasons and so do other programs. So I didn't want it to trigger off as something that was so universal, so shift escape. And again, every program I'm working, I can just hit shift escape and it'll exit for me. I chose to highlight something else in studio because by default, studio has at least I believe it's the default shift escape. I've changed mine, so I really didn't let me launch us. Now, even inside here, if I hit shift escape, it's still exits out for me. But you'll need to go disable if you wanna, you shift escape or whatever, right? Make sure there's no conflicting hotkeys built-in to studio. The next one is reload, I think is a great one. Um, a lot of people don't like it, but I love it. So as I'm working on a script and let me come into me and let me demonstrate this one here when we go into this one. And let's say I was doing a message bogs, high grade I message box. Hello. Wow, so let's say I launch this. I actually, I should have gotten my next one because that's the one I'm going to have to hit a hotkey analogic. There we got nowhere. Hi. Hello. Wow, well what if I didn't want to get to and we reload it. So now I get to reload it and I want to change something. Hello. Now, relaunch it. Hotkey. Hi. Oh, you know what, I forgot to change something. Look, I can just hit my reload key and it reloads. Watch little green icon when I hit my reload key, it's reloading the script, it kills it and relaunch has it. So this to me is great because especially if I have I really loved doing something. I don't have to go right, come on here, right-click and say exit. I've already even reload. I can just hit a hotkey and have it do that automatically. The third one, or sorry, the fourth one is the browser back. Now, you may or may not have a browser back key on your keyboard, right? For me. And let me, the only way to do this, just, just like literally show you see these two keys right here. This is my browser back in browser forward hotkey, right? Or, sorry, keys on my keyboard. You might have them a maybe that it was convenient for you. For me. They're right by my thumbs are super easy for me to hit. So I I use them. I don't recommend unless you have a like mine and you use them because they'd be impossible to find. What you wanna do is find something that's easy for you to hit and then I can launch it. Right. So that's what I was hitting hears, oops, wrong one. So when I, when I hit my one, I can launch, tell it to start going through the script. And again I can reload it, we launch it again. It is, the alternative would be is to not have one of these and hit I'll are every time and have it come up. Which is fine. However, like for me, old artist is still a little harder, but it doesn't matter, right? I could change my default key to hit, to launch it. But to send all ares, my point, I could chain it. But what's nice is this is a built-in hot key and I can be on anything. And it's going to run it for me. And it's just, it's a super easy way for me to say, OK, now, go ahead. I want to work on it. I want to do some of them, but I don't want like a message box or a GUI to show right away. That's where, you know, if I want to control when it actually starts, instead of hitting all are with my keyboard. I can just hit that button and it just allows me. It's just easier because maybe I'm not in studio, right? And R is only going to work inside studio. Now I could use all our descend through my hotkey, but then I think that conflicts with studio some tube. So anyway, those are the built-in hot keys I have in. Again, this is everything i'm working on when I'm developing it. And then when I'm done developing a script and I have something, I will switch it to some other hotkey so it doesn't conflict with my current one. So I hope that helps too. 13. 04 01 Send, SendEvent, and SendRaw: In the next couple of sections, we're going to cover various types of San. Now you can send a keystrokes and mouse clicks and stuff, not hockey in various ways. Often they're used in conjunction with Hot Keys or a hot string. But you can have them inside your program to just send, send text or click or something to an active window. We're going to cover some of the bigger differences. These things get very advanced in very technical. So I got some links in here to how to go and look at it. I don't want to include too much technicality because really bogs down and all the reasons why use one over the other. And it, it's it just depends on the circumstances and what you're doing. But at a high level. So send in, sending events are kinda similar to each other. Let's go over here in studio and let's see, let me borrow this example here. But I'm going to leave that off for now, back to studio paste. Now if I was to save this and run it. When I hit my hotkey. When I've tried this again. Notice the exclamation point didn't get sent or allele appears it didn't, it did. But you gotta remember not a hotkey. The exclamation point is the ALT key. So it's sent to really quickly is sent to the ALT key. And that's because if you're certain keys, certain characters have special meaning and auto hotkey, the exclamation point is one of those. So what we wanna do is wrap that and here's one way to deal with it, just to wrap it with these curly Prim's, save, reload and run. And now it sends the exclamation T, right? So that's how we can, but it's one way how we can do that. The second event is very similar to send events. And let's go ahead and do this. It'll work exactly the same way. So save, reload, run. So it works exactly the same way. The difference being, and let's go back to here is a send event will rely on the set key delay, which is also in our configuration file on how fast to send the keystroke. So if you're dealing with a game that doesn't accept keystrokes very quickly, like I actually automated the original doom game and I was automating, sending texts to people. And it was setting it way too fast. So I had to slow down that speed at how it's sent them out. So it's a good thing if you need a slow it down, that's up and you want to, you can set with the set T delay and then you send event to control for that sending raw. And there's a couple of different ways to send raw. I'm, I'm just gonna cover one here. Is what we can do is we can just say send wrong. And in that, well, the nice thing of, you know what? Let's, let's leave that the way it is. Duplicate. Rod, there we go. Now if this way it says, hey, whatever taxes here, send it, pretend to disregard that there's a meaning for it. So if I hit this, see how it didn't have to wrap the exclamation point in the curly braces. And that's because it said send Sun Ra of actually what you follow up here with, right? So this is one way you can do it. You can, I think you can say Send and then have that like this with Ron here. Okay. I believe this well, it did work. I was just up above. It'll hockey. And I think there's possibly even a third way. But you get the idea. This is when you have special characters that you wanna send exactly at two approaches, how you can send it. Now we're next going to switch over to the more preferred messages of using scent. 14. 04 02 SendInput and SendPlay: Now this next type of sending these 2s, both sender and put in some play. They're generally much faster and more reliable than, than the other send events. Sandra, and just send. One of the really great things about it is they buffer the physical keyboard or mouse input. So basically, let's say you, you were, you automated a script to send something yet you were typing in the meantime, well, both send and put and send play. Well, stop you, your keystrokes from being intermixed in when it's sending the keys to whatever active window, right, so that's a great functionality because often you didn't actually pause the script and it's doing something and you want it to finish sending the keystrokes that you told it the sand, then apply the ones they buffered it, right. So they didn't clear it was buffered it, so it'll send yours after it finishes sending those keys. So that's a really great advantage. I do want to point out the set input ignores that set key delay so that you had the, you are changing the speed of it, it wouldn't do it. I think you could actually override that incident plays big advantage is that it works in a broader number of games than other modes. However, there is a huge issue with it. Often the UHC was at user access control, something like that. Use user access control. I think God is, can really mess it up. And this is what when Windows seven, I had huge problems with all of my stuff and the UHC was dealing causing havoc with it. There are some work arounds and I got there straight from the support thing. You can do. You noticed when we when we install it auto hotkey, there was this thing, an option we can say run with the y-axis. So you could go back in and turn that back on. Or you can, you can try running it as administrator. This doesn't always work, but, but sometimes it does. And you can disable the local security and run all by Christian admin mode. This is not recommended. There's also where you can disable the UHC, but trust me, That's not something also you really wanna do unless it's your computer and you really know what you're doing. So here are some other ways you can do it. So again, it's just a faster, more reliable way to send. I didn't want to bring up this control. Sand is another one, but we're going to cover that when we talk about control. So it's another way to send keystrokes, mouse clicks and stuff, but it's just makes more sense to cover under control. So I hope that makes sense to a church. 15. 05 01 SetTimer: Alright, in this session we're going to talk about set timers. Settime reserve are really awesome. Because one of the biggest reasons why as auto hotkey is single threaded. If if you're running a program and it get stuck like on a message box, it doesn't continue on until you wear that message box. Set timers allow you to do stuff habits still run in the background. It makes it feel multithreaded, although it truly isn't. I mean, you can read the documentation if you want to get caught up and exactly how it's doing it. I think it's creating a bunch of different subroutines and just switching between them. But let's go ahead and start an example here. So let's say we had an R program. We're gonna run Notepad and we do it three times. What I'm mimicking is, let's say you have a window that constantly pops up and we end, you don't like it. So if I run this, it's going to create three instances of notepad to can see him here. They're all in the same spot. So that's why it looks a little weird. But there's three there. And now if I run it again and it's going to create three more, all right, but let's go ahead and start working on a set timer to kill those. So we're gonna go here under say, set timer. And you can point it to either a hair I'm noticing you can put into with a label or a function. We're gonna use a label to start with. We'll switch it to function, doesn't really matter. The one thing you can't do though, is you can't actually pass it like easily pass up parameters for the function. So it's a timer given a name, we'll say kill Notepad. Now I'm going to add a comma now for the period is, is to start off. Let's start off with, let's say every 1000 seconds because we want to be able to see it happen. And we wanted to go do this every, every one set, a thousand is, is this is one millisecond. Thousand is 1 second. So we're gonna have a do it every second. It's going to jump down here. Now of course, if I try to run this and it should give me an error, we know that we can see it because here, but it's saying basically, hey, there's no, there's no set label, right? There's no kill notepad labels. So let me go and copy this, and I'll put it right here. Create a label. And let's see here. So we wanted to kill, that'll be when close. Now the title, so I can see it right there. I'm going to launch this built-in tool. Oops, wrong key. And we go in auto hotkey. That's the window spy tool in. I can just borrow it for this writer. I sorry, I can get this almost say when close that and add our return will travel. Wow, that was way off. So now my save us, you know what, I really run it. You're going to see how I can close this now. I hope when we launch it, it's gonna again, it's going to add three more note pads. But then every second you're going to it's going to, you know what? Let me Let's just run it for now. We're going to have this. First off, let's, let's put a message box in. Set timer. There we go. So we're going to see this now I'm gonna run it, we launch it. And you're going to see, so now C the set timers and see how it did. Popped it up again. It's, it's in there each time. Write it keeps coming up and notice it killed the notepad. Oh, and this is where because it keeps them coming back every time now because I'm inside the set timer, it doesn't go pass this message box. Let me go ahead and reload this. And I'll give you a better example here. So if If we put a message box here and say hello world, I'll go ahead and get rid of this. Now hopefully you got the idea that we were actually inside that set timer and it was going there over and over, right? We're gonna go ahead and launch this. It's gonna run, it's going to create three instances of notepad and that's going to sit here with Hello World. But thing is your script would be stuck, right? So when I run it and see that we've got our Hello World, and notice it created three, right? We can see him again on my taskbar. However, it's stuck on this one, right? And literally no other code. It, my script would be running because with how single-threaded auto hotkey is, it's stuck in this input box. It's waiting for me to go forward. Now, let me reload it. Would if this was beneath this, right? So now we have the, still going to have a hello world, but it's going to start the set timer in where it's going to be jumping down here every second, you know, let's make that a little bit longer. Muslim, I get 1300. And now we're going to end up with six notepad windows and the hello message boxes. That's going to happen right away. She, you'll see right away, it's going to get in there. But what's really cool is it keeps jump down here and closing these notepad windows. So let me run it. Now. Watch there's a six Now see how it's closing each one, every 1300 seconds. It keeps closing them. And still that even after the last one, it keeps checking and says, hey, if that exists, close it, right? So this is a great way if you have something that you want to keep running in the background, even though while you're working in your script, it's a great way to pretend like you have multi-threading. Another really cool thing, it just depends on how you're using it is if you make this a negative value. So if I change this and reload it, it's going to. So right now we don't have any note pads. What's going to happen is because this is negative value is going to wait for the first. Well, no, it, let's make it three seconds. So we have some time. It's going to wait three seconds and then come down here and it's gonna run it once and then quit. It's not going to use a set timer anymore. So when you make this a negative value, here's the 3123, there goes to one and then notice it doesn't keep going, right? So this comes in handy when you have, you already have a label or a function somewhere in your script. And you were using it for some other purpose. But you want to say, you know what I need to call that thing wants but I want to call it, you know, after three seconds, this is how you can do that, right? You could use a set timer, say go to it after three seconds or whatever time you want to put in here. But it only runs at once. It doesn't keep looping over it, right? It's not, it's using a timer and you're not using asleep because of course asleep would stop everything, right? So that's another, again, it's a really beautiful thing. The saying is separate. You can also, let's, let's actually do a little thing here. Let's say static. You know, well, let's convert this into a function. So that should still be fine. Static counter. We're going to set it to one. And then we're going to increment. Our counter. Will do plus plus, which means add one to it. And then we're gonna do a tooltip. Keller. There we go. So and let me go ahead and get rid of this. And then we just haven't returned. So now it's going to do the three. And we're going to see a little counter here just so you can get an idea of that it's jumping back in here. And I don't wanna wait that long. Alright, lets do it every two seconds. So it's going to update this tooltip. And let's run it. Are we in here? Oh, you know what? I I killed display. We go. Oh, there's a problem. Unfortunately, can't see the problem. Specifically, counter equals one. Why there's network that should where again, I could delete this but I don't want, I don't want to static. I have a cheat sheet up above here, static timer. That should work. Okay, so I just realized I don't have my, I converted this to I started to convert it to a function. I, but I did not add my parents so we can get rid of that return there and now we're in a function. All right, and let's add a return here. So it doesn't fall through, right? Not that it would matter because it wouldn't actually. Now I launch it specifically kill notepad. Oh, I forgot my point. Here we go. Alright, now, why was noticing the screen H wasn't down here. Usually I don't have this shrunk up so tight so it's easier to see. But now let me go ahead and let it. So there we go, we launched it then all these sayings, Look at my timer over my mouse, right? So each time it's incrementing that counter. So if we want to do something in there, right, you could, you can build stuff and change it, but this is just allowed me to see and note. It's still running. After all, no pads are gone and still coming back every two seconds in checking to see if it's there, we're in this loop, right? So it's a great thing to be able to do. Yeah, and lastly, if we wanted to say, I would say after the message box, we can we're going to turn it off. So I think that well, now we're gonna run it. So here are 23. Now when I hit OK, it still, That's upgrade. Now when I hit OK, it's going to stay static on five because I didn't get rid of the the Tooltip. I just told it to stop running the timer. And I think does it delete? I think delete is the other thing we could do. So again, it's gonna be launched from all three. Let's finish those. You're so it's there. Ok. So number 45 and we're stuck there. So that's an overview of using set timer. It's pretty, pretty useful. Again for if you have a script that often gets hung up in a window and you still want to be doing something else in the background is a great way to do that for. 16. 06 01 Intro to IniWrite IniRead: This next section here we're going to talk about any region, any right there. Initialization files or dot any files. Files at Windows back in for as far as I remember, like maybe even 3.11 had they would save your configuration settings for your program. So it's a great way for us making scripts if we want to save a given file to a folder and then pull information from it. It's a very easy way to do it. You can set up key-value pairs and lookup for specific things. Kinda gives you some complexity of like a database kinda tool, but it's very simple. I wanted to point out a couple of things here. You can write longer Values and 65,535 characters, but any reed has a limit of that. So you'd, generally speaking, don't want to try to write more than that because you can't read it in and it's going to truncate it. What you might wanna do if you're doing that is just parse it up. Regulating the sections. 65 thousand characters. There's a lot of characters, right? So we're not even going to address this. And that's because how often is it going to come up, right for me, it never has. To keep in mind also that when you you can't have, you can store it, you can throw in line breaks, but it will truncate it if you have I break. So you need to search and replace line breaks with a different character. And we will go into that when we're actually coding and show you how to do that. There are two structures for the any right? It's kind of interesting is this, there's, you put the value here, the section and a key name. And this works great to be the flows. A little weird. This pairs version I liked better because you'd say like Joe equals glides. That's what you put there. However, what I don't like it, but then this section over here, what I don't like about it is that you can only have one apparently under it. And so one key value pair. So it's very limiting this one you can keep stacking a lot of stuff under a given section. This one, he can only have one key-value pair under it. The ANY read. Again, you can go through it and this is kinda like the reverse you'd go through and say, Hey, what section am I looking for? The key, give me that value and store it in this variable. The other way is this one. You can get all of the information under a given section, as I mentioned earlier, you can have a lot, it's possible with this version, have a lot of data under it. So you can read all of that into your variable, then parse it from there. This last one is if you don't know the names of the sections, you can do this one to get all the list of the sections in your any file. And then you can use some logic to decide which ones you want to go to. So I'm gonna stop its video, but we're gonna get into working on each one of these sayings. I wanted to give you an overview that you can go through and get kinda prep for it. 17. 06 02 IniWrite Keys and Values: So we're going to begin our lecture on this with working with any right. Because of course if you don't have any data, you can't read it, it. And so first off, we're gonna do notice here there's a folder. This is the act of folder where the script is located. This any right. File, you know, there's no right now know any files. No. Nothing that we've done. So let's go ahead and one of the cool things about it is let's do any 2p or if I could spell any, right. The value this is, this is the text you'd want to put in there. So let's say woke up my last name, Klein's comma and the filename. So this is where you're going to make up your file name. Test dot INI. In this section. This is the area kinda thing is a way I think of it, of where you're gonna put it. Let's just call this main. Right now there's nothing. And this is the key. And so this is we're going to use my firstName. And I just realized diagnostic matters, but I misspelled my last name. So I'm gonna save this and run it. And now notice my hockey to run it. So it just generated a test dot INI file, right? On. What's really cool is that if one doesn't exist, it'll automatically, you'll create one for you so that, that's a great feature in itself, right? You don't have to go create this file. We're going to drag this into site. And so we can see now here's that section main, right? That's what we put there. And the key and the value pair is, this key was Joe and Joe equals blinds, right? So let's do one here. Let's say I'm going to save this or copy up, sorry, and let's change it to Joe. Joe Bob. Who knows. Now what's really cool about this is I'm going to save us, relaunch it when I run it. And I come over here and click now it says, hey Joe now equals Bob, right? It looked up. Notice there's not a second line, right? That's a critical point. And the other thing that I wanted to do, this is the cool thing about auto hotkey is I don't like having to click on this to update it. I'd like it to just automatically update it. So let's write a little auto hockey script right here. So let's say when activate, when title. Well, it's just wing it. Test.html. Hopefully that's enough. Let's add a little sleep of 60 because then I want to say when activate, I'm going to bring it back. I don't want to have a change to focus. It's going to activate it, but I want to stay in studio, right? So let's go back and say when. And this will be a HK studio. I'm I'm just looking like right here and this one. And right here I could bring up the the wind spy tool, click in and get it from this. Because again, in my default settings, it tells it to say match it anywhere. So I could have put any of this, you know, anywhere in here and it should match it. So now let's change this to three. Save. I relaunched it now when I hit my hotkey with any luck, it's going to activate the site window, updated and then come back to studio for me. There we go. So now I don't have to keep going and refresh that, right? This is one of the great things like you said about not a hockey, right? Three lines and in what a minute. And we have a tool to DOE had an auto update. So I'm gonna stop this and we're going to work on our next step using the key-value pairs. 18. 06 03 IniWrite Key Value Pairs: So this next part on any right, we're gonna do the key-value pair method of using the syntax, so it's slightly different. And let's go ahead and let's remove this. So the, Now here's one where studios being a little misleading because this is the same value. It just not built to have it both ways. So here, let's put it in the will make the key Joe and equals two, let's say four. Again, we have to give it the file name and the section is maintained. So I'm gonna save this, relaunch it. Now when I run this, you'll notice with updates that to four, right? Which I think this is awesome to me. This works a little bit clearer in my head of how I would want to do this. It's just right next to each other, right? So I could easily up to this book. Why I don't like is if, if I put this to Cathy and five, good, I really run it. This Ido I would think with the other one up above, I can have a different key, like let me, let me demonstrate here before we do this, I should've done this at the end of the video. So let's say that the key we're gonna make Kathie. So that's my wife's name. So I'm going to run this and launch it now. And now notice we have two keys stuffed under the main section, right? This was awesome because now I can go through and get exactly what I want and settled there. But again, at it kinda works. Wait object does, if you use the same key, which is this part of the left, it's going to update the value. If you used a different key, it's going to create a new row for you with that key value pairs, right? So it's, it's very similar to how objects work. But watch what happens here when I say I was going to add. So this is John as my son's name. Now, let's add this as six or so. We have a different number. Say every lunch. Now when I run this right, it would be great if it would shove this under here. However, it gets rid of all the other key-value pairs and shoves it under there. So to me, I don't want to have more than one key-value pair under a given section usually. So that's unfortunately breaks out. What you can do though is, is I was playing with it when I was learning this because I haven't, I haven't used it, this, this key value pair method before. So if I run this o, Let's wait. I thought it it, it allowed for more than one thing under a section. Let let me, let me add. Okay, there we go. It was, it got rid of that key value pair. You can keep shoving TextEdit. There'll be under that section which could be useful because if he, if you used a different parser, let's say I, instead of using the equal sign, I wanted to use the pipe so I could put Joe lines and then have another one that said Kathy, guidelines and john glides, right? Let me manually come in here. Delete this, say this, we launch it when I run it. Now to see everyone's, Oh, interesting. So I didn't I didn't save my text any file when I did that. Unfortunately, I cleared it but I didn't delete it. So notice it has them here and now if I was to go in and read this, I could just grab all of this data, then parse it on my own with the pipe as being the key value pair. So that's how you get around. Don't use the equal sign through key-value pair or use a different character as long as you know that it's not used in any other way. But that's how you can use the any rights with the key-value pair stuff. Now let's go ahead and work on the ANY read stuff. 19. 06 04 IniRead: Okay, and we're going to start reading some of the data. Let's go ahead and do is read. In. First we gotta stored in a variable, right? So I'm just going to be a very original and call it VAR. And what is our next section session? Sometimes studio will stop auto assisting in so you can, you can hit, well, there's no way I can hit. Refresh and project explorer could explore. I'd made control our current project. And that's what refreshed that line now. Yeah. It's saying I'm not done with i3. Great. Anyway, if it never stops assisting and that's where you can refresh that current one eye. It happens somewhat regularly. So I built it where controlled Arab, I'll refresh it for me are Anyway. So the filename test.txt him. Again. If that if that folder file was a different folder, you'd want to put the whole path there, right? But since it's a local file, we don't have to worry about it. Section while we only have one section currently and its main and the key, let's go ahead and get John. Ends do message box percent, var, Save, run, it. Hit my hockey. There. Look, that's John. Looked up the key, which was Jon, and brought back that value for me, right? So now it has lines in there. If I changed this to Kathy, it will put up griffin. Right. And if I change it to Joe will have topic2 because I'm Joe taco. So that's the simple way of doing you can get it. Each one of these. Now let's say you wanted to everything under that section, right? So I do like this one is, let's say looking down here. So finally section. So I think, oh no, we just want main. We're going to leave off the, so that's the section, but we're going to leave off the key. So I'm gonna save this, reload it and run it. And now notice it gets all those key value pairs under that section, right? So this is a great way that again, we can kind of do the other one. You can get everything under there and then parse it, go through and start parsing things using like store splitters, something, right? So that's a great easy way to get a bunch of information. And lastly, if you didn't know the names of your sections, it's just the file name. And this will get you, of course it's just main because we only have one. But if I had created, let's just manually do this here. Two. And you can have the same things repeated on the right, that doesn't matter. So now when I run it, it gets Maine and two and this is how you would look up to see what sections are available in that file. Okay, now I'm going to stop recording this video. The next video we're gonna do more of a working through. Let's start using some staff and let's fix that hole. If there's a line break in the file, mess around in the text, I wanna save. How do we deal with that? 20. 06 05 IniWrite IniRead Working Session: Alright, so this can be a working session using both any read, any right? We're going to address the whole. If there is a line break in your code, the text you want to save. So let's, let's first do. Let's come up with an example. So at any rate, let me write. The value is going to be oh, you know what? Let's split prejudice. So annexed colon equals. So what I like to do here to just say, hey, you know what? Before I go down a road where I might be when I'm troubleshooting and something doesn't work, let's comment this out and cause an error. I'm going to run this. Oh look, and the final variable names like Okay, so what did I do wrong? And this is why I do this kind of stuff, right? Is still run them. When I tried to reload this. So doesn't like that. Oh, I know what I did. Ok. Sorry. On when you do it this way, you don't use the colon here. So now when we run this, now, see here is our variable. This is multiple lions, right? And that's what I wanted to prove because let's say you had an error it out. And I was working on the other thing. I would have been focusing on the wrong area and right. So again, I leave the screw ups in here on purpose because it's just good ways to learn how to troubleshoot, right? We all do it and it's, I'm sorry, even the people that do like the really professional lynda ones. No matter how good you are, you still, you end up screwing up stuff and he got to troubleshoot. And so to me, watching how people troubleshoot as a great way to learn. So I know right now we have a variable here because and this is just one of the things with hockey people confused When you use percent signs and when don't you for a variable, because before we were putting the plain text in here, that pretty much guarantees that I need to wrap it like this. And we'll test it another way. But this, I'm pretty darn sure it will work in any rate. Again, Studio is lost its focus over here, r. Here we go. File name. So this is the test dot INI comma. And that's funny. It looks like an I lost the focus again. Section. There's main began and I think that's it. The LP. Sorry. Yeah. What key do we want to put? Will tie line. So I'm gonna save this, reload it now when I run this, it does shove it in there properly and well, I shouldn't say properly, but notice it says multiline equals this. And then then you have your line breaks, right? Well, what do you think's going to happen? Let me comment this one out and let's do it. Any read var, filename, test.py and i comma. Section is main, the comma, and the key is multimedia data, right? Yeah, I can see, by the way, see how that's highlighted up there. That's how I know I did that properly because it will show all the assistance is one of the things I like about it. If by the way, if it didn't exist anywhere, even on that word, see you when I'm under it. It doesn't underline it. Right. So that's how you know, hey, I did a typo. There we go. So now we're back to good. And let's do this in a message box. Var save, run. So see how it, and it pulls back just this, right, just that one word. So this is why we've got to deal with these line breaks. So all you need to do is say, hey, alright, now we're gonna take that variable text right up here where it stored. We're going to use little dump it into itself because there is no problem with that text colon equals. And now we're gonna do string replace. Replace. In the haystack is going to be taxed haystack, that's what you're looking in. And we're gonna say replace it with what? Well, I'm sorry, search text. What are we looking for? So I think I'm gonna go with this. It might be the line return new line, but we're going to start with this. And what do we want to replace it with? Oops, sorry. And we would want to replace it with, oops, put in quotes again. And let's put it up pipe because I don't normally use pipes e. And again, because I like to see things and not have to worry, I could just proceed forward and look at it. But what I'd rather do is shut this into a message box to make sure I did what I did worked. So there we go. Instead of having it on, let me even do this. So I'm gonna do this right up above. So I want to run it again. Here it is the first time. And then after line 12, now it's replaced those new lines. And I can see this visually and say here now it's got pipes in there, right? So the great thing about that is if I let me get rid of that message box and this one, I'm going to bring this line down. Now when I run this. And I don't know, I commented that out. But let's for now, let's come at both these out. And let's just save it and reload it and run it. So notice it's shoved him into here. Let me zoom out a little. So it now it's got them all appear. Now. This would be some noise we should have dealt with in the first place, but it's not actually going to break anything. So I'm gonna leave it there for now. We'll delete it in a bit. Delete it. It would be tough to programmatically go get that, but I'd just come in here and clean it up and and work on it. But now let's show this so we wouldn't want to keep, well, we can't because it'll, it has that key, a multi-line, right? So it doesn't really matter if we rewrite it because it's a unique key. So say every R1, this is the, so notice this is the way I should do is put it in red. Now when we show our message box, so see this is the red, this is what we've read from it. This is it now of course, we don't want that. So we would want to do the reverse, right? So I'm going to be really lazy and copy this thing. And you know, we can just, well, yeah, well changes Davar. This Davar, right? So we're sticking with var there. And then I'm going to, I'm going to cut that and put it here. Right now. It's going to say, hey, when you find a pipe, put it in a new line, right? So save this, reload it, run. Now by m, We're back to have in the multiline, right? So this is a simple way how you'd go about taking care of that. It's, you know, it's not overly complicated, just one of those things because of the ANY read and write can't handle line breaks. You've got to deal with that. Again, I wouldn't I would just make sure you go back and clean it up. Because why have that extra junk in there? Anyway, didn't use pretty cool. You can access different sections, have different keys with values. Very easy. You can go through and parse, get a bunch of data at once. And that's pretty much it. The one thing I also, I did want to point out was if you had spaces around I think these characters, it, it auto trims them when you read them, if I remember correctly. Magellan speaking, remember the Most people have spaces and they wanted there anyway. So honestly, I don't think that's a BB. Alright, Cheers. 21. 07 01 Overview of Windows Registry: In this section we're going to be discussing how auto hockey can make edits, deletes, write to the Windows registry. I'm going to take a brief overview here of the Windows registry. Think of it as it's a, it's a hierarchical database that stores settings for both the operating system and your file, your programs that are installed on your computer. If we look here, by the way, that link up above, there's this wiki inter industry entry, which covers a lot of stuff that's in the registry. Especially this first part here was interesting, was it basically it was built to replace the any files, which is what we just covered. Now. It has a lot of great, amazing stuff in it. It's also very dangerous. So be careful if you're editing your registry, you really need to know what you're doing, back it up. It also you can easily piecemeal out little pieces of it so you don't have to have the entire registry, which was enormous. This document go through and read the different sections of your interested, right. I'm not going to cover all this stuff because it's out of the scope of the lesson. But let's go ahead and look back here. We're going to cover the registry, read-write and register elite. And then just so you understand these keys that you access, it's this long path, right? Or you can abbreviate it with these abbreviations. And real quickly here to I wanted to show if you if you're an admin on your computer, I think you can type when news are n-type Reggie Edit. And this is going to open your registry. Now I was at a certain spot, so it's defaulting to there. I'm if we move over here on the left and go up, you can see these. Here are the, I think these are called hives, if I remember correctly. That's what these are here. And that's the abbreviations, the H key. These are you can use instead of that full long names. So it's just up to you and which one you want to use. But you can also, by the way of great bookmark. So I have bookmarks here where I've done stuff. But that's the registry. It's, it's amazingly powerful, but it's also very dangerous. So again, please don't play with this script if you're not, you know, and build this if you're not fully knowledgeable, understanding what you're doing, I'm not going to, I'm going to create a new key in, set it, in, read it, and delete it. So I'm not monkeying with any of the settings are already there. But again, please be very careful when you're working in this. And it's all I can say is it's, it's very it is it can make your computer where you can't even operate it and load it if you did something wrong. So I don't do a lot of reasons why I would do it is, hey, if I wanted to again, set settings for a given program, I can store them in a registry. I can also go check and see what kind of programs installed like it. Let's see if I wanted to see what version of Chrome is currently installed on this computer, right, I can get to that path and see where it is and see where it's installed. I can check the versions of the OS that we're running. And there's lots of amazing stuff you can do. But just again, it's, it's very, very dangerous. So here we go. 22. 07 01 Reg Read String Variable: Okay, so for working with the registry with, let's start off with a read, read command. Read comma, shove into variables, we'll just call that var comma. And now here's where studio is to offering up the four letter abbreviations. I'm looking down below the, you know, and here's another thing we're gonna, we're gonna get this from. Let's copy the whole thing just because I'm not using. Alright, so I'm going to copy this, paste it here. Now that there we go. And that's where the HK user one goes. So yeah, that's highlighting there. And then this is your path down to here. And now we gotta decide what the sub qi is, the 7-Zip. But let's get the actual value from path. So path, I'm going to put a message box here. Var, save the run. What I do wrong. Hk, HK current user software. So I don't think we, oh, there we go. Let's try that. Here we go. So don't have the backslash n there. Make sure you turn that off. Now we just got this, this RG as z. This is a datatype. There's several, there's quite a few in the registry. Let me go ahead and show you here. There are these are the 1-2-3-4-5 that auto hotkey can manipulate read and set. So SZ is a string value, right? So that's how I knew had Chopin. A message box is fine. This expanded Deci, Is it can, can train environmental variables. So that's not too exciting to me. This multi SC is interesting and we're gonna do a quick example that I have to find one. That's what one of the difficulties, or maybe we'll create it now what is phi one? This D word? It's between 0 and whatever in the world that large number is. And then there's just a binary. So I don't think we're gonna go through each one of these will play with the strings because it's easier to see what they are. But let's go ahead and find a let me go ahead and stop this. In the next video, we're going to deal with the what was then called the multiverse as z. 23. 07 02 Registry Read MultiString and Expanded: Alright, and this example we're going to demonstrate that expanded string one was a called here Multi string value. I think it's kinda cool in how they store it in. And actually so I, it took me a lot of fine one. But if you go down to local machine system control service bits for on my computer and I don't know that we'll never ones, but see this different data types. So here, here's a couple more, oh, I'm sorry, that's expanded. And we can go ahead and you know, since we see that, let's go ahead and do a demo with that one. That's a different type. That's the one that has the variable tapes I'm sorry. System path type the percents. So it's a variable in there, right? This multi One is the first one we want to grab. So let's do read, read, and store it in VAR. And what did I say? H k l, h k l. There's no way I'm going to try to type all this. So I'm gonna copy that remembered from that last one. Don't get the backslash. That comma. And what are we getting here? The first one is required privileges on risk required villages. So I'll save this, run it. Right. That does not look like all of that. You know what? Let me so this is I think is a neat thing here. So see how it's breaking it out. Each line that's showing you, there's actually, I think it's storing line breaks or new line feeds in between each of these sayings. So here we go. So you've run. Why is that giving? I mean, the fact that it's o remember, much go. Here we go. I guess it just didn't reload. There must have been a problem. So it's pulling this data from here. Notice it puts it on each line, there's a newline returned in between J1. And that's how apparently you can store this with the new line feeds in there. And yet when you extract it out and you would have to loop over it or parse it in some way. We could do a string split and parse it on the new line feed. But I just want to demonstrate getting that data. And since we have the example here, let's go ahead and show this. I can type in which bath. Alright, let me annotate this. Always annotate, get in the habit of it. This is the multi. Now, yeah, string and the next one, which I'm going to just duplicate this whole line and change this to image path. Path. Now noticed, excuse me, when we're, when we're getting the stuff, we don't have to let's, let me, sorry, let me get back to this image path. Where'd my final note? This expandable Is that the one we're doing expand whereas image path expand SE yep. So expand IC is expandable strain that can contain environmental layer rules. So you know, I'm gonna go ahead and copy this. So put that in there. And now when I run this and Hitler hotkey, it pulls that one difference being those percent signs that those would be treated as a variable. And it has to be stored in a certain way for it to have those characters. So if you had using a system path and you wanted to use it, see if you store this as a string, I'll bet you, even though you store it there, the system reads it as a string, not as the percent sign I'm piping in the path to that, whatever you're doing, right? So it's just an important thing to note. So alright, so those are those two. Let's see. Like I said, the other one's getting it aren't anything exciting. So let's go ahead and move on to, let's quit. We're gonna create a new, will create a whole new key, and then will set some values or something. So that's moving on next. 24. 07 03 RegWrite: Alright, this session we're going to cover the reds, right? So, right, we're gonna create a string. You gotta remember from that other code I showed you last time, REG and her core SE is for a string value. Where are we going to put it? It looks like here I was at Coachella under Software and which is under the H k current user or we go comma. Here's where we're gonna put in software. And this is where we're going to start adding something. So let's say we wanted to, I'm going to put a wonder. So starts near the top there. And let's call it auto hotkey. We can go ahead and shove it in like this. And we save this and run it. Refresh the thing. Oh, I didn't know my hockey. Here we go. So see now we have this new, I think I want to call this a folder. It's kinda how it looks. However, it is not a folder. Remember it's a, it's just a key value pair with data under it. So we just did that and let's say we're going to comment this out. Let's say we wanted to add to it. In, under that, we want to add, let's say the sub key, we're going to call my key. And we're going to set a value to Hello World. Save it, launch it. Now I wanna open my hot kid or run it. Now let me look in here and hit F5. I'm so we added a new sub key here with Mikey. With oh, look at that. I put the name. That's funny. My key. Yes. Auto hotkey, that should have been a comma there. And then that has the my key and value. There we go. So scrolled off the page here and we'll see if that helps with the, there we go. Now we can see what we're doing, right? And so I get, what I wanted to demonstrate is notice, I'm gonna go ahead and delete this whole key, this one underscore auto hotkey. Here we up this line we created before, and now I'm going to be setting this Mikey and hello world. And note there is no one out a hotkey. And the great thing about this is when I run this and we refresh it, it goes ahead. If this doesn't exist, it creates it for you. Creates the mykey, stores it as hello world. And this is, remember this was the, the, the RAG ASC for a text value, string value. So that's how you go ahead and create keys in here. And again, this is where you might want to save some of your settings, right? It's I had to hit F5 here to refresh it. But the registry, it's both a file and it's loaded into memory. It's one of those kinda things to me, it's a little confusing. It is very fast. I'm, i actually have written other scripts where I will have multiple scripts running and I will write a variable to the registry. And then in the other script, I'll go read that value and read it into my other script. It's one way that you can pass variables between. There's other ways, more efficient ways. But that is one way you can do it and it's very fast. And you can make it wherever they're at static, that it only lasts if you put it under the what is the current user know not hurting. Sure, sorry. If you put under a certain key, it'll only lasts. Maybe it's the current config. I can't quite remember, but it only lasts that time while you're booted up and disappear. So you'd have to worry about you keep adding to it. Let's go ahead and let's you. Well, I'll stop here and we're gonna make the delete. And then I'm gonna do a little work in session on this. 25. 07 04 RegDelete: Okay, so for this lesson we're going to do the building of a key in the red tree. So that's red delete comma. Again, we're still only a H, K, C, u comma. And sub key is gonna be software. If I can spell software, slash on HK and others, the value, I'm, let's go ahead and get rid of the my key, which is the thing we had created. So my save this, launch it, run it, and when I refresh down here, there it goes. So it's that easy if we wanted to go ahead and get rid of the auto hot key higher-level, right? All we would do is get rid of that. And get rid of this save reload Ron. And lets should make it disappear. So that's how I use the Lalit. That's pretty straightforward and easy because you're just getting rid of the key is you don't have to worry about the values. So next we're going to do a working session. One of the little fun things I went into all I was working on the script. 26. 07 05 Registry Working Session (Running as Admin): Okay, so in this working session, I want to demonstrate something I was trying to do somewhat to what I did in the any reader, right, was I was trying to run this and then automate coming down here to the Registry Editor and hitting F5. And so this, this will write the key here, but let's say, so when activate, What is that? It looks like it's gotta read tourist editor. And now I might even just save this, run it to see if it activated. Which was actually kinda hard. I didn't have my hockey. So there we go. I just saw this window get activated. So it's activating the window. Great. Okay. Now we'll do like a send five because this is one of those special keys. So and then we would want to win, activate a studio. Maybe throw in a sleep here, 60. And do that again here. So it's going to activate that one. Go to it, send F5 is received given the Tennessee B and come back to studio. So theoretically because now we have that here. Let me manually do it. Alright, see you, this is what I want to show, but I don't want to have to come down here and click it. Leave it. So it's gone now. So I'm going to reload this and when I run it, I saw it activate it but it didn't update. Right. And I'm like OK, so maybe I need to change it to. I tried a couple different settings around the send send events and this NAB in finally, I remembered this was just from years of experience using a computer. It was that the registry is kind of a protected thing from Microsoft. So I thought, hey, you know what, maybe I need to launch this script as an admin instead of running it in the regular view II. And sure enough, when I go ahead and bring this, let me exit out of the script. Bring it down here. And if I right-click on this and say run as administrator, right, so it's in there. Now when I hit my hotkey. Bam, See how it got updated. It came here and allowed it to send that F5 key to it. So that will be kind of annoying if I always had to launch it right-click and launch it as administrator, so I don't wanna do that. So I actually have another This I had borrowed from the forum. And what we're gonna do is I'm going to have to explain some mouse here. And we exit out of it. Is because is, it's, it's relaunching the script. This one really, you really wanted in this script. So I brought in my single instance force, I got rid of my hotkeys. I'm kinda get all run to run it. But now, and notice the scripts not running. You know what, I still can't let me, let me put my browser. There's nothing wrong with having him. It just has to be in here. So browser forward is going to, I think that's the forward. I always get the two confused again, that's better known. The back is what I wanted for lunch method. So save this. Now I'm a legit. And notice the green edge down here, right? And actually if you notice it kinda blink there. What happened was when I first launched it detected. It came here and says, hey, if this is not, this is a short further keyword naught. If this is not running and this is a built-in variable, not a hotkey is admin. Then go back and run it as an admin and you have to be using a newer version of our hockey for this, but also it exits out of the the other one I believe. So. Let me get rid of this. So now if I save, reload and when I run this script, notice it updated the window down below. And that was because now I've put this at the top of my script to say, hey, when you first launch this script, if it's not running as an administrator, run it as administrator. So that allowed me to send that F5 key to. Here. It's just one of those things, the overall rejects, sorry to read, read, write, and read, read. It's pretty simple, but you have to realize that this registry editor is higher level condom and admin tool that Windows has. And this is where it just comes into practice of playing with things. And when you slowing down what you're doing, troubleshooting. What I end up doing, what, you know, as I did with HIS, showed that you were activating the script, but make sure that that parts right, because if I was sending F50 different screen, that wouldn't have worked right. So I made sure I was on this thing. But yeah, it's this is a nice little piece of code to have handy. I'll put it in. I'll see that it's actually this isn't the working session, so it's be available to you. So I hope that helps. You know, at some point you might get stuck on something like this and it gets pretty frustrating when everything else works great and this one program doesn't work and you know, you're sending exactly the way even I looked in the auto hockey forum and I saw a lot of these where they were sending it this way. So I some people tried to send input. I think it was or they changed it, something else. I tried that it didn't work in this broken down, you know, what, I am curious as let's get rid of these sleeps. You know, it it it probably will work a lot of the time. I just don't know if it work all the time. And I like having stuff that's consistent. Oh, I don't have my reload P, so I gotta hit reload it here. So I'm going to put my hockey. There goes bam. So I didn't need the sleeps. Again, that may or may not work all the time. Things change a little bit. Oh, that's interesting this wise at LinkedIn, I guess, I guess that was interesting because it did it so fast. It made it feel like it changed the backend, which I'll let me know that there was a change and I should look at it because I wasn't I was off of it so fast. So hope that helps you guys work through this stuff. Church. 27. 08 01 Controls What are Controls: This next section here we're going to work, aren't collecting and using controls. And so the first question, of course is what is control by? I was Googling stuff. This first example is overall, it's a pretty good definition. A control as a child window that an application uses in conjunction with another window to enable user interaction. Okay, wow, that's very concise and to the point, it's still little, kinda like fluffy to me. So hey, let's do it a little simpler here. A control is a window inside another window. That to me. Oh, okay. It just a window inside on the window. Now, I would add to that, that controls often provide ways that users can type text, choose options, and initiate actions. So wire controls important, well, it's because how we interface with a given program, right? So it's going to be amazing to be able to. These are things if you want to automate something you wanna connect to, right? You don't want to connect to something that people aren't using. It isn't usually not too helpful. These are the things that people are using and clicking and that's what we want it they'll do. So auto hockey has some built-in stuff to connect two controls. And we're going to start hammering through him in a bit. We're going to cover some other stuff before we get into programming. But I wanted to first explain what neural controls are. And next we're going to go into why we would want to control them. 28. 08 02 Advantages and Disadvantages of using Controls: In this lesson, we're going to discuss why you would want to work with controls. What are the advantages and disadvantages? So one of the big advantages of working with controls is that the control on the window you're connecting to. It can either be in the background or doesn't have to be active, right? So this is great if you're working in a given program and you have your script running, it can interact with that other program without that program being activated, which is really helpful because you can keep working on what you're doing. In fact, the next one here is it doesn't even have to be visible, right? So the fact that it can be just hidden, right, in this, not even on the screen. The o shown is, is really helpful. It doesn't have to interrupt a human actions, right? So if I'm using my mouse or keyboard and I'm doing stuff, it can be doing things to that window, that GUI without taking away the focus of what I'm doing, which is really helpful. That also really helps reliability and consistency, which gets into the next one is one of the reasons why it's often much more reliable than sending keystrokes, right? It's very consistent. Often once you get it nailed down, it can be very, very consistent. And it can be super fast so you can interact with the things much faster jump speaking, then he Qin was sending a mouse click or moving in sending text because you're programmatically setting the value instead of sending keystrokes. And some of the disadvantages are, it is definitely more advanced than just setting a keystroke and sending click with a mouse click here or sending, sending the words with sudden said players and then put or anything. It can be a little troublesome to set up the can be problematic. Some controls. The even though you can identify them and use them, they're, they're not as reliable as you would think they should be. It just it's one of those you just have to work with it and see. Usually they're fine, but often, frequently, maybe I'll say you can come into where you're like, You know what, this is a little buggy, so I'm just going to revert back to finding it and sending keystrokes right mouse click. The one of the big disadvantages is that many newer Gillies don't have the types of controls that at least built away with the control function commands and not a hotkey that you can connect to. And there are other approaches were more advanced stuff, so we're not going to cover in this course. But there are other ways you can programmatically interact with those windows. However, like the new ribbon, like you see, I have a hidden here, but this ribbon window up here. Most of the duties and there don't have controls. I think the edit like one like this would, but most of the other ones don't have. You can't use the control stuff. There's other ways to connect to him. But a lot of the door when Windows and gurus don't have controls built into them. Now, the good news is, often, you know, we're automating programs that are older, right? They're not the cutting edge stuff. They still have. This is a great approach for if you're working with an older program to start working with it. Alright. 29. 08 03 Additional Resources with Controls: In this lecture, I wanted to give you some extra resources around working with controls. Of course, we're going to get into the programmatic side of how controls work and interact with them. But I wanted to give you some of the resources that I read up on, on how to explain controls, what they are and the ins and outs of I'm just in case you wanted to dive deeper on the topic. So controls are also called a known as GUI widgets. If you look at Wikipedia here and I'll show you that wins controls are often referred to as at. This article, has a lot of good information about it. This window controls is a great link, right, to Microsoft. Again, we're with auto hockey. We're connecting to micro. More often than not, Microsoft's built-in controls. Are there programs controls, but when other programs have, let's say, Firefox or if that's actually a bad example, Adobe something has created a program that has a control, a Windows controlling that you're clicking. Often. That's an actual Windows Control that you're interacting with, right? From Microsoft. So they, that's the whole power of windows, right? Is that they, they opened up some of their source code and allow other people to utilize their technology. So not everyone's creating all of these, do new different types of stuff. Otherwise, automated things would be a nightmare. The windows classes now, we're gonna get into this in a bit here, but classes are also very important in understanding what they are. So I wanted to include a link here about classes. And so you have the further there, but we're gonna go into deeper here in a bit. What is a window control? So the next to all those last three were from Microsoft. The next two, what does a window control and help with understanding class and n alternatives. Those are both on the auto hockey forum and both of those, we're good sources where I learned more specific to auto hotkey, like helping understand what they are and how to use them and why they matter. The last one I wanted to give here is my own self plug for. I do have several videos connecting two programs with controls. These are all for you there on YouTube, but the link here is off to my page or so you can get the list of them. And that's why I also have so other software programs for working within which we're going to cover here in a bit. Tears. 30. 08 04 Path for connecting to a Control: Okay, and lastly, I wanted to just try to explain this slowly. And I'm not an Obama talk slow. But to get to fully grasp is using a class is one way you can connect to a control. There's a couple different ways you can do it because controls have these HW and d slash IDs as well. And there's other ways that you can try to connect to control. We're going to mainly cover the classes using classes and more importantly, the parent class. But let me get into this here. The class and M, That is the instance leave version, the instance meaning on a given window, a GUI, you might have several buttons in the class, and m, N is going to be the number of that button, right? And that's how you're gonna identify uniquely that button compared to all the other buttons, right? That's the one. But what you really want to do is to tie together the parent class, right? The class that it's under. So remember how we talked about controls or a window within the window. So what's great is you can use the parent class to say, hey, go get this class, and inside this class, click this button in. Often that's going to be a unique identifying mark. So then when you're clicking that button, you know exactly what you are. If you end up having multiple of those you can use like the wind title or some other thing like the version of the programmers have been to narrow it down even further, right? But we're going to go really deep into this class and, and, and using the parent class in this next video here, we're going to start showing you different tools. And hopefully a lot of stuff is gonna start to make sense. It's, I had a really hard time learning the stuff in the beginning and I'm gonna go explain why with how the auto hockey and nomenclature and how they labeled stuff. I took a slightly different approach and a tool I made. So I hope it helps you guys understand little bit better. I hope that helps tours. 31. 08 05 Tools for working with Controls: So in this lesson, we're going to cover three tools that you can use for working with controls. There's lot of other tools out there. And there's some even not auto hockey, they can still use. These three are the ones I just wanted to focus on in specifically, we're gonna go into the deep dive, into the simple SPY, which is the one that may strengthen I wrote, To make it easier for people to work with controls. So let's let's go ahead and in healthfully and others to the witness by the wind spy tool, you can, if any rote running program, you can right-click on it and say windows by, and that'll pull it up. So that's an easy way to do that. You can also go into your program files where it's installed. And I'll show you in a second here how I can also trigger it. I made a hotkey for mine when spy is a tool from alchemist, I'm not sure how to pronounce that, but there's a link here to the forum where you can get that tool. And then simple spy is what I wrote with my story with you. And let's go ahead and launch them now. And them I'm going to show you here just because it's fun, right? So I have a little program here. This is actually in my manuscript and I want to break it out. So if I hit my apps key, which is for me, it's the key over to the right of the spacebar. It's between the right and right to control. You may or may not have that key, but I do so I leveraged a lot because it's another modifier key. And when I say when I hit apps S, it's going to run these three programs. So apps.'s, they're at launched all three for me right now, I don't normally do this cuz I just want one tool might tool, and I'll give it inherit a segment y i, y i prefer it in its up to you which one you want to use. But I'm going to dive deep into this tool. But I wanted right now show some of the similarities. So let's, let's start Notepad to give an idea of how the tools are similar. And of course he's all stay on top. But let's, let's do that. Let's do the replace box. Okay, so the built-in Windows spy tool, and there's nothing wrong with it overall. But it looked when we mouse over here, we get a couple of things I want to highlight. There's the HK class now it doesn't tell you this straightaway, but this is the parent window, this pound 32770, and that's a Windows Control and edit control, I think. So that, But that's the class. Remember the class, the parent, and then we have the parent class and then the instance, the nn version, right, the instance of it. This is the parent one. Now let's go ahead and do this with simple spy. So this one we drag over and we put it where we want it. So here we have that same class, so you'd right here. So it's there. Then with wins by, we're going to drag this on here. Again. Here is the class is right here, right? So that's very clear. Again, when spy to me a little bit better than the windows by because this you need to kinda look around for your stuff. And here's a little closer together, minds even more concise of here's the class, very specific. But let's work on the next one, right, that class n, n, right? And let's just look at each of these windows here. So mine because I, to me, I think MIT is, you know what? Let's start at the other ones. So the windows by when we were here. Notice down below it says class NN. I'm looking down here. So class NN, edit one, this should always ended a number because that is the instance of that class. Okay, so I'm going to slow down a little because I know this is the part where you're like, okay, I get it, but it just takes a little bit of time. Let's Let's do this again. Well, actually it's, it's still right here because I dragged it. They're the class and N for this one is edit one and shown you right here, right straight away what that is, so that it's easy to find here. So again, this is nice. However in mine, look how it says control sources control at, at one. Now, I know this is the class NN. However, when you start using this on your auto hotkey code, you're gonna need to put in the class and m. But when the tools I was always looking for. I'm like, Oh, control click and then what's the thing I'm clicking? I'm like I have to remember a subclass NN and then go find that. And just, I'm like, you know what, why don't I just label this called control. So I'm critical at line. Don't get me wrong. It's not something you want to start explaining to people why I collect that control? No, you're connecting to the class on n. I labeled it this just to simplify things. So use which one you like. I would think between these two. What I like about my tool over this tool is this one has a lot of other stuff and it's great and interesting. But you know, when you're starting to learn something and you want to do one given thing, the extra stuff can really get in the way of you understanding what you're doing and get lost. So I didn't want to mess with that. Now what I would like to show is on both both of these tools, not in this one is a seal. It says Bear here. What if I say, well, wow, and setText. Hey, look it updated that now I know I'm working on this one, right. That's as I think it's a nice thing here, it didn't update, right? We'd have to drag this back to it because it's a static thing. It goes and gets it now it pulled it. And now we can say, wow, cool and set it and look that I can't smell. But anyway, it updated this, right? So both of these tools do that just to make sure you know what, before I write a program for this, I'm going to use this and see if I can actually affect the window that I think I'm doing, that GUI interface. And so that's what, that's four, right? So I do like that feature in both of these. And let's stop there and I'll do a little bit deeper dive into my tool. But some of that functionality is going to be in this one as well. Again, it's, it's up to which one you like more, right? I'm happy if you use another tool or some other tool entire Lily, right? We're going to, in my videos, we're gonna use this just because this is to me the most concise and to the point query. 32. 08 06 SimpleSpy Find and Tree View: Okay, lastly, before we start doing some real programming, I wanted to dive a little bit deeper into the stuff available here. So let's get back into our work on this simple spy tool. So I just showed, you know, we drag it to the window you want or what button, you know, say if we pull something else up, we can drag it in here. You can see what's available, clicking on them, right outlining it. So let's do this. That one. There we go. What I wanted to demonstrate is look, there's also a couple of their buttons here. This tree function. It will show you a higher wheel type tree of where things are and when you click it, it will update. So if you can't exactly click on what you want, a good way is to hit those tree button and then get there, see if you can get there from using this, right? Because again, he yelled this all updates for you as you do it. So that's nice. The other one is, let's say you weren't quite sure, um, and you want to do a find. And so here I typed in edit earlier, but I'm, its, its whenever I say, I don't know font. So this goes across all running programs in. We'll show you where that class or the text, sorry, the text is the class name, let's say edit. So it's looking at across the different programs, right? And it can help you understand this is why you see how that's auto hotkey notepad. When word on a hockey Excel. I didn't know how to excel open anyway. But it just shows you that, hey, this class is in a lot of things and that's why you want to have sometimes even the program ID, then the class name, the parent class name, and then that's specific Even version of what you're doing. So these are ways you can narrow down your search and find what you're looking for. Again, built into the tool. This. And I think overall it's pretty easy to use. And that's why we designed it for years. Alright, Cheers. 33. 08 08 00 Over 40 commands around Controls in AutoHotkey: So before we get started programming and I just wanted to quickly show what we're gonna be covering in it, in what we're not. There's over 40 comedians without a hotkey on doings activities with controls. We can see this list here. I've structured them in a way that I hope helps to make sense. And we're gonna be working through this list. These two, the style and extend the style of a control. Those are pretty advanced, so I'm not going to actually cover the programming of him, but I have them in this document which you'll have. So you have the reference and the hyperlinks. This is really just the hyperlinks and everything is pulled from Ottawa keys documentation. So it's there's nothing. I bolded some stuff and maybe changed a couple of words here and there. But overall, it's, it's pretty solid as far as explaining what the command does. We're going to, I think it's just makes sense to break each one into a separate video so we haven't focused or then you can laser hone in on. If you get a question around something, you can jump to it easily, you know right where it is. So let's go ahead and get started with control texts. Thanks. 34. 08 08 01 ControlGetText: Alright, let's go ahead and get started on using control getText. So we're going to let you know what I like using the edit will do replace. It has lot of controls. It's just fun to play with. So control. Yet, texts. What are we gonna store it in? Very, I'm very creative in what control. Okay, so we need our simple spy tool. So I'm just gonna watch it here. And what do we want to get? Let's get this, get this text here for that controls. So that one is button too. Even though you wouldn't think that's a button and apparently that's a button. And again, this is Mine says control and that's why this is again in here. See how it says control. If it's a class on him, I would have left at the other way. But the fact that it says control here, I like to put I named this thing control for that reason, right? So, okay, when title, I can see it's replace, replace here. Let's go ahead and use the title. And I'm gonna save this and run it and I'm going to, oh, you know what? I didn't need a message box. That's just var. So you've run not hit my hotkey. And here we go. Here is the text that is in the control, right? And also see the ampersand CSE. That's because if we actually came in here and hit on all key, you'd see that's an accelerator key are kinda like a hotkey, right? But that's what, that's how you build things with accelerator keys. You should put the ampersand in front of it and it will treat it as an accelerator key. So that was the actual code there, the text that was there. Let's instead of using the title, we can also use this class. Now, again, if you had that title, replace for enzyme, notepad is not going to change. This class is the parent window. So this is another way to save it and run it. In other way, you can pull the same information, you can connect to it, right? So what you wanna do is put your thinking cap on and say, well, how many other classes are there that are gonna be available versus how many other window titles I might have the word find. And let's see if we can, you know, I'm not sure if we can put find comma. I don't think that'll but maybe no. No. So apparently it's one or the other. Actually, I just realized I had typed find. When we type replace here. Replace is the correct title, relaunch it and run it, it pulls it. So notice here I have both the title of the document and the class. Now that to me, I'm locked in, right? That's a really good way to do that now granted, there's another instance in notepad is I'm going to have the same problem, but chances are if someone else using that same class in the same title are very low. I could also probably thrown this HK notepad EXE, which would limit it from other note pads, but it's still going to be tied to Notepad anyway. So that is how you can get the tax. Let's get a different one. Let's get this edit field. So again, I'm on drag this in here. None of that changes its edit. One is the only thing that changes, right? So that one run and look bear, that's the text of it. How about this Find Next button? That's button for apparently button four. And that gives us the text for that I've granted. For you don't often want to find the text of a button. You might want to use that as some logic to say, hey, I'm on the right spot or not, you know, make sure that that button for is this text and if so, then click it. But for now, I mean this, this is great for an edit field, right? Let's also, lets revert back. Let's, let's get the overall this one. So untitled Notepad and will go, well, yeah, let's just use Notepad class. I'm going to leave that one. So we have it as in our example. And that one is at, at 11. So even run and they're bam, we got all of that text in that control window, which was edit one. But again, this is why I call these controls because in here it's going to ask you for the control and that's where I start looking for it. And you have to know you put in the instance of that class. So let's move on to the next one. 35. 08 08 02 ControlSetText: All right, our second one is working with controls is control set texts. So let's go ahead and start working on control set text. What control do you want? Let's, let's set this replace with the actual edit fill here, which is probably going to be Edit T2 is my gas. Yeah. So the control is two. The new text, you know, honestly, I'm not sure if we put in, it's a command. So I'm gonna think now, hello world. If it wasn't a command, I would've put, wrapped it in quotes. And we'll just see which way is right and then we'll go with it and create loops to come. Sorry. So when title that's replace or that HK class or pound 32770, I mistake with this because it's easier to type and run it in Alberta. Hit my hotkey. And bam, there we go. We filter them, right? That's pretty slick. This is one of the things you'll start getting excited about, right? I can, wow, I can programmatically, and I'm not clicking somewhere in hope and I hit there. And then sending some texts and keystrokes. I have programmatically set that which are very fast and often accurate. Now let's, let's do something that you wouldn't possibly think you could do with. I'm let's see if this match case was button too. You know, sleeve that one. Comment. Button. Button to. Let's try this and still the replace window. So I'm going to rerun this and launch it. Now look at that. Now, think about this, right? We have replaced the text in this control. So if you were building a custom program or you had a program, he didn't like it in the words didn't make sense. You could programmatically change how it looks, right? You're not changing the functionality, right? We're not doing that. But this is, I think a very cool. Then suddenly go holy moly, right? We can do some amazing staff with controls. You can interact with programed in ways you would never suspect with auto hotkey simply looking at that's one line and its damage there, so okay. Sorry if my excitement gets a bit too much a marriage is in this is awesome. Let's move onto the next one. 36. 08 08 03 ControlSend: All right, for our next one, we're gonna work with control, send, control, send, send simulated keystroke. So we're literally sending keystrokes through a window. Let's go ahead and send stuff into that second edit field. So couldn't send edit two keys. Let's say fine, we'll, mice won't go with replace if we're sending with fine. I'm sorry, we're fine. We're going to send replace. And again, let's use the age K class, LB 327703 to 770. This one I do overall, i feel this isn't a more reliable way to do this. So let's go ahead and save it, run and hit our hotkey. And there we go. It throws and replace. Now what do you think's going to happen if I run the script again? Remember we're sending, we're using control send in this, it's sending simulated keystrokes, right? So I'm going to hit it again and look, it added to it, it appended to it. Why is that? Well, because this already had it. We just it just says basically focus here and send the keystrokes. It's not saying select all. If the default when you drop it in here was a Select All I think it would have replaced it. Because when you click in here, that's not the default behavior, right? It's just kinda says, hey, get the focus and then send it. And so it does it there. If I'm, notice this match case here, let's say we wanted to select that. One way you could do it. This isn't necessarily the best way, right? But let's get that's the button too. So we're gonna go with, you know what, Leslie, this comment it out button to say I'm replace window. And what are we going to actually, sorry, we're not going to send that. We're going to send a c. Why is that? Well, I want to simulate the sending and hitting the C key on this control. And so I'm going to relaunch it down when I have a hotkey. Look at that, it toggled. It's toggling that control every time I hit my hotkey, right? So this is one way you could be able to send events to that control. There are other ways to click a button, but this is one way also it has an accelerator key. You could do it. Now let's get back to this. Above one. I'll comment about, you know what, let's work it, keep it in order for how we go. And if that's the case, let's put it down here so it matches the video. All right, what I wanted to do is so let's say we were sending replace. But let's say we wanted to say, wow, how cool with an exclamation point. I'm just going to manually delete this for now. My save this, reload it run on what do we think's going to happen? Look, incentive, but hey, where's the exclamation point? Right? So this is one of the problems you might run into where you want to have an exclamation point 0and. One way around this would be, I think I can wrap this with the curly braces, right? That's one way to deal with it or so. Again, let's go in here and delete that below the script. Run it. And now it kinda mess it up a bit, right? Look how wow, cool one, they're all uppercase. This is weird, right? So hey, you know what, maybe my first got on this is that we're going, we're sending the keystrokes too far, too fast, so, so key delay. Let's change this to ten and press duration to ten and rerun it. There we go and look at that. It's hard to see, but that's an exclamation point, not on one. So just slowing it down and if you want to really make it longer, Let's go clear it. Come back up here later, hotkey. Now look at it slowly pushing those, sending those keystrokes, right? So this is a great functionality to be able to adjust how you're sending those keystrokes. Sometimes some controls just can't handle getting everything dumped to him so fast, especially when you're sending keystrokes, when you're cooking them and setting them as we did before, it's not as important, but the sending keystrokes, it's, you know, sometimes you want to slow it down a bit. 37. 08 08 04 ControlSendRaw: This lecture we're going to focus on the another approach to control Sandra. This is another way where you can send characters that are special and auto hotkeys. So those two controls, wrong. What control? Let's send it to the replace with one. That was what edit to. Edit to. Let's go ahead and drag it there just in case someone doesn't watch some of the other stuff. So here we go. There's edit to a, you know what, I'm going to be lazy here and copy this. Because what keys do we want to send? Let's say, what did I do? Hello, world exclamation. And the wind title, which we're going to use a class in this case. So I'm going to hit my feet. Oh, and look, we actually had the same hello world that the capitalisation things are a little funky. So again, we might want to sit queue delay. And ten, I'm just picking a random number here. Let's come into here. Delete all this, relaunch it and run it there. Now. That was maybe sending a little too slow. I could probably pick it up. But the point being, we didn't have to encapsulate this exclamation point. So this way we can send characters that auto hockey tries to interpret like the caret key would be the Control key or the pound key would be the windows key. We're not when we're sending keystrokes, you gotta be careful we're really mimicking what the keyboard does, right? So yeah, so if you're sending keystrokes, you might want to send raw if you have special keys that auto hot, you know, especially if it's inside of a program and then the texts that you're going to be sending changes. That's where you want to be very careful with what you're sending there. 38. 08 08 05 ControlGetPos: Okay, so let's see, returned to get a position of control. So we're going to use controlled get position. So let me start with position. And here the, that's asking you for variables to use for the X, the Y. So I'll say x, y. You could just use x and y. It doesn't matter, right? Width. I'm going to type width to be unoriginal and height. I actually, you know what? Let me change this. I am I do just that because in the message box, we'll put it in the other things that way they're not the same. So height, control, dragging, and here let's get the matter another sweetness Phyton button with those button for, I'm going to be lazy. Copy, Paste button for. And again I'm going to be lazy and copy this and paste it here. Now of course we're getting it, but we need to show it right? So let's do a message box. The percent sign at the beginning just says, hey tree, everything else here to the right as an expression. Otherwise I would double quote everything and this is just to me, it reads easier. So x is, and then we're gonna put the variable x. And then we're going to put a new line, y colon, and then the variable Y, and then double-quotes width. So this is where I, we're saying we're going to MIT that width colon w, o. Forgot my new line. Right there. I forgot. I forgot here, sorry for jumping around. But that would have ended up in the same line, right? So colon and spaces between that and so we'll just keep it consistent height. And that's it. That's what we got. So let's save this and run it. Now when I launch it, it shows me the x's to 69 and the y is 38 and the width is 75 and the height is 23. Right? So that's where this find the button is on this dewy, and that's an important part and that's why these numbers are so low. Let's, let's pick one right below it. What the Replace. So directly this, the x should be the same. And let's grab this. So we have it. And then the y is going to be, I think a higher number goes down, right? So let's change. Button, will confirm it here. Button five by five and we launch run. Now the x is the same 2X nine with a why? This one is 65, that's 38, right? The width, the height, the apparently are the same, which isn't a surprise. And we can just keep going down. So that's how you would get the width and height. Why would you want to do that? Well, some some things, some controls and whatever, even though you can get their location, if you send a control-click or you go to click it, it doesn't quite work well. So this is a programmatic way to didn't get where that is. You might want to offset it. So because you want to click in the middle of the button not on the edges, and send a click, either a mouse or control-click or emasculate now will be touched knows a little bit later on, but this is why you'd go and do that. 39. 08 08 06 ControlGetFocus: Alright, our next step is to work on control get focus. So coming across focus, what are we going to start distorting var here and the wind title. I'm going to have to make a hot string for this because I'm typing and so much. So next time we're through this, you'll probably see I have a hot string, foreign EM, class, pound, 3-2, 2770. Okay, now there's not a lot here because we're just getting the focus. We're not telling it which control, it's going to tell us which control. The message box percent bar. Now, notice right now, notepad not even highlighted, right? So when I run this, it comes back blank. If I highlight this replace window. Now my guess is gonna be at this button here. Button five. Of course, we need to look up what that is. And lo and behold, that is button five. If I was to come in here and hit tab, tab, tab, let's see if that button three, right? And I believe that should be button three, right? So it's getting the focus. That's pretty straightforward, right? Again, why would you want to know that? Well, you might want to detect where you are. You could then Tab one or over. We're going to demonstrate that later. You could just make sure you know which one you're on so you can store it to interact with it later or save a preference on the where it was when you are working with the script to your staff and then set it back to where it was so you don't interfere. It don't confuse anybody. But this is the control good focus. 40. 08 08 07 ControlFocus: Okay, now, who wants to guess what control focus does? I'm thinking you didn't guess. Country. It's one of the things I love about auto hotkey, right? The, the descriptions of what you're doing are often, you know what they're doing. So control, focus, what control? Let's do. We almost just do edit one for now. One, the wind tidal, here's where I put it on a hot stream. So notepad controlling and PC. There we go. Popped it in there. I'm using it so much, right? Why do I type this over and over, right? Why don't we make you to wait for me to type it correctly. So control focus. I'm an that's it. I'm going to run it. And when I hit the hotkey, notice that highlighted, even kinda focused in highlighted everything. If I change this to edit to hopefully it'll do exactly the same. I'm, and let's see what what was button four or five and they always appear button for, let's change. Yeah, let's just keep it a little fun too. But for now, notice that's highlighted, right, so here's how you can tell it. Where do you want to focus more? Do you want the program to be focused after running it? Again, this might be, you might want to send the return key or something or the Enter key. It just depends. If you can. Again, I DO hotkey. That's a problem. People want to learn that, oh, how do I do this? There's so many different ways to do a given thing, and it just depends on the program you're connecting to that you might find these little issues that just they behave differently. And so you need to have a lot of tools in your pocket. You don't have to memorize them, just know there's different approaches and then you try your first go-to if that doesn't work, hey, what do I do next? Well, I could, you know, this is where you gotta use your brain to thinking about, well, I could try to send a mouse click to it or I could try to move the mouse over there. I could try to send a return key. I could try to actually just control click it. And there's lots of approaches. So this is the control focus example, chairs. 41. 08 08 08 1 ControlGet List: Okay, for the next lectures, we're going to be using this control get for a bit here. Here are some of the first ones that are very similar, so I'm just kind of grouping them together in the title, we're gonna do two videos separate just to make sure it's easy to follow. But I'm we're gonna see if an if control is checked or not. So let's go ahead and start off with control. All good. We need to output VAR, shoulders call var. The command was checked. I checked the value. In this case the value is blank because it doesn't actually have that parameter for this command. Control is if we're gonna get this match case because that's the checkbox kinda thing, right? That's button to be lazy with copy and paste that. But to him again and the wind tidal, so notepad. So then we go and now make sure, of course, don't forget to display what you got. So I'm gonna save this, run it now if it's checked, it should come back with a one. I believe in if it's not checked, it comes back with a 0. So that's a 0. Let's come in here and check it. Announcer tracked. Meaning, I'm sorry, when we turn to one on track to 0, right? So that's how we are getting whether this is checked or not. And so if you want to be able to detect if a certain value is softer, not this is how you go out and do that. 42. 08 08 08 2 ControlGet Selected: Alright, our next dive into using control get, we're gonna get the selected text. So let's do control Kip. Far. So did the value again, this is going to be blank. It just doesn't require it. Control is going to be we'll just make sure we confirm this. Is this one which is edit one. Can we copy that? Paste it there? Copy this paste. Okay, so then let's not forget our message box. All right, and then we save that. Now. Right now, look, look what selected pretty. There's a space in there, but it doesn't really matter. And we're going to launch our script and run it. And look. He pulls back pretty isn't that amazing? You can highlight that piece of text and run it. And it grabs what is highlighted. And you know, that's pretty awesome if this was closed and we were in this bigger one and this is still, I think edit one for the bigger one. Again, it works with even the bigger one. Oh, I didn't do my parent class. Here we go. Well, that and run it. And now we have texts reloaded. This highlights more stuff. And there's grab and all that. And I think that's a pretty awesome functionality to be able to have. You can connect to a given program and find out exactly what selected blossomed even replace if you wanted to. But this is just that. Getting the selected text. 43. 08 08 08 3 ControlGet Line: Alright, this next session, and we're going to, we're going to pull the line of texts. So what texts on a given line? So I'm up here, I'm just reading this, retrieves the text of this specify the line number in edit control. So I'm going to borrow from observes one. I'll keep retyping this Pramod glycine is our command, the value. So that's what row or line we want to get. Let's say we want to get the second line, which would be this, the control, that is the edit. We don't, I'm going to double-check this because it's just easier to mess it up at one. Is the control. Controls. Launch it and run it. Oh, when I do, what's established, there's the controls in the right spot minds, right spot the value, the command. Oh, look at that. I, now I grab, maybe I grabbed the wrong through. This was the class. Again, I could delete this my little goof up here. But I find, you know, you guys need to learn how to troubleshoot when things don't go wrong, what do you do? Start questioning your assumption tripe. If I fixed my problem, There we go. I fixed my problem, right? I could edit that out and make myself look much smarter than I am. But real-world Is everyone you've sat down, it's just better to have some examples of how to troubleshoot. So there's the fourth line, the sum. So the fifth one would be text. Right? So it's a great easy way. Not only can you get all the text if you wanted a specific line, you can say just give me that line. So to happen a ripping and all of them parsing it. 44. 08 08 08 5 LineCount: Alright, now we're gonna get the line count, so there's a total number of lines in that control. Again, and I'm still working with the same ad at one a notepad. I'm borrowing a lot from before. The command is gonna be lined count, line, count. Again, I'm not going to pass it any parameters because we're kinda pulling from it. The control is that one. And my title is I'll just type class notepad. Save this, run it. And looking at pulls back eight. Let's see columns. It's actually Notepad even tells you here there's eight. If I get rid of this. Now it looks, oh sorry, that's not the columns. That was a position where you are. But now we should have seven. So if I rerun the script, seven, get rid us. Something interesting. Who wants to go to something interesting? And Howard, I'm sex. So we're pulling the line count. This one. I'm not sure how often you use it, but sometimes you want to use it to be able to determine the future. We're going to loop over something that you don't know how many times that'll give you that counter, how many times you're gonna loop. But that's getting the line count with the control gate command. 45. 08 08 08 6 01 List ComboBox: Alright, now we're gonna work on control. Get, getting a list of items. Now, this is a little more complex, so I want to spend a few more minutes on it. We're going to start off with getting it from a combo box. The list works on ListView, list box, comma box, and a drop-down list. You'll notice I made a note here the, the, the below these commands only work for ListView. So we're going to start off with a combo box just because it's simpler. And I also want to point out a little catch that I'm, If you're not using my simple spy tool that you need to be aware of. It's really critical. I spent hours, hours trying to figure this out. It's very weird anyway. So let's go in here. We got control good, var. And I could try to put it in like selected or focused. I'm looking here. But this is a combo box. And let's confirm that by listening. Let's do these. That's a combo box. Control it, it, come on, try it again. There we go. Combo box one. So we're going to borrow that. I think that's our next parameter. Oh no, it's not the value. We'll leave that blank and there we go. Now control. That is our normal note pad class. There we go. Now, when I run this, what you're going to see is what's going to happen with most other things that aren't in this fuse. So my hotkey and unfortunately got a lot going on here, but this is a list of all of the fonts and things in that combo box. Unfortunately, you can't get the selected or focused in other things other than a ListView, but we're going to do lists or use it in a bit. But what I really, what I also want to point out here is let me, I have simple the wind spice that I had mentioned. That was also a cool tool. And this is a good tool. Now look at when I drag this in here. Note it says combo box, right? That's the combo box. Mine says combo box. If you use combo box, if so, if we throw a combo box in here and run it, it will not find anything. It does not connect to it. And and I spent a lot of time going. I just don't understand this, is it? Well, it turns out and I probably saved the, the link somewhere. I learned this, I think about a year ago, two years ago. So I wonder that these combo boxes, when they're drawn, they get drawn as the normal combo boxes. This one, this one is showing. But then they, I think it's when they have the edit things that adds a little thing in a tweaks it, and then makes it turns it into this. Well, in order to programmatically connect to it, you need to connect to the combo box, which also noted down here, I have it down here, my tree view, but it's not up here. Ie made a decision and I wasn't overly happy with it, but it avoids you'd have to use my tool. If it says combo l box instead a combo box, it just removes that out. In this way this works is I really want to make sure you guys were aware of it because my tool is kind of a masking that. Right. It doesn't tell you that. But I I spent I can't tell you how many hours trying to track down why in the world I couldn't get this death from this combo box. So that's the first one of getting a list with a combo box e. And the same thing where, you know what? Let's go ahead. Now I'm going to stop. It will do the drop-down and then we'll switch to a ListView. 46. 08 08 08 6 02 List DropDown: All right. The next one we're going to work with the I'm sorry, the drop-down list. So let's go ahead and finish working with our syntax up here. Again, we're still on list. The value, we're gonna leave that blank because unfortunately would list or is it only the values only work for the ListView and not the other stuff. And control, we need to get that. We're gonna get this. What does that? I forgot this call. It's like the encoding type thing if I remember correctly. And let's go ahead and borrow that. Oh, I forgot the control, my band. So here we go. Combo box number five. And then we go, so save this, launch, it hit my hotkey. And there we go. It is pulling up the values in that combo box. So again, this is not overly helpful. We can get that list of things which is nice. Sometimes you may wanna get what's available, right? And so you can get it then go parse it however you want. These are delineated with aligned newline feed, if I remember correctly, t0 and this one, unlike in the what was that one? The combo box, this drop-down one pulls correctly, that control is proper. I didn't make any adjustments to that 240 about that. Okay, now let's go ahead and move on to list views which are amazingly powerful. 47. 08 08 08 6 03 List ListView Selected and Column: Okay, now we're gonna work with control, get enlists views, list views are amazingly powerful. I'm, it's really cool how you can peek into them. Unfortunately, notepad didn't have the less fusing them. So I started that grep when, which was a great search tool. It'll search across files and folders and look for text found in a file. And you can, you can do search replace, you can do a lot of regular expressions, a lot of powerful things to free tool, check it out if you're not aware of it. In this example, this ListView, if we drop down here, I can see this is a ListView, it's a ceaseless 32, and then it's the first instance of it that's still like a class and then type thing, right? It's the instance of that ListView on this a program, or I should say control. So let's go ahead and work on getting the selected item. Let's select something here. Oh, and I already have that here. Selected. Control. That is the, you know, and I never trust my typing, right. It's just easier copy-paste. And oh, it's not Notepad. We need to get well, well, actually, you know, it is the same control. Interesting. Looks like that is the same control. So I'm going to run this and hit my hotkey. And here comes a lot of information, right? That is, let's go back to rep. And so control focus was selected. And to get that control focus. For control focus, was that what was here? Oh, button for let's see if that's where I was I reading it wrong. Patrol focus period. And then a four. Ok. That's the for the line. So this is all of it in one thing, which is maybe what you want. But for the rest of this video, maybe even the next one's on can list views. That's a lot of information. What's really cool? See this one column four down here, retrieves the fourth column. What's interesting is you just add, if you want to limit it to a given column, you would add in here column and let's say one. So we just get the, the first column and I'm going to relaunch this and run it. Now we just get that firstname, right, which was this one right here. I should have clicked because it was selected. If I change this to the first one and reload and hit that, I get the first one, right, so either those that we drop out, that column one, that'll return everything, you insert column one. I don't know if we can specify. I don't see it that so it looks like I just took the first one. Let's check that by changing this to a 221. It doesn't look like we can oh, that's attrition. Oh, because I didn't change how I did that. Now. So it looks like it just takes the first one. So your options are a good one column versus get all of the columns where that's fine. It would have been nice if we could have had a couple in there. But that's why it goes. So that's how you can get the ListView with a specific column or the entire column you have selected. And I think focus works the same way, but let's go ahead and do that one separately. So I just realized I didn't demonstrate one of the thing of women Lynn selected. You can have one file selected. Right. Or if I have multiple selected, it gets all of them, right, the ones that are selected. And so it's an important point to note because the next one we're doing is focused in the focus is just going to return one. So again, And even if I had like this one, that one and that one, it pulls back the ones that you have selected, right? So I think that's a really cool thing. If you were trying to monitor what someone was doing or see what was selected, are going to count a thing selected. It's a great easy way to do that. 48. 08 08 08 6 04 List ListView Focused: All right, we're going to continue on with the list views and we're gonna get the focused, so only the focused row, unlike this elected in the last video, we're going to just get one. And we'll experiment with exactly how it's determining that's oh, here we go up here. Value is o. I already have listed, sorry. Focused control is this. I'm not gonna try to type that. Copy and paste. And that is our class, which we can see right here. Right? So I'm going to assume that run it, hit my hotkey. Well, you know what? Let's, let's add back in the easy to know where we are. So column one. Alright, so that's saying, Well 807 control focus. If we highlight this, we'll see all of them are now. Wait a minute, it just returned one. How did decide that? I think if we just do that and of course we're just gonna get one Selective would have controlled get line as which is the one I was on. Yeah. No, me now select it and there's a good position. If we do that, let's see if we do two. Now. The second one was the last one I was on. I think it's going to if we go back the other way, it gets. So it's the last one. When you end up, if you have multiple selected, it'll just take the last one in that group that you had. So either you have one selected to get sad or however you come about. Let's, let's actually, let's, let's really confuse it. I'm going to turn off a bunch of this stuff. I would think it's still say focus now so that one got to get live. Interesting. So when I use the control to unselected that, it seems, well, I do see, you know what, see this rectangular border. And maybe that's what I should've been paying. Focus the eye wherever that that's the focused. There we go. Okay. So now that one actually is going to be that it gets selected, I think. Yeah. So it's whatever has that outline around it because it is it's a focus. Right? I just hadn't noticed that bracket the outline, but the time, that's how we go ahead and get the focused with a ListView. 49. 08 08 08 6 05 List ListView Count: So for this lecture we're still working list views. I think, well, let's go ahead and cover all the count stuff because they're all very similar in the code is very similar. So what's our command? And we got lists. So let's start off with count. The control is that sis list view which I never should have deleted. Here we go. There's our control. I'm going to run it. And this gives us, it's telling us there are 17 rows in this 14 files. But the files that are unfortunate, that files, there's multiple things in there. So let's let's make this a little shorter. Harrison discrete control send is what we're going to search for. Now there's 12345. We'll see if that comes back with a five. There we go. So there's five, right? So we're getting the number of rows in that, in that ListView. Alright, now the next one is count selected. So there's changes. You know what, let's duplicate it. Selected. I don't have anything selected, so it's 0. If I select something, there's one, deuce, three, there's three. So that's a great, easy thing to do. I love how these things work. Sorry, I get excited. Count focused. I don't understand. Can you have I don't know how that's ever going to be more than one. But let's go ahead and do it, right. You know what? Again, I want to leave this code so people haven't focused. But it run it. Carmen here. That's two hours, 234, count focused. That's interesting. Conflicts which gives a row number are positioned at the temperature, I'm sorry. That's why. Ok, it's the row number. Ok. That's a, that's a bad name. That's not account. But anyway, that's, that's how it works. Far out, count columns. So if you wanted to programmatically get an idea of the number of columns, you can, you can do that. Count. Call. And there's four columns. 1234, I don't think there's another one after that, know. So these are the ways you use count with a ListView and then we're done with its views here. 50. 08 08 08 6 06 Control Add and Delete to Lists: Alright, and this example, we're going to be adding and deleting to a, we're going to pick a combo box just because it's easy and there's a small one here. So let's first lock into that combo box, which is combo box three. I'm gonna grab that. And so I haven't my clipboard. So command, this is add the value of this one. We do have a value, right? Because we're going to add o, sorry, add, let's add auto hotkey. Now the control and then the class that we're connecting two, which is right here, but I just having tau naught string. So I'm gonna save this and run it. Now when I hit my hotkey, Oh, I did something wrong. What I did wrong? Say. Alright, let's double-check. When I double check each of these tanks, others. That's the command is add, yeah, that's my values. The text combo box, three, fold folder feels he went Oh, come a box to I'm not sure how I did that, too. Let's see if that fixed it. There we go. Let's again, I could edit all this out, but look, this is how you troubleshoot, right? You gotta learn how to figure out what's going on. So we just added that value. Now, don't get too excited because this doesn't sound and say, hey, look, I have a font-style upon auto hotkey. Okay, let me hit. Okay, is he had selected, is there it's in that but Notepad, the program itself is built in. So when I select it, it says, hey, you know what, we don't we don't actually have something on there so you can't use that. So let's go ahead and work on the delete, right? This should be pretty simple. Delete because we're just going to change. Everything else should stay the same. And we run it. And nothing's happening. Let's make sure that that is still the same comma Box2D. Maybe fat. No. So I was just noticing here a deletes a specified entry number in the list box. So we should go pull the entry number. I'm gonna guess that's the third one, unless it's a 0 based index. So I'm going to guess this will be through three. And relaunch it. There we go. Now we remember it now what's interesting is let's get rid of something else, et cetera. Then let's say we didn't want them to be able to select that right? I think that delete is much more powerful and add because if it's gone, they can't select it, which is great. You can force them to have one option if you want or, or specific options. But when you add stuff to it in this like inside Notepad and given program, it's gotta know how to handle that. So it's a lot more complicated, but the removing of the list and that's extremely powerful. Tiers. 51. 08 08 08 6 07 Choose from List: All right, our last two controls with working with a, a list or a comma box. We're going to, we're going to decide what to select in this combo box here. So we're going to first start off a choose. Choose takes a number up here saying the sets, this selection, this box comma Boston specified entry number. So we wanted the first thing. It is not 0-based index, so one is 12 to two, so three should be Arial. So let's go ahead and set it to three. Oops, three. What control is that? That's the bone box one. And this control save, I'm going to launch this. And I, when I hit my hockey, there it goes. Now it's selected area for us. So if we change this to looks like five Is Bond Esref whenever the wall that is well, maybe I'm just kinda hear has try six. There we go. So that's how I use the Choose commands. Again, that's the row. It's in there. So let's go ahead and do, let's comment this out and we're going to choose a string which is very similar. It's just you feed it the first couple enter. So let's start off with Arial because I know there's several, I'm gonna start off with that. Run it in my hotkey bam, there's area or what if I wanted the second one? I can't I can't put a comma two. I would just put aerospace round. I don't have to match it perfectly, right? It's just those letters. And whenever it makes it unique, right? That's what's gonna go to the first one of it. So there's aerial unique malice do the Bonn. And that's how you can programmatically set which one of these things you want to select. So this would be a great way to hit a button and have it set your defaults, right? If the program couldn't remember what you had in their careers. 52. 08 08 09 ControlClick: Alright, now we're moving on to control clicking or control clicking is one of the things I loved and sounds kinda crazy. But the fact that instead of sending a mouse click, you can send a control-click, which means it doesn't interfere with me moving my mouse around while you're running a program. On average, much more accurate if it, as long as you can get it to click the Control. So let's go ahead and do CTRL. Click. Oops. There we go. Control or position. Now this is a, it's an interesting point. We're not gonna do the example here, but if you had the position instead of the actual name of the control, you could activate it that way too. And I know working with mainstream every Watson while sometimes you gotta use that position of where the controls instead of the name of it. And I don't remember if there is an actual science to y, but just FYI, sometimes you might want to use that position. So you first go get the control position because you have the name of it, and then click that position when that can work as well. So that's, let's go ahead and get the control. Let's hit the replace here. We're going to replace this with auto hotkey. And here, when we do it, button five, Copy, Paste, overwrote my comma. There we go. So that's the, this class right here. And I'm going to launch it now when I hit my hotkey, it should hit this replace and theoretically we should see the updates right away. Let's see what happens. So it's interesting is that it looks like an activated it. Oh, it's doing what I'm doing to replace, not replace all. Okay, there we go. So it did them. So that's example of using control-click with the button. So we're clicking that button. Let's go ahead and do a second one here. So let's say the cancel it and close that window. Button seven. I'll just like to have these in here. Seven, climate that one out because it probably come up with an error and run it. And we close that window, right? So again now highly accurate way to send a mouse event. More without interfering. I could be moving my mouse while it's doing this. And so there's no conflicts. 53. 08 08 10 ControlMove: In this lecture we're going to work on control moves. So in this, this is the stuff to me that really starts to make you to realize how powerful auto hotkey is and what you're doing in it. So let's say we wanted to, for whatever reason we wanted to move this cancel button down or move it somewhere in the GUI. This is where you had Understand the coordinates of what they mean. I'm I don't do this a lot, so it's just to be trial and error. But let's start off. It's so appear control move. What does that control button is a button seven. Yeah, that's the cancel button. So seven. Now this is the x and y of how much you want it to move. So let's say we're going to drop it. Well, actually I think it's where it where it's going to be. So we're gonna say 150. That's the, you know, this way and y, let's do it. I don't know, 150 and we'll just see where it ends up. We can also, this is, we're not gonna do right now because I want to do it alphabet. You can adjust the width and height. Like how crazy is that? Let's leave that the wind title. That's the same one we've been working with a notepad, so I'm gonna save around and land legit. Look, we just moved that cancel button down to here, right? How wireless that now look at this. It doesn't, it doesn't stop the functionality. We just moved it within the GUI, right? I think that it's just amazing. And I mean, obviously not this, this usage or stupid. And of course when you restarted it goes back right, but, So let's see if we want to move it over to the right more. This should be no, se me, let's make it 250 thousand. Go off the screen. There we go. So we just moved it down there. And so you can see how interesting this is. If you have a dually you don't like, you could literally adjusts to the GUI in a different program. I find that fascinating. Now let's mess with the width and height of the thing. So let's leave that one. Width. Let's say it's, I don't know, 300. And a height will say 50. Reload that, run it. Wow, we made that a bit too big. So let's move this. I'm over at 0, one hundred fifty, three hundred, and let's make that 200 and run it. There we go. That's still really wide. 100. Yeah, so from that you can still sell. It's bigger than it was. Let's make it 150. And let's move this up a bit. So now we have this weird cancel button, but look, it's still works. And I think this is just, it's fascinating. So the control move does both move or resizes a given control. 54. 08 08 11 1 Control Check and Uncheck: As with controlled get, just control has a lot of options to it. So we're going to work through them. We're going to do in like impairs where they, where they make sense. So we have a control check and uncheck. So let's go ahead and start off with control. Sorry, command. It's kinda funny. I said that the overall, that's the autarky command, this is the subcommittee. And for this command, if that makes any sense, what do we wanna do? We wanna check? And this one, the value is going to be blank because we don't, we're not getting anything back or anything like that. The control. Let's do this match case which I think is did I Oh, that's right. When they're button to still says parent windows replaced. Sorry. Okay. So I missed made by Mr. Art. So it's Button to button two, comma. And there we go. So say launch it. Now when I hit my hotkey, bam, it just selected that control again programmatically and not moving the mouse and you're not trying to click a box. It's programmatically setting it, right. So let's go ahead and duplicate. Duplicate that common now for now, and we're going to change just to uncheck, which should be the command. Run it now. And I just run it again because it's all the same thing, right? We're just checking land trekking. If we want to do something really simple, let's put these both in here and let's put asleep. Let's say 2002, so slips for two seconds. And when it so this is going to check it and then wait two seconds and then uncheck it, right? If we really wanted to get a little fun and we could put in a loop here. Yeah, let's not even limited. And I think, I think with that client, I don't use this regular loop command that often. I just came up, you need to put the braces on the same line or not. So I'm going to launch that now out you know what? Let's, so we're, since we're looping, let's put this down to, let's say 800. So run. Oh, I know what I did. And this is where we need the second sleep. Otherwise, it just keeps doing that second one. I think I think it's just gone on. There we go. So hopefully understand you need to sleep after each time you do it. Otherwise, it keeps jumping back to the one that doesn't have this leap. So there we go. Now we're, we're checking that unchecking this one control. So it's, it's pretty straightforward and easy. Again, I liked the programmatic connecting to a given control over sending a mouse click or something like that. Tiers. 55. 08 08 11 1 Control Disable and Enable: Alright, this next lesson we're gonna talk about disabling and enabling controls. And this is another really powerful feature, right? What if your system admin and you have a certain thing in a program you don't want people to be able to do or they keep doing it. Messes something up. You can go and just disable that control, right? So let's go ahead and we're gonna start off with control. Let's start with Disable. Since everything on this one is enabled, value doesn't mean a thing we need to control. That's button too. For the match case, right? That's, I'm looking right here and we can see it lines up. So button two and well, I have my hand on the mouse that to connect to that particular one. Save this, launch it and hit my hockey. And now see how it's grayed out. Someone interact, I couldn't click that if I wanted to write R. Now if I shut this down and comeback to edit, find, replace, it's going to be enabled again. So this is something you have to monitor for, but that's how you disable. Let's duplicate this commented out. Change it to enable oh, you know what? I need to disable it again. Now. I can enable it. There we go. So again, just like the other one, let's, let's put this in a loop. What was tested in this one, I think on this type of loop, I need to have that first person. Oh, no, I don't. Okay. So it ran out but I needed I need some sleep, some hair, so sleep. 800 is a nice and I think the pace not that we would do this right, but we're just going to show how we can enable and disable that given control. I wouldn't put this in a loop. Obviously that'd be weird. But it is a nice way to just to demonstrate like you're actually turning on and off that feature for a given control in a window. So that's pretty awesome. 56. 08 08 11 1 Control Hide and Show: So another really powerful feature is the show and hide and control. So let's go ahead and start off with control. We're gonna start off with HIV, since everything that I'm aware of is visible here. The value that is not needed here, control is this button to we've been playing with button to the wind title. Is that one, save a launch him out key. And bam, it's not disabled, it's gone right as far as the person sees. And look, there's nothing there, right? There's nothing you feel like you're clicking or anything. So very, very powerful, right? That you could actually, in a given window, height it, or we're going to copy this. I believe the other one is a show. I could spell. Save her relaunch run. And there it is, ma'am, it's back. I'm not going to put this one in a loop, but you get the idea, right? It very simple to just hide and show a control. And, you know, if you wanted to stop someone from doing something, that's a great, easy way to do this. 57. 08 08 11 1 Control Show and Hide Dropdown: Alright, this next lecture on controls, we're going to demonstrate how you can force it to show or hide a drop-down list. This one, you know, I I don't think I would probably use this very often, but it's just good to know it's there, right? So let's go up here to our command control. Show. Dropped down. The osmosis is orchid memory Go value. We don't need to control. It says combo box one was Yeah, that's the window. So this this letter, right? This thing, this drop box. Yeah. Oh, would you click it, it expands it. And to me maybe it should be more like an experiment. So anyway, we're going to launch it now when I hit the hotkey, bam, expands it out, right? Not, not as a prize now that it's expanded will duplicate it. What does this first part hide, hide, relaunch. I'll skip that intelligence out of the way. When I run it. There it goes and hides it. And if we wanted, we could put it in a loop, but let's just do this. Let's put a sleep here of a second and run it so it's going to expand it. And then how you, So again, I think this is one if you wanted it at set to a default value of always being visible because I am, I get tired of clicking a verse and then selecting has one had I've expanded, there'll be a good option for that. 58. 08 08 11 1 Control TabLeft and TabRight: In this next example with controls, we're going to demonstrate how to tab left or right. It only works on this system tab control, 32 control. So I just gave a thought, Do I know? And when you create grilles and can in auto hockey, you have different tabs. In my head. I was like, oh, you know what, I've seen one of those. If you go to a control panel and I know you can't see this right now, but we'll bring up control panel, go to System. And then after system took advanced settings. So these tabs, this is what is kinda reminds me of the tabs you build an auto hockey goalie. And this is what? Well, let's confirm that, right. We can, whoops. Let's move this guy down level. Here we go. Let's bring it up to here. That's there. Are we on that one? Let's see. Is that the whole thing? That is assist tab control through 3-2. Again, the one is the instance, right? So it's this tab control 32s. So we got the right thing. Now let's go ahead and play with this so-called control. They all start with control and this is the command, the subcommittee. And for the tab, let's do a tab, a left tab on the left. When the value is not needed. I'm not going to bother to try to type this because I would fail miserably. And I'm not oh, look exactly the same class, so yeah, I think has used a lot, isn't it? Alright, so save this, launch it now and I have a hotkey. We should see it shift from advanced or hardware and let's see what happens. And nothing happens. I, I actually ran this a bit of a few months ago and it it's not a surprise at first I'm like, hey, it's not working. I tried to change my trade it right in the end. What he thinks the problem, well, the system property saying it's kinda. 59. 08 09 11 1 Control EditPaste: So this one we're going to work on the edit paste for the controls. So we're gonna say control comma edit paste. And the value that's going to be, I think the tax we want to put in there was do auto hotkey control. Let's, let's put it into this edit box. So let's edit one. At one. Comma 01. Looks like we lost the part of the class there. Oh, no, that is the parent. Oh, it's still just didn't get it all, so I'll just put that in there. Now. It says specifically in history at the carrot. The carrot is where this is. So wherever this is, it should paste that. So I'm gonna hit Run, Run. Now, I'm going to put my carrot here and I'm going to hit the hotkey and shoves it in there. If my cursor was up here, it puts it there, or if it's here, it puts it there. So it's a very simple way to use a control to paste in exactly where you want it, wherever that cursor is, instead of just vaguely to the control itself. 60. 08 10 1 Controls Working Session: All right, and now we just spent a lot of time covering Controls. Let's do a little working session though to just practice, right? Because things come up and it's just good to show how things don't work, right? Or what you can and can't do. So let's just start fooling around with some stuff. We've done a lot of stuff in notepad. Let's go, we'll start there. So let's say your file. Oh, that's funny. That's not what I thought it was that I hit search. It will do the replace. So let's say I wanted to populate that. Find what? This something else first, let's get it. So what does that control? Get texts. All right, we'll store that in the var. The control looks like that's edit 11. And here we go. So my save this, launch it. Oh, look, I'm glad I caught that message box bar. So say run. And of course our message boxes behind your area. Look a, it says it'll hockey what its prize. Great, that's not very helpful. So let's change, changes to set this one things when things are done right, it's very nice. So we're going to try to, to other hotkey is cool, which means we don't need the message box. You know what? Garnet. Let me duplicate this. I'm going to set this back so we all have a I can say your oxide, I live in Texas or ego. So let's go ahead. We're gonna go ahead and get it, and then we'll set it after, which I suppose the other order make a little more sense. But unless we control get var and that one, I think that works. And then we're going to change it to auto. Hotkey is cool. You know what? Let's get it again. There we go. So we're going to run this now when I hit my hotkey, it says I don't know hotkey. We're then it's going to programmatically go in, find what is going to change that text and then go pull it again. So look, oh wow, that was, there was so fast. This is why I like to do is practice session, right? Is I think what happened there was we set it and then we got it again so quickly. Oh, yeah. Yeah. Let's add a little sleep and hair. And it's just practice to far as knowing how much sleep and how to troubleshoot. Alright, and so we launched that. Ron, here's our auto hotkey. Still says, Oh, did I do at, at one, at one each ones either one. So for some reason, let's first this again, we're just troubleshooting, right? So we're going to set this. Yeah, that should really watch it run. It's still yet and we don't need this. Let's turn this off and this off on Years. Cool. Did I miss something here? Oh, look at that. I'm in the wrong. That's why. Yeah. And this is again, this is I could easily out of this out, right? And some people, I mentioned this a lot because some people rated me poorly on my reviews. They said I didn't think things through and I'm like, I'm trying to teach people. That things don't always go as putting them in how to troubleshoot. So anyway, alright, let's run this. And here's Mount auto hotkey. There. Now once auto hotkey is cool, great, it worked was we wanted let's go ahead and get rid of this sleep and see if it works without that problem with cool. To this first time to say I don't monkey out. Oh, OK. Because we just got it. That's right. I forgot and I have to put in here. There we go. Whoops, not save that. So rerun this script, hit the hotkey. Now it's auto hotkey. In auto hotkey is cool, so that is without any sleep. And let's do it without displaying the message box. So well that when doing any good. But you get the idea, right. So enough with this and you know what enough with Notepad, we played an append a lot. It's not that I think that everyone does things. Notepad is just to know Penn has a good example of a lot of the stuff. And let's pull up some other programs. I have this program, this tape program. It's like a calculator. The newer calculator in Windows doesn't have controls. And we can demonstrate that if you want. But the older one did this one is just a version I use because it has a lot of built-in stuff. But let me drag in here and say, let's say if we wanted to get that button, I'm not, there's no way I'm going to try to type this. So let's shift F1 when you're having a bunch of stuff, shift F1 will block comment. So we're going to block that. And then we're going to start a new line down here. This way he everything's in this file. And when I did, hoops had only than that control. Let's, let's set, let's set that text. So let's see if we can change the number two where it's for control certain texts, the control here we go. New texts, let's say four. And that is, let's use this one. So reload. And there we go. Look, there's two 4s in a row. That's wacky. What I don't know. Let's see if we can put in like high. Let's see we can put in more than one character. Whoops, I'm trying to write a here. I could just hit the setTime because that's what the tool do. But I'd rather do it up here. So we'll comment that out. So that the high, I'll switch my name will fit in there. Cool. Now, I would like just use your calculator. Hit that Joe button. Obviously for practical jokes as could be a lot of fun too. So we showed with that, let's see the options. Convert options this has, let's see, this is why I like the tools you can do all of these conversions. What I was curious about was if these are it's a tree view Interesting. I didn't see previews in the list. So let's take a look at troll. If I was going to guess, I'd say that's like the control get list. So let's just start off with, So I'll comment that out yet. And we're going to hit F1 here, bring up the help. I don't think preview as mentioned anywhere. No, its not. So that's my first step. The next step what I would do is copy this. And now I have a hot philo program I've written for this. I him out key. I put control debt. And let's put tree view. And this, what it's gonna do is it's going to use Google to search the auto hockey forums for me. So of course it load on the other page. Preview, reading, control, get lists, list. I look at that and maybe, maybe it works. Now we can go look at this. But control-click unless there are special functions. This page about trivia, but that's, that's the getting out. Okay. But that's that is with a maybe it walks up to two. Let's just go ahead. Instead of keeping reading this, let's go ahead and try control and get stored it in var. The command is going to be list. And let's just leave it at list. So that these days blink. The control is this. I'm not gonna try to type that. It's just too easy to make a mistake. That one I could have used the other one we put there we go. And of course we need a message box to show the results. So let's take a look and see if this gets anything. And it didn't bummer. Preview one. Yeah, I think that seems to be right. Let's make sure under List control, get come down to list, retrieves a list of items for ListView doesn't say trivia. So that doesn't surprise me, but I was hoping that we can get a list view or sorry, a trivial because it does say, Well, it says teak, tea tree view. So who knows if that's actually like a Microsoft thing? Let's take one more look here. Go back now and you know, I didn't, I didn't search for what's the TT trivial tree elements and trivial. I'm looking for that double TO Here we go. Is that same one? Yeah. Well, let's not worry about it. Looks like someone's maybe trying to DLL Paul. And that's not, you know, that's for the advanced class, but just so you have an idea, this is how I troubleshoot, right? Is I look in the help, look in the forum, that same query, which Did I leave it up now I killed it on, but let's hit my hotkey and say trivial. When it runs. And we bring the whole thing over it, it runs in a searches auto hotkey forum for what I type in, and I can see him here, but I also search StackOverflow, right? So for the same term. And so if I don't find it in the forum, I'll look in Stack Overflow, especially if I'm doing something with calm and Excel, we haven't covered that, but it's. It's something that's very similar to VBA. And so it's nice because I can find a lot of examples and BBA then adapt it. Alright, so let's, let's not worry about that with the preview. It's a bummer. Let's see if there's any open save tape here. This one, this should, if we cared to see this coming out of these dialogue boxes. So even, you know, there's a good point I could demonstrate here, but you don't have that program which has you have there probably are pretty slim Now in Excel. And this is not, I don't endorse this in any way as far as the right way to connect to Excel. However, if we say let's open, then browse this dialogue box, this one, and we can still come in here. And it is, look, it's a combo box. So let's put a path. Let me see here. I don't have an Excel file he and B, but it really won't matter for the demonstration purposes. So let's go ahead and copy that for now. Go back to our script. We'll comment these out, even though they didn't work. Set text controllers that will say the path is C and slash slash. So that's going to put that path into that edit. The file name dialog box here with any luck. And this is going to be a renewed RAM or enough, I get my hockey. It did not like it in perhaps. Let's double-check to make sure I did everything right. New text. When title, that should be fine. For some reason to me that the highlighting looks odd. You know, I'm going to I'm going to put something here. Now. Let's still didn't change it. I know that sort of works because I had done it before, just playing around. But the fact that that's a combo box, maybe I have to. Maybe I think I can probably click it. Let's see if we can click that combo box. Let's make sure that, that oh, that's interesting. Combo box one and that's stayed the same, I believe come up box1 and that and that Oh, oh, look at that. Did you see that it says it switched to edit one. That is interesting. So this outer one is a combo box. Maybe this inner one is the edit one, which is what I should have been writing. Which makes a lot more sentence, right? Because we write texts to edit. Edit boxes. Run. And still nothing. Let's go ahead and change this to this. This shouldn't matter, but again, we're just troubleshooting, right? This is how you go through, you know, I go through everything out now that there we go and I don't know what let me undo. So see how this text wasn't highlighted. And then suddenly when I shifted it to the HK class, now that just might be studio not recognizing it. But that really that's what up here in one of the other ones. I was like that just as Sutton looked funny and I couldn't put my finger on it. And yet when I changed this, and let's go back and say C colon slash, slash. Run it. Oh, interesting. Let's try this one more time with Fred. So this is where I mentioned sometimes controls can be a little intermittent as far as if they work or not. You would think it's programmatic and there's going to be spot on. And yet sometimes you're like This should be consistent. Why is this not always reflecting unless it's not a matter that should have updated. Um, I doubt this edit one could have changed, right? So there's still at, at one. And says Joe, let's see if we can turn to you here. So that's really interesting. So I didn't want to France. Oh, look at that. Look at what happened here. I messed up. This is, again, it's painful for me, right? Like you guys will think, hey, I don't know what I'm doing there. Again, it lost the syntax highlighting. Maybe that is just with studio. Very well, could be. So save, I'm gonna run it now and now it update it. Okay, so when I hit paste it up here, I had messed up the class name of the parent. Alright, so that's enough of that. I had, my main point was even in newer versions of Excel, which now let's close out of this. And let's show, I don't know if I can get that now see how it's highlighted. Some really weird stuff. If we just say nu. And we get to this ribbon. This ribbon, this is where I want to point out, was like it uses this other control that we just can't peek inside with this tool or any, any tool based on this control stuff. So unfortunately, we can't automate this. The good thing is like Excel has a calm backbone, which we can programmatically set stuff. I got a bunch of stuff on my site if you're interested, it's amazing what you can do students to me, very easy and useful. But what I've, my main point was even inside like if you go to that dialog box, you can still use controls for that, right? So even though a lot of programs have moved away from using controls, at the same time, they still might have some windows that are controls that you can manipulate. So controls are again, very, very powerful. Let's, let's, let's see what else. Control gate. Let's, let's check a box on something and see if we can check one of these studio boxes. And it looks like I killed my simplest by. So we're going to go up here. Click that only the, I think like, Oh, so there we go. Green button three. Alright, so let's kill that. Make that note just for people. And so we're going to do control. Check. So comma check, comma value. I think we set that to one note. It's blank because it's checked that I was taking us check is 01 for zeros not checked on one checked but it's so control is going to be button three. I think I can pipe that. Obviously not how ironic. And the wind title. I'm not going to bother. I'm gonna copy this. Put it here for the class. So let's run, get ready and run. And I don't understand why this got brought up. Somehow interesting. I really don't know. Oh, because this was an auto hotkey Gui. Also. Another great example of this is an auto hotkey Dewey, and this is an auto icky Gilly. And we'd be better off. Maybe we can have also in the title HK studio. Let's put this in here. Let's put it here and relaunch it and run. And there we go. So we just checked it and I'm going to add this one to just make it simple. Now here's a unchecked. We launch it now and I hit my hockey bam, there it goes. So again, this is what I did play this, but it's a great example of, hey, silly. There's another thing out there with the HK class GUI, which was this one. I'm not sure. We were saying button three, the check. I don't know. I guess that was one of the was this button. I don't recall. But you get it was activating the simple spy tool probably because it was a last activated pot pie possibly. But now you understand why hey, you know, maybe we want to have a little more. But I didn't put it in the whole file name because I don't want to tie it to be that file only work for that file name or maybe you do, right? So it's just another good example of troubleshooting a staff. So that was the checking and unchecking. What else? Good, let's see. Try to think up. Let's see em. You know what, this is probably, that's probably a tree view, maybe. O to symbolise feel great. That means we can get that list. So let's go ahead and let's even expanded. Let's go ahead and get us comment this guy out. And this was selecting three. Alright, so I'd just like to annotate. If you don't amputate years, people don't know what it is. So try to remember to annotate and control. Is that one? Control. Where's the list? I don't have my list handy right there. That's the control GET. And then list. So control get. Oops. Var comma list is that to me and, and let's get selected. No. Let's just get the whole thing. And I think that'll return the whole thing. The control is the SIS list view, 3-2-1. And again, we're going with this which I quite possibly, you know what, let's avoid the last issue we had last time, right? Let's learn from our mistakes. Copy this guy. I've been titles here, and of course we need the message box. So let's run it. Whenever, say, or didn't get anything. It's just those few three 2-to-1. 3-to-1. Is that still actually even open-end studio? Oh, it's not m was I in this one? I honestly don't remember. Well, let's just bring that one back. Let's check with this is this ListView, three-to-one omni search Folder, View, Text folder, you troll get moire. And let's make sure it's the same command as list. We're not gonna get the thought off. We got nothing. Let's get that should just bring back everything, if I recall correctly. That's the control. And on a hockey studio. Alright, let's now, that should be fine. And the other is not giving anything. We'll just try and remove this, see if anything happens. No. Dummy. Still isn't getting it, but I didn't have that window open. And without this window open, obviously, maybe wonder, No. The second I click into here, it looks like that is disappearing. Now I was hoping it was the fact that I couldn't learn at disappeared so fast. But I don't know, we're not getting that one. Let's not worry about that one, but let's move on and let's not worry about this one. And since this didn't work at all, let's go ahead and get rid of it. I have the feeling I was really asking for it there. Let's see. Let's I'm fiddler is a program I use and we bring it over. It's for monitoring network traffic. And let's see if we can grab something from it. So it looks elegant. And all of them, now this is cool. Not any of those. That search one was, let's go up here to edit. Often when you have preferences. Here we go, here's options. These guys are often still. Oh, there we go. Sometimes you gotta wait for it to get right in onto it. So there's a lot of stuff there. And then look at this funkiness, this one now this control, it's so long. It might be one that is dynamic and changes every time you launch the program. So let's, let's do a little test here. Let's, it's enabled right now. Let's just get the text. So control, get text. Output variable. Yeah, I think I'll type this, not paste. And the wind title probably would have typed this one. I sure want to type that class up above. So and this is where the sea that class, that's also one like, I don't know, man is that change in I don't want to pull something. It's always changing. So I'm r, I could have maybe gone with the options. Just the title is probably fine. So let's make sure we show this in a variable. And we launch it and run. And it didn't work. Did I do it again? And maybe this is just a funkiness. Let's, let's change this to options and see what happens. Options. There we go. So I don't know, maybe I need to restart even studio or whatever. I got the film. This still should work. I just, I'm not sure, but you just got this to work with options. So now what I wanna do is to hit, because we're going to leave that, we're going to hit OK here, close that. Let's even go as far as to close studio. I'm studio fiddler and restart fiddler. And then go back to our options tools. And our tools. There's options. And let's rerun this. Okay, So the interesting enough, even with that long name, the control state, if I had read somewhere that if a control, if you do my little experiment here you run it, wants to shut it down, restart it and do it, and it stays the same. The odds are it's not dynamic, that's going to stay the same. So you just doing it with one test. They'll change. Usually if they're going to change your change every time. Right. So that just worked and that one just fine. Not that I would do anymore. And this one let's see, is there anything else? I guess I was a good oh, you know what I have run into. Let me mention one other thing. Occasionally as rare, but I'll be doing something with this and it doesn't detect, let's say even with Notepad and I call, I'll have notepad here and I'm doing stuff. And it's not picking up the stuff in. It's really weird. And I can't put my finger on it. But usually all I do is just shut down note pattern we started and that everything works fine and it works fine and other stuff. It's it's very rare. But I don't know if it has something do with the order of when things are launched, in, what, what this tool can see or what whatever program it is. But usually just restarting iOS, there's a I restart the program, give it a try to make sure that it's not that. Alright. Well, I hope you enjoyed all the control stuff. I know it was a lot. They are very powerful and very helpful. They do amazing stuff. And let's go ahead and move on. Tiers. 61. 09 00 WinMenuSelectItem: Alright, in this section we're gonna discuss this when menu select item. It's a probably a very highly overlooked, powerful tool for older programs. So before we jump into the text here of it, if you look here in Notepad, these, these menus, and this is the type of menu that you can drive with it, right? So these have gone away and a lot of the newer programs or use the ribbon now, like here you can see in this one, right? It doesn't have, I'm, it's not, these are fake looking menus are not the same as in here. But again, what? Because this gets kinda like sending a control or a post message or a sendMessage, which we talked about before with control commands. It, it's not sending keystrokes, right? It's, it's very fast here you can even see, so it invokes it from a menu from a, you can use the text or the number. For this quanta work. The target one does not have to be active, so this is awesome. But you probably don't want it in the minimized state, right? So that leads you to meet him and tell him what can be minimized, which is pretty impressive, but it doesn't have to be active. So it'll basically run in the background. The name of the first menu you put it in here. So this one file edit view. So these, this is the high level and there's actually one above it, which we'll discuss below here in a second. And then we'll go into programming here. But I'm in the search is case insensitive. So you don't have to worry about the capitalizations and also the use of the ampersand. This am files is same as m file. So here when you see the Alt key is see how the F is the accelerator. So technically that has an ampersand in front of it. However, you don't have to send that. So it's just good to know. Now, here isn't a couple examples. So this when Select menu and title, so we get basically highlight the one in this example they used untitled, I'd use a class right, or the EXE. And then this is blank here, this file. See how files here and then open. So it's file and then open. So it's gonna do the first sub-menu, the second sub menu and so on for however may set menus you have. And that'll trigger that. The, you can do the same thing by sending the, the position. So file is the first menu, so that's one. And then for the second menu, open is two because this is 12 under File, right? And that's why this isn't one and this is a two, those match up to this. This is exactly the same thing. And then lastly, there's this other system menu which I find very interesting. We'll get into the coding of this. But just so you know, on like, I don't know if it's every program. This was news to me. But the the alt in space, that would you hit these two keys together. The ultimate space. So like in this program halt in space you how it brings up this. So some programs like the Command Window, it was little bit different, which will demonstrate in the example. But I'm, you can bring up this menu. And again, if it's a quick, easy way to automate stuff that's highly reliable, very fast. And doesn't interfere, doesn't with the human and the computer. Alright, let's get to some coding. 62. 09 01 WinMenuSelectItem Sending Words: Alright, so let's start off with one menu, select item, which can use Notepad when loops. Select item. In the title, like I said, I'd, I'd much prefer using like the EXE or the class. Let's use that class I looked at that should be pretty darn unique. Class. This, when texts are generally speaking, you're not gonna need this parameter. Now let's do, let's just say we're going to trigger an open. So I know the first one I can see or hear as file. And then let's come in here and say File Open. File. Open. I'm gonna save this, launch it in HIPAA hotkey. Oh, that's funny. So it because I had some text in here, it's saying do I want to save that? Say don't save. It triggered it. But because I had texts there. Let's go ahead and get rid of this text and say yes, now if I hit my hotkey, Yeah, there it goes. So you notice also you didn't see I wasn't sending the ALT F open, right? I wasn't sending coming here and hitting ALT F o, right? At least it appears to me it seems like it's either doing that so fast, you can't see it. I asked a couple of people, they, they weren't certain if how it's sending the Leah chameleons, if it's sending messages versus sending keystrokes. The fact that it, it, it does have it, but it just goes bam, and we don't see those menus. I think. And it's very reliable. So I think it's just, it's sending commands in some way. So let's say we wanted to pay something. So let's leave that one. Edit. What is pay? So it'd be Edit and just edit and paste. Alright, and this is why I like using the words and the next video we'll cover the numbers. But let's go ahead and use the words host. So this is going to change this to edit paste. Now here, let's put something support. Well that is cool. I'll save that, reload it. And now, you know, generally speaking, I would probably put asleep on here of like 50. Let's try it without it being human. R1 used. So run it and it did, it's interesting, it didn't work. Now I don't know if it's because of that sleep. Or lets make sure your edit, paste ended. I do this correctly. I should because it nothing changed, right? So Menu, Menu, clipboard. Well, you know what, let's do this. That should be on the clipboard now. Yeah. So its on the clipboard. I don't have to set it each time. Lunches run it. So what is going on? Oh, that's interesting. That is not expected. I had the highlighted first. So it does it really well. Let's see if I'm up here, he, I'll do it there. But from here, it's not activating. So here I would throw it out. We're going to activate millipede. I'm gonna be lazy and borrow this. That should work. And again, I might throw in asleep here to make sure it activates it. So run it. There we go. So because that was on my clipboard, that's when it sent. But if I come back in here and restore this and run it, now it's sending that. So that was interesting, right, is for the pace to happen. The window had to be active and that's probably because their cursor, it didn't it didn't have a cursor anywhere. As going to be my guess why now of course, you might use controls even to adjust that. But that was just an example of sending the commands, the menu commands. We could turn on and off and where grab. So let's comment that out. And I'm still going to be lazy or this. What was under view. You know, format, interesting. Okay, so format WordGram. So that's format word, wrap, save and run it. You know what? Let's put some text in here. A copy something over here, so a slice along. Okay, so we'll actually was mentally do it first-world rap, okay, so we see it working and that should toggle because we're not turning on and off. So let me get my key. Then I get that one on the right spot menu. So many interesting. So format today, format. Oh, look, I have a misspelling here. Go. And note is not is not. I don't have to activate this one, right? Let's do a little experiment here. So right now it's off where it, let's minimize it, run it. Now I'm going to reactivate it and look at that it's on. So in this case it notepad was actually minimized and it still took the effect. So I think that's a really good sign, right? If you can have stuff even minimized, don't even have the window up, it's just running. But it's, it's taking the commands are getting sent to the notepad controls error or menus. So, all right, that's going to wrap it up with the first example here using words and then we'll switch into the numbers. 63. 09 02 WinMenuSelectItem Sending Numbers: Okay, now we're back and we're going to be using the wind menus when menu select item. In this time we're gonna be setting numbers instead of the words. So it's very similar to the other one. Let's use foil. It wasn't Age came out and there we go, class Notepad. So nothing. So menu. Let's go ahead and we'll just start off with sending the open. And remember, we do have to activate it. Yeah, that's fine. We'll just, we'll just highlight it first and programmatically doing it. But the menu is going to be one like this. So we're gonna say file, and then let's do Save, and that's going to come up with a dialog box. So, so File Save, there's going to be 123. So let's say that run it now I'm curious actually, if we, if we had the same as before, it's not going to look at that. It actually did activate it. It's interesting. The other one we had out of that was the paste head to activate. This one is triggering it to where do we want to save this thing? So let's, you know, let's, let's minimize this and see if it works the same way to so R1. And it still brings it up even though that, that program is completely hidden, right? I mean, that's pretty cool. So very cool. Capability. And get these from the documentation that says, you might want to use a numbers when the given program has images in the menus, a lot of them will have images like here, GUI I wrote without a hotkey and see these icons like you don't have to necessarily have words here, right? You might have a picture. And in that case, you couldn't trigger it because there's no text. It's just a picture, right? So you want to be able to trigger a given menu. Now my money will go away and come on. Trigger the menu from the order of where it is. So that's how you'd use this as the numbers. And now lastly, we're going to cover the system menu, which I think is, it's kinda cool. It's just good to know that it's available because I like to say I don't even know this was a thing. 64. 09 03 WinMenuSelectItem System Menu: Okay, and lastly, we're going to look at that system menu thing, where basically normally you hit Alt space, the space bar, and here it'll pop up with that menu in the top left there. So in the example, in the support, we will use when menu select item. And then there's the title. Well, you know what, I need to come on. There we go. I need to, because in the example we're going to run the cmd command simple way with all the hotkeys because they run CMB EXE. And when I run this, and now I have my command like DOS prompt type thing coming out window. And now in here I'm going to see this is where I can see it, right? That's the, the executable. So and I probably could have got a right from there, right, but just good to actually test it. And in that we're going to, let's just look at the, my winter here. Alright, so I'm gonna hit Spacebar and look, here's an edit. And they have edit. Oh, there's, apparently there's nothing on the clipboard. Let's try that. Now. Suppose I want to do it. That's interesting. Let's see if we make it something little shorter. Or maybe I wasn't clear, selected in the right spot. Oops. Spacebar. Edit. There we go. So there's the edit paste, right? So I'm looking here. Edit paste. Again, the words are so much easier to use or we don't want this. We'll say edit, paste. Since we've got it launched. We don't need this now. And you know, I'm going to copy what they have in there. I think it's kinda cool. So this is what they shove into the clipboard to say hello world. It says echo, hello world, and then it sends a return key, right? So this is pretty cool as I'm going to save this, launch it now when I run it, it's going to activate that window, paste it in. But because you're pasting and that return key, it actually triggers the program. Let me, I got a couple of versions of the same run and I don't know if that's the little hiccup here. So we launch it. And what is going on? It's not going to be doing anything. Let's double-check here. You know what? Let's also just to be sure. So that doesn't seem to be a paste. Oh, I forgot. This is, this is hilarious. The whole point of the video, right, was the very first one. This is the 0 ampersand, this is the system menu. So that edit, I forgot I was hitting space bar here, right? And that's a sub-menu. Again, I could delete all this stuff, but I just, you know, I think it helps to see how everyone does its stuff and nothing. No one's ever perfect the first time, right? So let me run it. There we go. Look at set echo hello world, and then it actually ran the program because it echoes hello world. But we're back in the problem. So if, if your program has this system menu and set that on there, this is a way you can access it. That what I didn't know that that thing existed. And it's great because you can look around here and see what else do what I want to do, right? I could do Select All, so I could select all and copy it from the command prompt. That's, that's pretty cool. So the Edit Select All, and then copy. So let's just try it. I'll leave this one. And you know, I don't need those anymore. Edit and get rid of that one. Select all. And this is where I wanna go back and double-check. I should just try to grab a screenshot of that. So that's space all and then copy. So that should be fine. And what if I was really programming this myself? I probably run this first, but I'm going to take a gamble here. Copy. And then let's do a message box. Clipboard. Sort of save it. Now when I run it. But we still had we tried to get adults to get relaunched. There we go. So it's interesting, uh, definitely selected all the Copy it was pasting what was there before. And my guess is that just happened a little too fast. So sleep 50, maybe I should do a little longer, but it's right. Reload and run. Interesting. Yeah, let's Let's make that quantity 50. Nope, still not doing it. And a copy. You know what, let's let's add another sleep. It could be that it's just showing it before it puts stuff into the clipboard. There we go. So let's even get rid of this. Let's clear all Oh, actually, I don't know how to let's just close it will run it again. So I launched it, selected, all copied and that is, I don't know where this M is coming from. And that's interesting. There is no M there. Users video. That is me bizarre. I'm not sure where that M is coming from. But you get the idea, right, that we've triggered that to copy it. And sometimes, you know, be nice to be able to grab what was on the command prompt, that whole Web View menu window. And to be able to store that. It's very curious what that MS. Such pumps. So it's not there. That's not there. Let's not relaunch it. And I'm gonna try it one more time. Okay. So I'm not sure where that came from this time it's not there. So anyway, that's what that system menu and other cool ways is just another great way to connect to programs, especially older programs. Cheers. 65. 10 01 01 Normal loop: Alright, so for our first looping script, we're going to start off with the normal loop, which is just loop comma. And this is where we put in the number. Lets say three, I want to loop three times. And this is where we're going to add the curly braces. So that's our block, right? That's what we described earlier. If that's our block of code and let's just put in a message box saying hello world. So say this, run it in, I'm him a hotkey and there's hello world. Hello world. Hello world. Done, right. I was hitting the Enter key to get past that. So that's the most simple example of how that intro one works. So again, this is the brace that everything inside the braces is you're inside the loop, that's the body of the loop. This is your block of code which you can expand and contract with little plus button there in studio and a lot of other editors. And now let's demonstrate the, you know, let's, let's do this. Let's comment that out so we have it, you know what? Let's make it a little more readable here. So all F1, There we go. So we can see what it looked like because I wanted to demonstrate it here. Now we're going to change it to the one true brace style, which is a terrible name. But in this one we can bring that left opening curly brace up into this one. And I'm gonna run this again and I'm gonna hit my hotkey. And here I'm gonna hit my museum IS 123, and we're done, right? So you can move this up in a lot of them. Not all, but most. You can move this brace up here, which just saves your line of code, right? I, some people prefer this method. I, I like this method. There is no right and wrong. It's your preference, right? It's a lot like Gatto hotkey, right? There is no right and wrong to it. Now let's say in this example here, now let's go ahead and shift F1, that one. In this example here we just have one line of code so, you know what? We don't actually even need the curly braces. Why is that? Because our loop, we're telling it to do it three times, but it's just one line. If this was more than one line, then you need the curly braces. The fact that isn't negates that issue, so we're going to launch it. Here's 123, and that's it. So very simple. Now let's, let's continue down this path. And we're going to stick with that method for now. And I mentioned that loops have some built-in variable called a index. So let's put it right here. So if we're going to do that, we're going to put a percent here and then we're going to say a index. But if we did that, we need to wrap this in double quotes. Okay, so what do you think's going to happen? And look, let's not put it right next to each other. Let's put a space here so we can see it. So I'm going to, oops, I made a comment, this dry out. Sort of shift F1. And now when I have a hotkey, look here we have this one. That's the a index value, that's hidden variable that it's built automatically. And then two and then three. Now if you were to nest these, they actually override each other or those they stay at the, the innermost loop. So if you jump around, it gets confusing. You need to store the outer loop variable. But for this one, it's, it's very simple for students and that then let's go ahead and build something that has like a continue statement. So we're going to throw it back in our braces. There we go. And let's say if a Next is less than two, I will say less than three. So it's just kind of run runs once or excuse me. Then we are say continue. So we're practicing our continuous statement, right? So we're not going to see any of this, but what's going to happen here? What do you think? Well, when this first message box comes up, it should be three and was showing me at once because I use this continue. And it's going to come in here and it's going to basically do this loop. One to know it's not 33, it's not less than three, is not less than three. So then it gets to this one, right? But the first two times, it shouldn't even get there. So my logic, and now we'll see where it three, hello world. So we didn't do the 12. I get OK, we're done, right? But what would happen if we said, if index is, let's say, you know what? I don't want to. I like having these examples for everybody or to my second curly brace, current leering up. So I'm gonna copy that because I want to borrow it. I'm going to comment that out and come in here. And now we're going to say, oops, if a index will say equals two, let's break. And I die here to here. Okay? So I'm going to launch this. Now it's going to come up and we're going to see the plus add this area. So this will let us know when we get to this point. So now I'm going to watch it when I have a hockey. So notice it's one. Hello world. Now what should we see next? Well, when next time this is too, I'm sorry, the next time through the loop, it'll be two. The 2's gonna say, hey, you know what, no longer do this loop at all. Jumped down to here, so two, and now it just says hi, right? Because the break, it says, hey, get out of the loop entirely to continue, says, go ahead and continue on the next iteration of the loop. But, but keep doing the loop. Break says, hey, get out of the loop entirely, we're just done with it. Go on. So those are the, the basic variables that are available. And everything in a regular loop. And these normal loops are very handy and you know what? Let me show you one other thing. I'm going to comment this one out. Is this is the one that kind of confused me a little First, let's say you have var equals five. So our variable contains a number, and we wanted to do a loop. Let's stick with three so it shorter. And we're gonna do a loop, and we wanted to loop on var c. I would want to write this this way and we'll keep it with one line so we won't actually be the curly braces message box. All right, so hey, this should be fine, right? So I'm gonna run it and then hit my hotkey. And nothing happens. And I hit again, nothing happens. Okay, well, why is that? Well, this var unfortunately is it has three, but this loop command needs us to be a wrap, either wrap it with percent signs like this. So now when I run it, you'll see a funny percent. There we go. So 123, right, that's one way to do it. Or what I like to do is just to force it to be an expression. And this I just find it's easier to read than the double percents. So this 123, so a loop if you want to use a variable here, right? What you wanna do is make sure you tell it to use it as an expression or wrap it in the double percents. That one. I would get confused in that a lot in so it's just good. It's important to know that you need to do that. I think the other one, let's test something here is I've run into this. So let me see if this will work. 230, that does work. Okay. I thought you might have to have a space here, but this one just ran without it being a problem. So apparently not. Alright, lets move to the next type of loop. 66. 10 01 02 While loop: Okay, in this lecture we're going to cover the while loop. While loops are, are pretty straightforward. So we're going to say in a while. And then we're gonna put em expression up here because we have an evaluation where you're going to evaluate an expression. I like using pins here, they're not required, but to me I just regret their habit. And let's say while x is less than four. And here we're going to use the one true brace style of putting that in the same line because it should take a new problem. We'll say message, but, you know, let's say X. So we're going to set x to x, quantity equals the a index. And then we're going to put up a message box of X. We could use a index. It doesn't really matter, right? So what's going to happen is every time this goes through, it's going to be evaluating this upper part every time. And so I'm going to save this and run it. And I, when I hit my hockey. So x is currently equal to one. And then it goes back and as to, and every time it comes through, so right here, it's at two. It comes up here and evaluates it. So three, it's still not less than it in four. And now is where. So before, because we set for inside this loop, that's why it didn't break before. You might have thought it was gonna break before, but look, we're the, it gets assigned here. This happens when it comes back through, right? So here is four. Now, it'll exit out of it, right? So it's important to realize that evaluation happens up here in both this and I think the next one we're covering as the until. And that's just a critical thing to understand where that evaluation is happening because otherwise you get confusing results. So this is the while loop. I'm not going to cover all the other stuff with the a index and continuum break is we already covered that in the other loops and they work identically. Maybe in our working session at the end of this, the loops will cover a bunch more, but that's it for the while loop. 67. 10 01 03 Until Loop: Alright, this session we're going to use the until loop. So we just started off with the loop. And you know what? Let's, we're going to leave this, the parameter for the count blank. You can do that and it will just run forever, right? So I'm gonna put it in my, oops, wrong. One. That E. And here we're going to say like message box percent a index. And this of course would just keep going up and up and up and up, right? But what we're gonna do is we're gonna say down here, we're going to say until. And I like using Perkins here. I don't think that require but a index is a say equal to three. And we're gonna save that and run it. And notice when we hit it is good to go 123 and it's out. Why is that? Well, because this evaluation happens after this loop, right? It gets down to this brace says Hey, is there it until your o, if there is, let's check it. Own Mao, kill it, right? So it's very important to realize this happens, this evaluation happens after the loop has gone through. And it basically gets to here. And by the way, I think it looks a little weird, but you can put this up on this row if you care to. So I can rerun, relaunch it 123 and we're out. So that's how use the until. And you just, you put your code in here that you want to have evaluated your expression in. When it resolves, it'll decide whether that loop continues on or not. 68. 10 01 04 00 Parsing Text Loop: Alright, next we're gonna cover parsing a string with a loop. And this one's a bit more advanced, has some intricacies to it. So I wanted to break it out first before we start programming. First thing we do know is this parameter here. The second one, it has to be the word literal word parse out. The case matters, but it can't be a variable. It's gotta be the word parse in order for this to work. The third parameter right here, unlike the other ones we were doing, this is expecting a variable, right? So don't try to put in text here because it won't, it won't work properly. So put in a variable, they're not even says input var, right? So make it clear it's a variable. Then the, you can signify the delimiters. You wanna use a comma or actually we have a different example here for comma, but a pipe or a space or wherever you want. And here's how you can emit characters. We're going to cover that here in a second. The, this variable, this loop has a special variable called a Loop field. And every time you loop through it, it's going to be that string of the current substring of where it is. So that's how we're going to get basically the value we want as we parse it. And so we'll demonstrate that it'll make a lot more sense in the video. Another really interesting point is in this third parameter and delimiters, instead of putting in a double quote comma quote, if you put the letters S, v without any quotes, it will parse the CSV value properly in. What's really great about this is it takes care for there, if there is a double quote, encapsulation and staff, so things out of Excel, and that's the example we're going to work through. They give us in the auto hockey documentation that it takes care of all that for you, which can be a lot of work on. There's a lot of intricacies and go into a trust me, we've when I've parsed like a tab delimited file, file, and it'll, it'll get exploited from Excel, but it has double quotes around stuff that has a quote inside of it. And it's actually a fair amount of work to parse it properly. So take advantage of this CSV. If you have a CSV file, it's a much better way to approach it. I wish they had like, you know, TAB or something like that and they would took care of everything. Unfortunately doesn't exist. But we'll give you an example of that here in a bit. And then submit characters. This is where you would put it. Now this is where to me it's really weird. You wrap these in here with if you're putting in like a special character, like a space or a tab, you need to put it in with the percents around them in order for it to think of as like a trim left and right trim its going to trim the spaces and tabs from the outer sides, but not the middle, right? Not the middle of the substring. So now that I've said all that, let's get into it. So it'll make a lot more sensor will, will nudge through it. 69. 10 01 04 01 Parsing Text Loop: Okay, so for this first parsing loop of a string, we're gonna just parser regular stream. So let's say a loop. Remember this has to be the word parse. So right here it's expecting purse, the variable. We didn't give it a variable yet, but we'll just call it var for now. And then the delimiters, let's say we're going to delimit on a pipe. That is the pipe character. So here, obviously a var. Joe was here today. Okay. Now, Let's go ahead. This will be a one liner and let's not worry right now about the braces we'll just do right here. So a message box, and as I mentioned before, it's a loop field, I think. Yeah, a loop field, oops, forgot my percent sign to make sure it evaluates Edison expression. So now I'm going to launch it and run it. And so we have Joe was here today and we're done, right, so that loop, because it's just one line, we don't need the braces. This is one I actually can't with Kroll if let's just test it. If, if this'll run with no and see this is one where the curly brace can't be up here, it needs to be here. So if you do have it, you need to have that on a separate line. So let's, Let's add some space here, space here, and tab there. And then in here what we need to do is to say, let's, we're going to put usually I use a pipe, but it doesn't really matter. So this, what this is gonna do is it's gonna allow us to show if there are spaces on the ends and outs of this. So first let me run this. I'm gonna run it here like it is. So see you this space, this space right here after the Joe, right? That it was up there. So it's not getting rid of those, right. There's a space before the was and then the tab in between there and the here. Right. So and today has nothing wrapped around it. So that's how it's nice and tight right? Now. I'm going to, I'm going to be lazy here and copy it because piping socks. So copy that and we're going to add that as something to omit. So that should go there and we're going to rerun it. Oh, sorry, wrong line. Why did someone say something? Here we go. I met character. So there we go. So now when we run this, see how Joe there, nice and tight right to it was right to it here and today. So this is a way you can basically trim while you're parsing this. Now if we had something inside it, Joe was not. So notice on this one the Joe it's tight. The was but the space in-between doesn't get deleted. Right. So that's what they're talking about. It trims on the outside, not the insights. So there we go. I think that's what you got for this video because I'm gonna do the CSV y1 in a separate lecture because it's just, it's just more advanced. 70. 10 01 04 02 Parsing Text Loop with CSV: Alright, for this second string parsing loop, we're going to demonstrate pursing a CSV parameters. Something's a string that has CSV in it. Now this could be, if you're parsing and CSV file, you would loop over it. And I have an outer loop of parsing a line breaks. And then the inner loop, you'd be parsing the CSP values within that row. For this example, we're just gonna focus on your string. Now. I also want to demonstrate something here because it can get tricky. So this is the, the, what's actually in the help file. So if I'm going to copy this and paste it, and I want you to notice something here. So notice this is a, this has double quotes here. And then this does, this actually had this special code has quotes inside of it. And then this one is here to here. If I just try to say var equals that, it's not going to work. It's going to look at this first, tried to set it to that. And then this is going to think is some sort of a command or something. And if I actually just save this and try to run it, it, it, it actually tried to write it as running, but it didn't do anything because it doesn't know what to do. So what we need to do is there's a couple of ways we can handle this, not a hotkey. The first one is to simply change this to here. We're gonna put that and move this down day here. Now that will, if we do a message box var and launch it. Now we got exactly with that there. This is generally speaking the approved way how most people do, but most people, but it's generally done right more often. Having said that, if you're still using version one of auto hotkey and not Version two. This is the updated one, not the vanilla version, which is a whole other thing. What you can do is you can actually get rid of this here, do this, and put this on this line. So it just var equals that. Now that actually forces this, I think into like an expression and it will set it properly. And so when you have double-quotes within your text, this is a nice short way to get your text into a variable that you can then play with her, do whatever you want. I use this approach a lot when I'm working with like a regular expression or something like this where I'm like, crap, it's got all these double-quotes in it. I don't feel like breaking it out over different lions. It's just confusing. So anyway, that's how you can get rid of that. So let's get into the looping string now. So loop harsh var. And here the delimiters, this is where we want to say CSV. And again, that's gonna make it treat it a little special. Now, what we can do is we can say message box. And the real thing here is to note the width is a loop field. The comparison of this versus what we see up here, right in here we see sea. You'd think the first one would come out as with the double-quotes. First feel double quote, right? That's what I would have thought. And then the second one would just be second field. But let's go ahead and save this and run it. And now when we hit our hotkey, so see how just says first field there, Erna double-quotes. That is because in proper CSV standardized things when you're dealing with a csv file, it says, hey, if there's double quotes on the out of this, rip them out. Basically say, OK, now I can take those out and use what's inside that as a literal string. So that's the first one. And then watch here. Notice that again, there's no quotes here, double quotes here. The second one, there's still no double-quotes right? Now. This third one, this is where it gets tricky is yeah, these are doubled up. So when we do this, this is how we get double quotes inside of a string is in on hotkeys to double them up. So that's why you have to put these double-quotes to surround it. Otherwise that would have broke and it would not have come through properly. So this is how you deal with that. And what's great about this CSV parser is you don't have to deal with any of that, right? Because it's, it's not fun to parse all that yourself manually. And then the last one there, here's a blank field, right? Because this had nothing in it. And then last field, oh, and this is another one. So we had a comma inside of our string, that comma without double quoting, it would have broken the encapsulation and it would have parsed it. But by double quoting that, that's how we make sure we get that entire thing because it has that in it. And so that's, that's again why using the CSV parser when you have CSV data is really incredibly helpful. So I hope that's clear, but there's, you know, the vast majority. The other stuff isn't that big of a deal. We already covered the omit character, so I'm not going to iterate that again. But it is a pretty cool functionality and not a hotkey. 71. 10 05 00 Loop Files and Folders: Alright, this next lesson we're going to cover looping over files in directories. So looking at the commands is pretty straightforward and either you just put loop files, the file pattern you want, and then the mode which we're gonna get into here in a minute. It basically returns back one file at a time or one directory at a time. In your loop. The file pattern, you can just basically here you put the path, but then this is where you put in, you know, if you want to get everything ends in the TMP, then you put star not TMP. If you want everything that ends in a dot h k, which starts at HK, and you don't, of course don't have to do anything here. If you don't, it'll get everything back or star dot star. The file pattern is assumed to be working in the current directory. So make sure that if you want to get files in a different directory, that's where you supply this path, right? Otherwise it will just run in the current directory wherever that script is written. Here or the mode, you can use 0 or more of the following, right? So a d will tell it to include the directories or folders. Unfortunately, both begin with f, right? So this is why they use D for directories. F will include file, and if both F and D are omitted, it'll just get files in that folder. So the default, if you don't put anything, it's just gonna get files. If you put it F it'll get files without the directories, but it's put FDI, it'll get both ethanol and you can add to make it recursively. That's means go into the subfolders and get everything, keep going down the subdirectories until you get everything and keep pulling it back. There's quite a few who have special variables. I'm not gonna cover all of them in the actual programming, but I wanted to just see him here. So this is a loop filename. Obviously that's an important one, would probably use Add. We'll probably use one or both of these. Full path or a full file path. File footpath or file baths. There's the long and short step. I don't, I haven't used the short file paths and quite awhile, if that's an important, then make sure you're aware that that's there. But nowadays, computers can handle things more often than not, that's not a problem. So the short stuff, the short names, loop file directory, I'm able to grab that. And then there's a lot of attributes you can get about the files. Maybe we'll get file size. So this is an example that you can get it if you want it in just bytes or if you want it in kilobytes or megabytes. So depending on the file size that you're looking at, you might decide you want to take one of those instead of 1.5 to do math. So, but the others this time Creative access, that's great that you can pull this information. And we're not going to cover in this course, but there's also a file object which you can do a lot of stuff with. But let's go ahead and start working on this file loop program. 72. 10 05 01 Loop Files and Folders: Alright, this lecture, now we are going to loop over files and folders and whatnot. And so let's start with a loop, common files, and that's the command that'll get us to looping over files. And then we need the final pattern. I'm going to grab this path slash and I'm going to say give me star dot star to give me everything. Most crime and start there. Now, this is one of those loops where you can't have the one true brace up top, but if we had it here it would break. So inside here, let's do a message box percent. Let's throw an index so we can keep track of which one we're on. For that indexes available on every loop and a tab just so it's not right up next to the other thing. And let's start off with what do we want to use? Let's use a loop filename. There we go. Alright, let's save that. Launch, it, hit my hot key, and nothing's happening. So you divide, forget, let's see where we were here. Phi IOs. Here we go. Again. I can go back and delete that, but it's just really good to show you guys. We all make mistakes and either look at what you're doing. I thought that was filed, not files, but anyway, alright, so now we're getting, so one is create a directory and course, so that is that one. And then the next one should be Udemy income PEDOT competitors. And that is it, right. Why is that? Well, because we didn't give it any mode. The mode by default is to just get files. So we're going to throw in a comma here. And now for the mode, let's get d, e, and f. So this will get the directories. And so now that's the first, that's the directory one. Thankfully, I'd number those in sequential order. This is the overall main folder, but o and then it goes down into the known. Now don't, these, by the way, don't get excited. These aren't courses yet. I just made placeholders for the ones that I want to create so you get a preview of the courses I'm considering doing at some point. And now we're down to the files, right? Adding the D and F, we were able to get both the directories and the files. Now, what if we wanted to go recursive and go within the each sub folder. So now that is the r I'm going to add to this and run it. And now the intro dot he, let's see if it goes deeper. No, that's jump into the next 134 ACC tool. See so how queues integer and hijacks into web scraping. Entrepreneurs. Here we go. So now in one of the sub folders is this zeros are entered auto hotkey and then errors is 01 intro. That's a folder. So. You can see we're going over, it's kinda hard to tell because if it's a file versus a folder, because I just use a loop filename. Let's change this to a loop, a loop file, full path, flow path. This will make it a little more clear