Preheat oven to 450 degrees F (230 degrees C). Step 2 Prepare a large skillet with cooking spray and place over medium heat. Cook chicken in skillet until no longer pink in the center, 5 to 7 minutes; season with 1 tablespoon garlic powder and transfer to a baking dish. An unbelievable sandwich made with 2 breaded Halal chicken patties, cheese, lettuce, creamy mayo and a bun in the middle!
- How Good is a $1.00 Frozen Chicken Tender with Mac & Cheese TV Dinner? Help support The Wolfe Pit! - a One Time Donation!
- “Fussy eater” goes blind after years of eating only junk food 300 posts. It turns out they were just eating crap, like mac and cheese and chicken nuggets, hot dogs and hamburgers.
- Download Chicken Invaders for Mac to defeat the chickens' latest evil plan to save the day (quite literally)! Chicken Invaders has had 0 updates within the past 6 months.
Speaking Up with AppleScript
Once You gaze into the System, the System also gazes into You! :-)
Fair warning! Any programming and scripting adventures can at first, be; very frustrating, extremely rewarding, can sink you into the depths of a learning curve for a long period of time, expand one's thinking patterns far beyond normal, cause one to pull one's hair out, cause one to become much faster and productive on their computer, can at times force one to restart their system frequently, and quite possibly be the most amazing and fun thing you have ever done. Enter at your own risk, for once the journey has begun the 'you' you have always known may never return.
Disclaimer: Apple, AppleVis and Nicholas are not responsible for anything you may do to, with or for, your computer. If you enter the world of scripting or programming, whatever you create you own completely yourself, failures or successes. Such is the fate of any developer, regardless of the platform or experience . Having a back up of your important stuff is a very good idea.
That is not to say that it is overly dangerous, or that there is no help out there, many resources exist that can assist on your journey. I will include any links I can find near the bottom of this post. I can say, in the twenty-five years that I have dabbled with AppleScript, I have never had to reinstall any software because of my scripting. Admittedly, I am more of an advanced dabbler, but I am certainly no expert. I have personally enjoyed the easier scripts that help automate my systems. I am perfectly happy staying at that level. Dabbling with easy AppleScripts has expanded my thought patterns and taught me much about Mac OS and my computer that I might never have learned otherwise. It has been and continues to be, one of the most frustrating, gratifying and amazing adventures I have ever embarked upon. Really!
Now that I have completely scared the pants off you, put something comfortable on, grab some coffee or tea and lets get started.
In the Beginning
In the traditional methods of teaching any programming, the first project is always, showing how to create something that presents two simple words on the computer for the user to see. These traditional words are, 'Hello World.' In keeping with Apple's usually non-traditional method, and considering the AppleVis community, there will be a slight variation in our own approach. Rather than printing the words on the screen, we will have the computer actually 'say' the words instead. I know what you might be thinking, programming is complex. However, the above project is actually much easier than one might think. When I began my own scripting adventures with AppleScript in the early nineties (Was it System 7?), this is also how I began.
AppleScript is known as an 'English-like' language. Meaning, at the dabbler level, most commands and blocks of script are typed with easy to understand words that read just like the English language. So the benefit is having an easier to understand process from beginning to end. Just looking through your script pretty much tells you what it will do, and to what. Although, there are many levels of expertise beyond my dabbles. I find some sneaky scripts online that completely baffle me, and look more like math equations than anything. It's okay though, this is normal and only shows how much room for advancement actually exists.
The Script Editor IDE (an Irresistible Daring Environment)
Just kidding, actually IDE is Integrated Development Environment. The Script Editor, also called the AppleScript Editor in earlier Operating Systems, can be found in the Applications/Utilities folder. You can get there in the Finder from the Go Menu and choose Utilities. Once opened the Script Editor is, for all practical purposes, a fancy text editor. But, don't tell it I said that. (Ahem!)
The Script Editor contains two main windows and a toolbar. The main upper window, also called the Script Source window, is where you type the scripts. The lower window is for various results from running your scripts. The lower window can be largely ignored for now. Everything we do in this post will take place in the main window and on the toolbar.
The Toolbar. (Don't Push the Big Red Button!)
The Toolbar has two main buttons that will be used repeatedly, the Compile button (Command-k) and the Run button (Command-r). Actually, I don't think either of them are red. The Compile button is kind of like a spell check for scripting. It doesn't check your spelling as much as the syntax or structure of your scripts. If something doesn't make sense to the compiler, you will receive a dialog warning. At first, these dialogs can also be mostly ignored. Just click OK to dismiss it. Then look at your script for errors. Scripts can be very easy to read, but are still somewhat fussy on how they are typed. The Run button will attempt to run your script from the Script Editor. To test my scripts from the Editor, in case I typed something weird I do the following; I navigate to the Toolbar, click the Compile button, then Run! :-)
That Crafty Compiler
The Compiler tries to compile your scripts into a language the Mac understands. If it is successful your script will become colored in a way that makes the logic more obvious. If needed, compiling will also auto-indent where appropriate. Sometimes it doesn't succeed and throws an error. I blame the Compiler for this! At least until I find the error in my script. Oops. :-)
Sometimes the Compiler will try to pull a fast one! Sometimes when it 'does' succeed, your script still won't work the way you expect. This is usually because the logic in your script is doing something other than your intention. There could be many reasons for this. Scripts are very chronological, from top to bottom. Make sure things are typed in the order you wish for them to occur. Scripts are also very fast. Sometimes a compiled script will still not function the way you expect because of the speed at which it is being executed. There is a 'Delay' command that we will use below that can make your script hesitate and let your system catch up.
Errors are Highly Illogical
Actually, errors are normal and help you correct your scripts as you go, so don't be too frustrated when they occur. The most common errors are from typos, incomplete scripts, or logic that doesn't make sense to the Compiler. (Shh! Don't tell it that I said that.) Anyway, we will be sticking with very simple script examples farther below, you should be able to compare easily to your own.
For instance, in one script I tell TextEdit to open. Then the next command tells it to do something to the blank document. Running the script loads TextEdit, then gives the system error sound, then the blank document appears, but does not do anything else. My problem was that the 'do something' part was being executed before the document was fully on the screen. (Sheesh, talk about picky!) Using a Delay command between the two others fixed the issue. My logic was sound, the script just needed tweaking for the way my computer responds. I guess even programs need to slow down once in a while.
Run Away!
Compiling will not run your script. The Run button on the toolbar will attempt to run your script from inside the Script Editor. If it is uncompiled, it will try to Compile first, then run. Hey, get back here.
Your saved scripts (.scpt), can be run from many areas in the OS, not just the Script Editor. The AppleScript Status menu, a custom Keyboard Commander shortcut, as your own saved application, drag a script file to a customized toolbar, a service on the shortcut menu, a folder action, even a custom Dictation command to name a few.
Fussy Chicken Mac Os X
The secret Status (menu.)
To run them from the Scripts Status Menu, first we have to unhide the menu. Open the Script Editor and navigate to the Script Editor Menu and choose Preferences. In the 'General' section, check the check box 'Show Script menu in menu bar.' No more hiding for you. Then navigate to the Status Menus and click the 'AppleScript' Menu to look at the default scripts that are available. The Status menus are on the top right of the main menu bar. You can get there using VO by pressing Control-Option-m, then press it again.
To add your own scripts to this menu, first they must be compiled and working. In the Finder click the Go menu and choose Library. Then find and open the scripts folder. You can make your own folder structure here. Then copy/paste in your script. They will appear in the AppleScript Status Menu at the bottom. Maybe some day I can work my way to the top. ;-)
The 'Hello World'Script
When you open the Script Editor, Depending on your settings, you may receive an Open File dialog. Press Command-. (period), to cancel the dialog, then press 'Command-n' for a new document. Or do what ever you need to get a new empty script window on the screen. Navigate to, and interact with the Script source window. Then type the script below. You can sometimes copy and paste scripts from the web, but this can also cause issues picking up hidden and special characters which will throw one of those lovely errors on the screen. For easier scripts, it is always safer to type them.
Type the line below exactly as you find it, no extra spaces or punctuation.
say 'Hello world!
Once you have it typed in, you are ready to compile. What? That's it? Yup, that's it! Welcome to your first script. Clicking the Compile button on the Toolbar will check it and if successful, colorize the script. For some of us the coloration does not matter, but the fact that no error appeared is the important part. If you did receive an error, dismiss it and go over your script with a fine-toothed comb. Make sure there is a space between the word 'say,' and the quoted text. Also make sure the quoted text has no additional quotes, only the two outside quotes. Make sure there are no extra characters at the end, beyond the quotes, especially punctuation. Also make sure you are typing plain quotes, not the special quotes that are left or right. VO should say only Quote, not, left-double-quotation-mark. If you are typing into Script Editor, you should already be using plain quotes by default. I like to type some longer scripts into TextEdit, but I have to use plain text documents or I get the fancy stuff that Script Editor doesn't like.
Next click the Run button and listen. Your script will use the Mac's text-to-speech engine and 'speak' your message using the default system voice. If you hear 'Hello World,' then your script is working. This is a good time to save your script somewhere. Save it as a script '.scpt'. I like to make a Scripts folder on my desktop to stash my scripts. It becomes a good place to put resource materials as well. Everything is nice and handy for my scripting adventures.
Now play with it some, type something else between the quotes. Remember to be careful as stated above, no extra quotes, no extra stuff outside the quotes except the word say. You can use standard punctuation inside the quotes, but avoid stuff like slashes, colons, semi-colons, etc. You can type as much as you wish between the quotes, even multiple sentences or entire paragraphs. Then compile.
Click the Run button and let her rip. It should speak your entire text, what ever is between the quotes. Once you are done playing, let's change it up a bit. Delete your current script, or start with a new script window. Type the following script below, being careful just as we did earlier. Remember with the level we are currently at, lines of script have no punctuation at the end, or anywhere except inside the quotes.
say 'Hello world!' using 'Alex
Compile and Run the script. It should sound identical to the previous script if Alex is your default system voice. The one-line script above does the same as our earlier script, but designates the voice 'Alex' in quotes at the end. The 'using' command allows one to use any voice that is already downloaded and installed on your system. You must use the exact spelling of the name, in quotes, without any punctuation.
Let's add to it a bit. Below is a three line script that uses the voices 'Alex' and 'Fred.' Or you can use any two Voices that are already installed. The first lime is a say line, the next one uses the 'Delay' command. Then the third line uses the say command again, with a different voice.
say 'Why did the chicken cross the road?' using 'Alex'Delay 1.5say 'Sheesh! You are supposed to be the new fancy voice and you are still telling old chicken jokes?' using 'Fred
The three line script above uses Alex to speak your text, then waits 1.5 seconds, then speaks again using the Fred voice. Using this same method, you could keep going with any voices on your system, creating an entire dialogue with multiple speaking parts, adjusting the timing using the Delay command. I once created an entire comedy routine this way. It wasn't very funny, but I sure learned a lot. :-)
Tell the Whole Block
So far we have typed in single lines of code. Another method is to send multiple lines of code to a specific application. These are called 'tell blocks.' You start by addressing a application by name, then send several lines of code that are indented underneath. Then finish it off with an unindented line at the very end. Below is an example that launches Safari.
tell application 'Safari' activateend tell
The 'tell' part is not indented. Any lines underneath are indented with one Tab spot. Then the final line is not indented. So we start by telling the system that we are instructing Safari to do something on the following lines, which are all indented. Then we finish it off by telling the system that we are done addressing Safari specifically, with an 'end tell'. The Activate command will launch the application in the first line, or if it is already running, bring it to the front.
There are other 'blocks' of code for various functions, all of them finish off with an End statement of some sort. Tell blocks finish with 'end tell'. 'If' blocks finish with 'end if'. Repeat blocks finish with 'end repeat'. etc. All of them have indented lines in between the beginning and ending lines. In the current Script Editor, after typing the first indented line, it will start auto-indenting until you force it to stop. This is very handy when typing longer blocks of code. To stop the behavior, simply delete the auto-tab and type your end statement.
Since this post is getting rather long, we will wrap it up here. One more script for an early Christmas present, for any who wish to type it in. Remember to use one Tab spot for indents.
The script below requires an open TextEdit document with something in it, then open Script Editor and type in the following script exactly as you find it. Note, it contains two variables that each look like two words stuck together, 'theText' and 'wordAmount'. Type them the same way. A fun side note, this use of typing the name of a variable is known as 'Camel case' because the second word of the variable is capitalized, looking like the hump of a camel. :-)
The script below also has a small phrase in parenthesis, make sure to include them.
tell application 'TextEdit' activate set theText to text of front documentend telldelay 0.5tell me activate set wordAmount to (count of words of theText) display dialog 'Word count: ' & wordAmountend tell
Running the script will pull TextEdit to the front, get a word count from the open front document and stash it into the variable theText. It waits a half of a second, then switches back to itself and retrieves a word count which it stashes into the variable wordAmount. Then it puts a dialog on the screen that shows the word count by sticking the variables and a message together using the & symbol. The dialog can be dismissed by clicking the OK button, or the Cancel button, or by pressing Return on your keyboard. It is a very handy script, I use it a lot.
Feel free to save it on your system for future use. You can save it as a script that will open into Script Editor, or save it as an application that will simply run and do its thing. When I save mine as an app, I also like to save a script version first for easy editing into new versions.
There you have it, the scripting door is cracked open a little. There is an entire world waiting on the other side. Perhaps next month's blog will dive into another whole area of scripting, issuing keystrokes and other events through your scripts. This can include any VO keystrokes as well. As you learn more on your own, especially for those of us that cannot see the screen, remember to use the 'say' command for confirmation of what is happening while your script is being run.
Keep in mind, no matter how fussy your scripts end up being (don't tell the Compiler I said that,), it is really about one important idea:
All of our cool digital stuff that we work with, play with and enjoy, is all about 'Living.' Live well!
Helpful resources:
AppleScript: Beginner's Tutorial - macOS Automation
https://macosxautomation.com/applescript/firsttutorial/index.html
AppleScript: Overview.
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html
Introduction to AppleScript Language Guide - Apple Developer
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
MacScripter: Forums and Tutorials. Highly recommended!
http://macscripter.net
AppleScript - Wikipedia
https://en.wikipedia.org/wiki/AppleScript
AppleScript is an open-ended language and many find new ways of using it to help automate their systems. There are many AppleScript sites on the web, I invite you to include your own scripts and links in the comments below. Let's see if we can crack that door a little farther open. :-)
Portions copyright Apple, Inc. All rights reserved.
Services are one of the oldest ways of extending OS X’s capabilities, dating all the way back to NeXTSTEP, the operating system Apple bought in 1997 and turned into OS X. But there’s a good chance you’re not aware of services, or have forgotten about the Services menu, since it’s easily missed, tucked away as it is in the application menu for most apps. Since that menu mostly contains command like About, Preferences, and Quit, many people never look through it closely.
The simplest way to explain services is that they’re a way to invoke features of one app from within another app. Here’s an example. Let’s say you want to email a snippet of text (like a passage from a helpful TidBITS article on our Web site) to a friend. Here’s how most people would do that:
- Select the text.
- Copy the text.
- Switch to Mail.
- Create a new message.
- Paste the text into the body of the message.
Here’s how to perform that same task using a service. In this example, I’m viewing the desired text in the Google Chrome Web browser, but this built-in service works in most OS X apps:
- Select the text.
- Choose Chrome > Services > New Email With Selection.
This creates a new message in Apple Mail with the selected text, in fewer than half the required actions.
What’s great about services is that they work in many OS X apps and with all sorts of objects, like selected text, graphics, files, and folders. The Services menu is contextual, so what you see in it depends on what’s selected. In the Finder, the Services menu also appears at the bottom of the contextual menu that appears when you Control- or right-click on a file or folder.
Managing Services — To see and manage all services, open System Preferences > Keyboard > Shortcuts > Services. Apple presumably chose this somewhat odd place for services because services can also be invoked with keyboard shortcuts.
Once in the Services view of the Keyboard preference pane, you can check and uncheck services to enable or disable them. To save even more time, you can add keyboard shortcuts to commonly used services. Select a service, click Add Shortcut, and press the desired keys. It can be tough to find a simple keyboard shortcut that isn’t already claimed by the Finder or another app, but I’ve found that Command-Option-Control, followed by a letter, usually works. Some services come pre-configured with their own keyboard shortcuts, which can be annoying if the service’s shortcut takes over from a command’s shortcut in a particular app — just redefine the service shortcut to resolve the conflict.
Frankly, the built-in interface is pretty bad, because you can’t expand the System Preferences window to accommodate a lengthy list of services or long service names that end up being cut off. Happily, there’s an alternative, a utility called Services Manager from MacOSXAutomation.com. It’s old, and thus a little fussy to install, but it still works fine.
Once you’ve downloaded and expanded the file, Control-click the Services Manager Installer.pkg, and choose Open from the contextual menu. This is necessary if you have Gatekeeper set to allow only apps from the Mac App Store and identified developers. Once you allow it to run, you can work your way through the installer, which places the Services Manager app in the Utilities folder inside your Applications folder.
Launch it, and you can see that it offers a simple interface for enabling and disabling services and assigning keyboard shortcuts. Since its window is resizable and you can show only services in specific categories, it’s far easier to use than the standard interface.
If you want to get rid of a service entirely, so it no longer shows up in the list in the Services view of the Keyboard preference pane or in Services Manager, Control-click it in either, and choose Show in Finder/Reveal in Finder. For services that are Automator workflows, the ~/Library/Services folder will open, and you can just move that service to the trash (Services Manager also has a Move to Trash command in its contextual menu). But for services provided by apps, choosing Show in Finder identifies the app containing theservice, and the only way to eliminate the service is to delete the app. You also can’t delete services built in to OS X.
Adding More Services — OS X ships with quite a few services, but if you want to expand the number of services in your Mac’s repertoire, the good news is that you often don’t have to do any extra work to install them, since many come with apps. Here are just a handful of apps that include their own services: BBEdit, Ember, Evernote, GraphicConverter, Nisus Writer Pro, TextExpander, Scrivener, Twitter, and Vox. There are undoubtedly hundreds or even thousands more.
Unfortunately, it’s easy to end up with services that are broken, due to having been installed by old or obsolete apps. For instance, I discovered an Open with Pixelmator service, which was exciting because Pixelmator is my second-favorite image editor (after Preview). Sadly, Pixelmator’s service doesn’t work, but I’ll explain how to work around this.
You can also download and install standalone services. One of my favorites is DEVONtechnologies’ free WordService package, which includes a slew of useful services for working with text, things like changing the case of selected text, inserting dates, trimming lines, and showing statistics. Download the WordService package, expand the .zip file, copy the WordService app to your Applications folder, and finally double-click the WordService icon to install the necessary services. You can then enable the included services in Services Manager or System Preferences > Keyboard > Shortcuts > Services, under the Text heading.
For fans of the Markdown text markup language, Brett Terpstra (with help from Joe Workman) offers Markdown Service Tools that help you create links, format text, and even convert between HTML and Markdown.
Fussy Chicken Mac Os Download
Installing Markdown Service Tools is a bit more involved than WordService. After unzipping the package, open the MarkdownServiceTools2.12 folder. You’ll see a whole mess of services, 33 all told. To install just a few, select them, and either double-click one or press Command-O. For each, OS X asks you if you want to install it or open it in Automator. Alternatively, in the Finder, press Option and choose Go > Library, and then open the Services folder. Drag the services you want to install from the MarkdownServiceTools2.12 folder. Either way, I recommend installing only those you need and understand, because otherwise the list is overwhelming.
Make Your Own Services — If you can’t find a service you want, you may be able to make your own if you’re handy with Automator. In Automator, select File > New, and when prompted to choose a type, choose Service. The possibilities here are nearly endless, but you don’t have to memorize Joe Kissell’s “Take Control of Automating Your Mac” to get started (although it’s an excellent reference if you want to learn more).
Here’s how to recreate that aforementioned Open with Pixelmator service:
- After you’ve started a new service in Automator, search for the Open Finder Items action and drag it into the right-most pane.
- Set the Service Receives Selected pop-up menus to “files or folders” in “any application.”
- In the Open Finder Items action, choose Pixelmator (or whatever app you choose) from the Opens With pop-up menu. If you’re confused, just mimic the screenshot below.
- Save your service and give it a descriptive name. I named mine “Open with Pixelmator — Custom” to distinguish it from the broken one that ships with Pixelmator.
Now, when you select a file or folder in the Finder and open the Services menu, “Open with Pixelmator — Custom” will be an option. You can also assign a keyboard shortcut to your new service too. I set my shortcut to Command-Option-Control-P, so I can select an image in the Finder and press that hotkey to open the image in Pixelmator. Again, you can modify this simple Automator service to open selected files in any application you choose.
Services are an excellent way to tie apps together in OS X, and they’re one of OX X’s hidden treasures, a feature that too few people think about and that suffers from Apple’s benign neglect. Nonetheless, services can make you more efficient with the apps you’re already using, and for those of you who already rely on services, let me know in the comments which services you find most useful.