Author: scrando4
Script Version: 3
Minimum CoyoteMIDI Build: 562
// Get the current time and round it to the nearest half hour, will be used to show current time in input window
$time = (round (time))
$currentTimeRounded = $time - (mod $time 1800)
$currentTimeStamp = (date ($currentTimeRounded) ("dd/MM/yy hh:mm tt"))
// Setup and display input fields/input window
$timeTextBox = (textbox "Datetime" "Rounded current datetime. Can be modified to adjust timestamp" $currentTimeStamp 0.68)
$hoursToAddNumBox = (numberbox "Hours to add" "Hours to add to the above datetime" default default false 0 59)
$minutesToAddNumBox = (numberbox "Minutes to add" "Minutes to add to the above datetime" default default false 0 59)
$formatComboBox = (combobox "Format" "Discord timestamp format that will be copied to your clipboard" ("Default", "Short Time", "Long Time", "Short Date", "Long Date", "Short Date/Time", "Long Date/Time", "Relative Time") %previouslySelectedTimestampFormat 0.7)
$descriptionTextBlock = (textblock "Hover for explanation" "You can edit the datetime text box directly and/or use the number boxes to modify the timestamp. Once you close out of this popup the timestamp will be copied to your clipboard")
$values = (inputwindow "Discord Timestamp Generator" input1:$timeTextBox,input2:$hoursToAddNumBox,input3:$minutesToAddNumBox,input4:$formatComboBox,input5:$descriptionTextBlock Pointer)
// Retrieve values from input field
$hoursToAdd = ($values input2)
$minutesToAdd = ($values input3)
$newTime = (parsedate ($values input1) "dd/MM/yy hh:mm tt") + ($hoursToAdd * 60 * 60) + ($minutesToAdd * 60)
// Retrieve format to make timestamp and save selected format for future uses
$format = ($values input4)
%previouslySelectedTimestampFormat = $format
// Set default to just the epoch in case the user somehow selected an option not in the combobox
$formattedTime = $newTime
switch $format
case "Default"
$formattedTime = ""
case "Short Time"
$formattedTime = ""
case "Long Time"
$formattedTime = ""
case "Short Date"
$formattedTime = ""
case "Long Date"
$formattedTime = ""
case "Short Date/Time"
$formattedTime = ""
case "Long Date/Time"
$formattedTime = ""
case "Relative Time"
$formattedTime = ""
// Set user's clipboard so the discord timestamp is ready to paste
setclipboard $formattedTime
9 downloads