Add it to the macro, and set the title to KM has an action that makes it dead easy: "Set Safari Title". Next we'll customize the window's title to make it easier to find in Safari's Window menu and tabs. 5 seconds" (or to 0.5 seconds, as KM understands both). At this point we don't need to wait for extra contents to be downloaded after the page has finished loading, but to make absolutely sure the macro won't resume too soon, we set the value to "For at least. So we add a "Wait For Safari to Finish Loading" action. This implies that we must make sure the page has finished loading before we do anything else. From now on, we'll alter the contents of the page. Here's my method for finding out the values I want to use for width (→) and height (↓): I open a window (in any application), resize it manually to the size I want, and use this macro to measure it. Add to the macro a "Manipulate a Window" action (from the Interface Control category) and set it to resize the front window in Safari. So insert a "New Safari Window" action into the macro, and paste the url into its "With URL" field. The first thing we want is to open the app in Safari. Launching the appĬreate a new macro named "Open" in your Safari Tutorial group, and give it a trigger (I usually start by giving my macros a Status Menu Trigger, which makes them easy to test, and defer deciding on a hot key or another trigger to later). We'll change its window size, its title, a bit of its contents, and its background color. OK, so our first macro will open the app in a new window and set it up according to our preferences. Name it Safari Tutorial and make sure it's enabled only in Safari. This time we'll make several macros, so if you haven't from the first part of the tutorial, you'd better start by creating a new macro group for this app. And when you want to delete everything it stored to your local storage, click the Clear LocalStorage button. Again everything is done on the client side, including saving the notes (using LocalStorage), so except for loading the page the first time, it makes no other server access at all. The application can be found here, so open it and spend a minute getting familiar with it. And then you can read the notes in each Notepad. You can create (and delete) Notepads and add Notes to them. Our test application is a kind of online note taking app (except that your notes are not stored on a server, but on your Mac). And hopefully it will show you how you would approach controlling a real web application. To be precise, it's more like a prototype than a real web application, because it lacks many features and has no backend at all, but that will do. We'll add hot keys and other customizations to it, and we'll automate some tasks.įor this we need a web application where we can experiment, so I put a simple one together. Our goal, here, is to control a web application like we'd control a desktop application. If you haven't, you should do so now and come back here later. In any case, this second part of the tutorial was written with the assumption that you read the first part. Finally, if you have no prior experience with HTML, don't expect to understand everything, but you might still learn some things about KM. If you're not a developer but have some understanding of how HTML and JavaScript work, then this second part was definitely made for you. Is this tutorial for you?Īgain, if you're a web developer, you probably learned everything you need to know about controlling web pages in the first part of the tutorial, but you might still learn here a few things about KM itself. So I recommend you not to just read, but to build the macros and test them along with the tutorial. Instead we'll build macros like we would in real life, so we'll also run into problems and errors, and we'll see how to solve or work around them. I won't just show you what works, though. We'll see how to interact with webpages and how to improve and control a web application. Now it's time to try putting together something more advanced. In the first part of this tutorial, we explored Keyboard Maestro's browser control actions and learned how to fill out and submit basic forms.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |