Numeric month by providing Text Month

Hey all,

objective:
¢ enter “April or May or June or etc” and find out “4, 5, 6, or etc.”

This works but can’t dynamically specify the month:


set month of (current date) to July * 1

But how can I specify the month more dynamically. The script before this line of code outputs a month based on a user’s input. So the month can be anything from January to December.

TIA

You don’t say what you want to do with it, but month names are key words, so this works as a brute force approach:

set theMo to (choose from list {January, February, March, April, May, June, July, August, September, October, November, December}) * 1

Alternatively, this strange coercion:

set theMo to (month of date (text returned of (display dialog "Please enter the name of a month" default answer "September"))) * 1

or

set theMo to (month of date (text returned of (display dialog "Please enter the name of a month" default answer "September"))) as integer

I would like to find out the numeric month of the Text Month (January, February, March, April, May, June, July, August, September, October, November, December) without specifying it in a brute force if possible.

I receive the specified month through the dialog box. Say “December” and I would like the script to return back “12” for the numeric month.

thanks hope that clarifies.