The first part - prompting the user - is trivial. The tricky part is parsing the input to understand the date/time since there are so many possible formats. Since you're on El Capitan you can use Apple Data Detectors to do that part.
Once you have a date you can sit around idle until the specified time. You probably want/need to add some boundaries, so make sure you're not sitting around waiting for some date years in the future.
This is a first-hack at the idea, using Shane Stanley's solution for Data Detectors to parse the date.
It uses a tacky 'delay' approach to pause the script until the specified time - there are other (better?) solutions which you might want depending on what kind of time intervals you're expecting (are you expecting days? hours?)
set theStr to text returned of (display dialog "when?" default answer "2:30pm")
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
set theDate to my getDatesIn:theStr
-- convert the input to a date object
considering numeric strings
if AppleScript's version < "2.5" then
set theDate to my makeASDateFrom:theDate
else
set theDate to theDate as date
end if
end considering
-- now we have the date, so work out how far away that is
-- first sanity check for past dates
set curDate to (get current date)
if curDate > theDate then
-- user entered a date in the past
display dialog "Can't travel back in time, sorry."
return
end if
-- now work out how far forward this is
set timeOffset to theDate - curDate
if (timeOffset > (2 * days)) then
-- too far in the future
display dialog "Sorry, that's too far in the future"
return
else
-- if we get here we know how far to delay
delaytimeOffset
tell application "iTunes" to play
end if
on getDatesIn:aString
-- convert string to Cocoa string
set anNSString to current application'sNSString'sstringWithString:aString
-- create data detector
set theDetector to current application'sNSDataDetector'sdataDetectorWithTypes: (current application'sNSTextCheckingTypeDate) |error|: (missing value)
-- find first match in string; returns an NSTextCheckingResult object
set theMatch to theDetector'sfirstMatchInString:anNSStringoptions: 0range:{0, anNSString's|length|()}
if theMatch = missing value then error "No date found"
-- get the date property of the NSTextCheckingResult
set theDate to theMatch's|date|()
return theDate
end getDatesIn:
-- required before 10.11
on makeASDateFrom:theNSDate
set theCalendar to current application'sNSCalendar'scurrentCalendar()
set comps to theCalendar'scomponentsInTimeZone: (missing value) fromDate:theNSDate-- 'missing value' means current time zone
tell (current date) to set {theASDate, year, day, its month, day, time} to ¬
{it, comps's|year|(), 1, comps's|month|(), comps's|day|(), (comps'shour()) * hours + (comps'sminute()) * minutes + (comps's|second|())}
return theASDate
end makeASDateFrom: