Search posterous

Search all posts and users. Type a name, type a favorite song title, whatever! See what comes up.
  

More posterous blogs











More recommended blogs »

Here are posterous posts filed under applescript...

Moritz Z. says...

This is the first release of an AppleScript that frees you from window cluttering by cascading all open windows - even the ones minimized to the dock - exactly the same way across all open and visible applications. You can configure the width of the windows and exclude apps from being touched by changing the properties in the header of the script. Let me know if you like it. Have fun - and focus ;) - Moritz

Click here to download:
Cascade_All_Windows.scpt (18 KB)

[Tested on Mac OS X 10.6.2 with one or two screens attached.]

Filed under: AppleScript

Moritz Z. says...

The previous version of my script unfortunately lead to an error, if the corresponding hidden preference flag was never set before; The attached version should fix this. Thanks for reporting the issue - and hopefully it works on now. See the older post for further reference.

Click here to download:
Single_Mode_Switcher.scpt (7 KB)

Filed under: AppleScript

Moritz Z. says...

Inspired by Lewis Butler's post this script switches Mac OS X's single-application mode on or off. Use Growl for notification and LaunchBar, FastScript or QuickSilver for shortcuts and - focus! 

Update 21.10.09: The updated version should fix the issues reported today.

Filed under: AppleScript

Leonieke says...

Even though I should have gone to bed over an hour ago, I could not help but keep looking for a quick way to display my current iTunes track information in an IRC channel via MacIrssi. With all the updates for Snow Leopard, I kept seeing odd messages (and even odder coding).

A quick how to on AppleScript, combined with an adobe.com forum help page and I managed to create my FIRST AppleScript.

-- small script to use for displaying iTunes track+artist+album wherever you open an applescript

-- when iTunes is running

tell application "iTunes"

if player state is playing then

-- get track, artist and album

set currenttrack to the name of current track

set currentartist to the artist of current track

set currentalbum to the album of current track

-- show track, artist and album

set titleinfo to (currenttrack & " - " & currentartist & " | " & currentalbum)

set output to titleinfo

end if

end tell

 

[save as nameofscript.scpt or copy from : http://pastebin.ca/1581948]

Combine this with a simple command line for MacIrssi (or irssi, for the purists):

/exec -out arch -i386 osascript /Users/username/locationofscript/nameofscript.scpt

 

Good luck!

Filed under: AppleScript

obleo says...

 
I came across this video today. And felt it was worthy of posting about. Most people that read this blog, most likely already know this stuff. But then maybe not.
 
Back in 2006 I meet Sal at the Apple Developer, Leopard Tech Talks in Chicago. The guy is good, very good. And he can show you how to do just about anything. Even stuff, you didn't realize you could do.
 
The 45 minute video is located at macosxautomation.com web site. And is worth watching even if you think you know it all. This guy can easy show how your scripts can be optimize to work so much better.
 
Head over to the mac osx automation web site. link below and watch it.
 
Find it on this page on rightside box (Quicktime icon, check that) @ http://www.macosxautomation.com/applescript/firsttutorial/index.html

Filed under: AppleScript

Jacek says...

[ re-posted for archival purposes ]

I wrote another AppleScript job to help you. It copies the URL of the page you are looking at in Safari to a TextEdit document.

-- Copy the URL of the active tab of the frontmost
-- Safari window to TextEdit. Creates a new document,
-- if necessary.
-- Copyright (c) 2008 Jacek Artymiak

tell application "Safari"
  set theURL to URL of current tab of front window
end tell

tell application "TextEdit"
  if not (front document exists) then
   make new document
  end if
  set theDocument to front document
  set theText to text of theDocument
  set theText to theText & theURL
  set text of theDocument to theText
end tell

BTW. The same functionality might be available via Services, but clicking on a script icon is more convenient.

Filed under: applescript

Jacek says...

[ re-posted for archival purposes ]

I live on (and off of) the UNIX command line, therefore using AppleScript is a bit of a mixed-bag experience for me. I’ve been using it since 1994, I think, but I have never grown to love it. It’s not the language that’s at fault but the spotty support for it. Still, it is decent enough to be useful, at least for some tasks. One of these is sending files to a pre-defined email address.

-- This script sends the file you select in
-- the file selection dialog to a pre-set
-- email address
-- Copyright (c) 2008 Jacek Artymiak

set theSubject to "Another File Forwarded from my Mac"
set theContent to "I'm forwarding this file from my Mac "
set theName to "Change this to the real recipient's name"
set theAddress to "you@example.com -- change this to a real destination address"
set theFile to choose file

tell application "Mail"
  -- we need to check for new mail to 'wake up' Mail,
  -- otherwise it will not send our message
  check for new mail

  -- here we set up our message 

  set theMessage to make new outgoing message with properties
{visible:false, subject:theSubject, content:theContent}
  tell theMessage
   make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
  end tell
 
  tell theMessage
   make new attachment with properties {filename:theFile}
  end tell
 
  -- cross your fingers, we're about to send our message
  send theMessage
end tell

Why not use the Automator? I tried, but for some reason I get strange errors. The example above works and forwards dozens of files daily to my project email account.

Filed under: applescript

macgeeky says...

Slett filer og mapper med snarvei i OS X uten at de havner i papirkurven - dette gjør du med hjelp av en applikasjon som heter 'Spark' og et applescript som allerede er skrevet ferdig for deg.

Du finner Spark her: http://bit.ly/slett

Du finner Applescriptet her: http://bit.ly/permdeletes

Følg guiden, kommenter, legg til som favoritt og abonner gjerne på mine videoer her på Youtube.

Følg @macgeeky på Twitter for flere tips og guider - http://twitter.com/macgeeky

Filed under: applescript

23narchy says...

TweetMyMac: Remote control of your Mac via Twitter

by Aron Trimble (RSS feed) on Sep 2nd 2009 at 3:00PM

Important safety tip: Please read the instructions for TweetMyMac carefully, especially the part about creating a separate Twitter account for your Mac -- do not use your regular Twitter account, or anyone you follow will be able to control your machine.

We have previously covered some of the ways in which it is possible to remotely control a Mac at home or in the office. Most of our suggestions have required the use of Mail in order to process some rule and kick off a script or Automator action.

Alex P over at TheMacBox aims to change all of that. Enter TweetMyMac, the little program that lets you get screenshots, iSight snapshots, or launch a program through the use of Twitter. While the list of commands available is not currently as comprehensive as what your imagination can create with a little AppleScript or Automator whizzbangery, it is a good list and growing as well.

An obvious benefit of this approach is the ease of getting everything set up. In the past it took an AppleScript to call another Automator action or some other kludgey-at-best method to get things working. With TweetMyMac there is very little effort required for setup.

Another neat feature is that TweetMyMac will run a shell command. With a little scripting you can create your own custom commands. And using the previously-covered technique of sending tweets via the command line you can have your custom commands send information back to you as well.


In my experience the software does have a few bugs/quirks, but that is to be expected with a beta release. One of the niggles I ran into was that the commands have to be exact. For example, sending "what is my ip?" will not be processed whereas sending "ip" will be processed as expected. It tripped me up a few times and from a user-experience perspective it would be nice to be fixed, but from the developer's point of view I can see the difficulty in coding around the whims of users.

I was also not able to get the screenshot command to work from my Mac mini, but in talking with the developer it seems to be an isolated incident. The other issue I hit was that the same command would not be processed twice in a row. Alex has been a big help and it is obvious that getting this app working well is important.

You can check out the list of available commands over at TweetMyMac's homepage. TweetMyMac is currently in beta and available for free, but donations are welcome because developers like to eat too. Do you have any other remote Mac automation tools that you use? Shout out in the comments, because I know I'm always looking for ways to wrangle my home server into line.

[Via Lifehacker]

 

Filed under: AppleScript

obleo says...

There is many false rumors going around that scripting additions will not work in snow leopard (OSX10.6). This is completly untrue. There is a simple addition that one needs to make because AppleScript and osascript run in 64-bit mode by default (on hardware that supports it).  

If your using an older 32-bit scripting additions. You can force applescript to run in 32-bit mode by adding the shell command:

arch -i386 osascript 32-bit-only.scpt

Filed under: AppleScript