A simple use of Applescript to get PID (unix id of processes ) and kill one Application if another is not running.
But heres a better example..
Close Duplicate finder windows
Macosxhints Posted a Applescript hint on Macosxhints to close duplicate finder windows.
The idea of the script is sometimes you may find you have multiple finder windows open. Many of them leading to the same target (folder). And want a quick way of closing all the duplicate windows.
But I couldn’t understand why it was so long and complicated. So as an excise for myself wrote one that did a similar job
Get Finder window Path.
I had already wrote some code for an application that could get the path of open Finder windows.
So when I saw a member on Apple Stack Exchange wanted to get the top level finder window’s path.
I thought it would be simple to throw together something using part of the code in writing a new Automator Action.
The Action Get first Finder Window Path. Will return the Posix path of the front most open Finder window.
First download the Action
|This is for 10.9.x v103- Action is now placed in Files & Folders in the Automator library|
|This is for System : 10.8|
|This is for System : 10.6|
1, Open the zip and install it by double clicking on the action.
It will go into the Utilities Actions name ‘Get first Finder Window Path’
2, drag it as normal to the workflow area and add for example the ‘Copy to Clipboard’ action below it
I guess thats how many may feel when they are looking at the first ever blank page of their first ever blog.
I never thought I would be one of them. You know bloggers..
And in truth I am not. I think..!
Bizarrely I am just looking for a cheap way to get a download or page view counter for any apps, scripts etc. I share on the internet. Just so I can gauge interest.
I know, right! whats this got to do with blogging.
Over the years I have written a lot of Applescript to help me and my colleagues do our daily jobs. But as time has gone on, the scripts have become organic in nature. Growing and becoming more complex. Mainly to cope with changes to workflows, Mac Os or portability to new areas.
So I have been rewriting a lot of them as cocoa application. And leaning (very slowly ) objective -c as I go along.
My quest to learn has a long way to go. I do have a couple of books that I keep meaning to get on with.
But I always seem to need to jump into the fray and write some urgent code that is beyond where I am in the books.
I fear this may be leading me into bad habits with the way I code.
One of the best ways I find I learn is to have an on going task. Rather than read through books.
So although I strive to do the aforementioned above. I also like to look at questions on fora (forums) like AppleStack Exchange ,StackOverflow [Objective -c ] MacosxHints and see if I can solve some of the issues for myself.
I have posted some answers up on them. Not many and probably not that great so don’t get exited.
So part of my quest is to slow down and do the basics of Objective – c and keep my hand in with Applescript.
Lastly, I have been wanting to have a place to put up bits and pieces of code snippets, apps etc. This Blog may be it. We will see.
Wish me luck..