Rename Screen Shots AppleScript

Working in a support role means I spend alot of time using the built in OS X screen capture facilities, which generally means I end up with hundreds of Screen Shot ****.png files scattered all over my desktop.

Today I started working on the AppleScript below, which I have set as a folder action on my default screen capture folder.

It’s far from complete, and is definitely a current project, however I thought I’d share it at each stage.

To change your default screen capture directory, launch terminal and run the following command

defaults write com.apple.screencapture location /screencapturepath/;killall SystemUIServer

Would you do it differntly? Have an improvement to suggest? Drop me a note below.

Read More

Bulk folder rename AppleScript

I was recently approached by one of my blog readers John Ott, to help out with a bit of a technical challenge he had. John used a fairly complicated filing system for keeping track of lots of documents, blue prints and photos for projects him and his team work on. This included many subfolders with deep subfolders following a strict naming convention. When John starts a project, he used to copy and paste his top-level folder, then work his way through all its subfolders updating the folder names with the new project code. John reached out to me to see if I could help out, so I put together this Bulk folder rename AppleScript which takes user input for source and destination folders and the latest project code, it then traverses the folders and their subfolder and updates the names as required.

You can download a zipped up copy of the above script by clicking 

.

If you’ve a project and you’d like to see if I can help, get in touch using my Contact Form.

Read More

How to monitor a folder for changes

OS X comes with somewhat of a hidden feature straight out of the box. That’s the ability to fire AppleScripts on folder actions. Those actions could be anything from files being added, changed or deleted from a folder.

This can be handy if you need notification of when a file has finished downloading or need to rotate log files etc.

AppleScript is a powerful language, which to the beginner may even seem quite daunting. Luckily there’s a script all ready and waiting which notifies you of folder changes.

To switch on this feature, navigate to the folder you’d like to monitor. Now pull up the context menu (right click) and select folder actions setup.

Folder Actions

 

From here select the ‘add – new item alert.scpt’

Add Item

Once added, you have the opportunity to modify the Apple Script should you wish. If you are happy with the notification popup, simply close down the open windows and wait..

That’s all there is to it really, if you need something a little more advanced, you’ll have to break open the AppleScript editor. Or post a response below, and I’ll post a tutorial on how to do what you need!

Read More

Send an iMessage with an AppleScript

I don’t like waiting around for long processes to finish on my Mac, so I was recently hunting for a way of sending push notifications to my iPhone/iPad.. I gave up after a while, realising that nothing seemed reliable enough.. So then I changed tact, and that’s when I came up with this AppleScript. This uses OS X’s built in message’s app to send an iMessage to my mobile!

tell application "Messages"
	set intid to get id of first service
	set myRecipient to myRecipient "+44123456789" of service id intid
	send "Your full machine backup has now completed" to myRecipient
end tell
tell application "Messages"
	quit
end tell

This could quite easily be built into Automator Workflows etc.

Read More

Unhide the Library folder in Finder – AppleScript

By default the ‘Library’ folder is a hidden folder in OS X Finder. However, if you need temporary (GUI) access you can use this simple AppleScript below to remove the ‘hidden’ flag from the folder.

tell application "System Events"
	set libvis to (get visible of folder "~/Library")
end tell

if libvis = false then --~/Library is currently invisible
	tell application "System Events" to set visible of folder "~/Library/" to true
else --~/Library is visible
	tell application "System Events" to set visible of folder "~/Library/" to false
end if

This script could also be easily amended to show and hide any folder of your choice, simply by replacing the ~/Library/ with the path of the folder you’d like to toggle.

Read More