determine

Java - get the number of mouse buttons

Java mouse buttons FAQ: How do I determine the number of mouse buttons in a Java application?

I'm working on a Java Swing application, and I'd like to be able to determine the number of mouse buttons on the current system (Mac, Linux, Windows).

Ant FAQ: How to determine the platform operating system in an Ant build script

Problem

You're creating an Ant build script, and you need to determine the operating system the script is running on, so you can make conditional decisions within the build script. You typically want/need to do this if you're going to run tasks/targets that are different for each operating system (Mac, Windows, Unix, etc.).

Java Swing Mac FAQ: How to determine if you're running on Mac OS X alvin May 29, 2009 - 9:39am

Java Mac FAQ: How can I determine whether my Java/Swing application is running on Mac OS X, or some other operating system?

Here's the test I use to determine whether my Java application is running on Mac OS X:

How to determine the directory your Java application was started in (user.dir)

If you ever need to determine what directory your Java code is being run from (essentially the current working directory), you can get this information from the system properties, specifically the System.getProperty or System.getProperties methods.

The following line of Java code shows how to determine what directory your Java application was started in. This information is stored in the user.dir system property, which you access like this:

AppleScript tip: getting the current time

A quick note about getting the current time in AppleScript in two different formats. This command

set t to (time string of (current date))

yields something like this result (depending on the time of day):

"12:48:35 PM"

but this command

set t to (time of (current date))

yields something like this result:

46218

(That's the number of seconds since midnight, in case you were wondering.)