I worked a little more with automator (when I should have been studying regression analysis)… and have come up with a cool new automator. This incorporates an undocumented aspect of automator, so it took some trial and error to figure out. Basically, I wanted something that would allow me to turn a request to view a man page into a pdf file for easy printing and viewing in the gui side of Mac OS X. Only a unix geek could love the man page as it is… for unix newbies though, it can be quite frustrating. Personally, I am use to man pages, but I still like to print some out now and then and converting them to pdf allows me to access them without opening terminal (not that you wouldn’t probably have terminal open anyway).
So I wanted to find a way to make a man page into a pdf. Of course you can do this from the terminal, but where’s the fun in that (plus you have to remember the commands each time you want to do this). There is a free GUI utility called ManOpener that allows you to view man pages easily as well, and is much more featured than this automator tool. But if all you want (as I did) was a man page made into a pdf, then this is what you need to do;
- Open Automator, from the Library column select TextEdit. From the actions drag “Ask for Text” over to the workflow area.
- In the question field type “Enter man page name?” or something to indicate what you need to enter
- You can leave the default field empty or enter something that will serve as a reminder of what to enter
- Check the require answer box
- Next, from the Library column select Automator, then from the actions drag over the “Run Shell Script” to the workflow after the previous item. Type or copy & paste the following as one line, modifying the paths so that they point to your preferred locations (include the quote marks this time);
man -t $@ > /hardrive/Users/Shared/manpages/$@.ps | echo -n “harddrive:Users:Shared:manpages:”$@”.ps”
Set the “Pass Input” to “as arguments”
Note: The $@ takes the value entered in the “Ask for Text” and runs it as a shell command. The first part which calls the man page then passes it to a postscript file named with the name of the man you are looking for, then it echoes out the path to the next function. The echoed path has to be in the style of the Mac OS drive path reference which uses “:” instead of slashes “/”.
- Last select Finder from the Library column and drag “Open Finder Items” to the workflow in the last place. Set the “open with” field to the Preview application. The path passed from the previous action will be opened in Preview converting it into a pdf.
You are ready to test, click the run arrow and try it out. If everything works, the requested man page will be open in Preview at this point. You can either save it or discard it after use. You can get fancy and do things like check for existing ps files or remove the ps file after it is converted. But this gives you the idea of what fun you can have with automator and how it can make working with unix fun. Be sure to save your workflow and make it readily accessible on your dock or wherever you like to put things to be accessed often.
When I first heard about Automator it sounded cool, but I wasn’t sure what I could use it for personally. After I had upgraded to Tiger, I got around to looking at automator and to be honest, I didn’t see anything that would really help me. I looked at the sample workflows and there was nothing that applied to my everyday or even once in a while tasks.
However, the other day I was in need of combining a couple of pdf files. I knew there was a way to do this in Mac OS X, so I set about searching the internet. I thought I had seen a terminal command process to combine pdfs, but I found instead some instructions on how to do it with automator. So I am posting here in case the reference gets lost from somewhere else…
- First open Automator, select Finder in the Library and drag “Ask for Finder items”, check the multiple option.
- Then select PDF in the Library and drag “Combine PDF Pages” set to Appending pages
- Then go back to the Finder listing in the Library and drag the “Rename Finder Items” set things the way you would like here
- Then drag a “Move Finder Items” and set it to where you would like the new file to end up
Save your workflow and then run it. Pretty cool. Other variations could substitute Get Folder Contents for step 1. Then you can just drop files you want to combine into that folder and run the command. You can include the Sort Finder Items to change the order the pdf files are combined (or you could just rename them in the finder). Now that I have a taste and feel for what Automator can really do, I have something else to play with/do in my non-existant free time. Here is the forum where I found this http://www.macosx.com/forums/showthread.php?t=239682.
My current workplace wants to get started doing podcasting. So I am setting up a podcast rss file. The unique thing here is that it will be dynamically updated. The audio will be saved to the server automatically. Then a script I am writing will check the directory for the 30 most recent files and then pull from a database a title and a description/summary that is entered by the production staff. All of this will be formatted into a rss feed that is usable by iTunes or other podcast aggregating software.
Today we basically stay home doing nothing. I write some of these stories and later in the day we visit my father-in-law in the hospital. He will have some more tests because he is suffering from nausea after the surgery. And will be in the hospital at least a few more days. I am sure he would really like to go home. He must be worried about the company too, as he basically worked 7 days a week. We stay only a short while as that is all the kids can handle. So I will write a little more about everyday things in Japan in the rest of this post.
Today we go to Ebina city to meet with a friend of my wife’s. She has not seen her since highschool. I am not sure how they got in contact, but she has a baby about the same age as my daughter. So we go to Ebina station, where there is also a shopping area. In Japan most if not all train stations have major shopping areas around them. It is hot and humid in Japan this time of year and fairly uncomfortable to be outside. The mall is crowded and the original restaurant/cafe they planned top meet at is packed. So we find an outdoor place which would be nice but it is hot and humid. We haven’t eaten lunch so we order from the 4 items on the menu. It was not bad but quiet expensive and they had no cola, so I had a bitter ice coffee which I could not make any better by adding sugar.
After checking out of the hotel, we grab a quick lunch from a combini… convinience store which are just about everywhere in Japan. There is of course 7-eleven, but there are others I have only seen in Japan… Family Mart, Lawson’s, Sunkus, Star-heart-Circle (that’s the picture on their sign), Ministop and there is a new one since my last visit called Shop 99+. The convenience stores are not much liked by Japanese, but they are so convenient, that many people use them. The prices are high, and the food is not the freshest, but still better than airline food. And when I say they are everywhere, I mean everywhere. You can find a combini every other block in most populated areas. And even in the rural areas, there will be at least two or three combini every 2km or so.
The flight to Japan went well for me and so we disembark from the plane. On previous trips we got off the plane onto the tarmack, but this time we are at the gate and so it is just a short walk to the immigration line. Which then takes 45 minutes to wait through. Finally my turn comes and it is a few anxious moments for the officer checking the database and my passport is stamped and I am out. Then on to pick up baggage. Narita airport has free carts to use, so if you have much luggage you can grab one of those and head to the claim area. Signs are big and clear and it is open, much easier to navigate than O’hare in Chicago. By the time I get to the claim area all the luggage is off of the converyor and sitting on the floor. Being as far back on the plane as I was, I am one of the last to make it through. It is frustrating, but I only have one bag and then it is off to customs, which is just at the edge of the claim area. Nothing to declare and so it is only a short moment and I am through. The exit is right there and I see my family almost right away.