Вот, пожалуйста ... Не так много, чтобы сказать.Я просто переписал его, потому что не выношу грязного кода:
# 06/04/16 09:35:02
# Author: Shane Stanley
# Adapted by Christopher Stone
# Fixed & Rewritten by CJK
--------------------------------------------------------------------------------
use framework "AppKit"
use scripting additions
property this : a reference to the current application
property nil : a reference to missing value
property _1 : a reference to reference
property NSAlert : a reference to NSAlert of this
property NSDatePicker : a reference to NSDatePicker of this
property NSView : a reference to NSView of this
property NSAlertSecondButtonReturn : 1001
property NSHourMinuteSecondDatePickerElementFlag : 14
property NSTextFieldAndStepperDatePickerStyle : 0
property NSYearMonthDayDatePickerElementFlag : 224
--------------------------------------------------------------------------------
property date : missing value
--------------------------------------------------------------------------------
on run
its performSelectorOnMainThread:("showDatePicker:") withObject:{¬
NSTextFieldAndStepperDatePickerStyle, ¬
NSYearMonthDayDatePickerElementFlag + ¬
NSHourMinuteSecondDatePickerElementFlag} ¬
waitUntilDone:true
return my date
end run
on showDatePicker:params
local params
set {PickerStyle, PickerElements} to params
tell (current date) to set ¬
[dateFrom, day, its month, day, year, time] to ¬
[it, 1, 4, 1, 2015, 12 * hours + 0 * minutes]
tell NSDatePicker's alloc()
initWithFrame_({{0, 0}, {100, 100}})
setDatePickerStyle_(PickerStyle)
setDatePickerElements_(PickerElements)
setDateValue_(dateFrom)
set fittingSize to fittingSize()
setFrameSize_(fittingSize)
set View to NSView's alloc()
View's initWithFrame:{{0, 0}, {100, 175}}
View's setFrameSize:fittingSize
View's addSubview:it
tell NSAlert's alloc()
init()
setMessageText_("Pick a date and time")
setInformativeText_("Any date")
addButtonWithTitle_("OK")
addButtonWithTitle_("Cancel")
setAccessoryView_(View)
runModal()
end tell
set my date to dateValue() as date
end tell
end showDatePicker:
---------------------------------------------------------------------------❮END❯
Информация о системе: Версия AppleScript: 2.7 Версия системы: 10.13.6