Created
January 27, 2025 22:47
-
-
Save WebDragon/238720f895a26f589ce17f54b8a6d4c8 to your computer and use it in GitHub Desktop.
Generate a list of table/booth seatings for copy-paste via macros into a ticketing system for valentines day week so as to ease the burden of data entry by pre-generating the repetitive bits along with the changing ones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# MakeBoothDates - Scott R. Godin for MAD House Graphics | |
# generate booth/table text for hand-copying laboriously into the somewhat archaically designed | |
# bentobox ticket information options | |
use warnings; | |
use strict; | |
use v5.16; | |
use Getopt::Long; | |
use Try::Catch; | |
my (@types, $day, $year, $dt, $dt_end) = ("Table for two", "Booth for two"); | |
use DateTime; | |
use Lingua::EN::Numbers::Ordinate; | |
GetOptions( | |
"day|d=i" => \$day, | |
"year|y=i" => \$year, | |
) | |
or die("Error in command line arguments\n"); | |
die("'$day' is not a day-of-month number\n") | |
unless $day =~ /^\d{1,2}$/ and (( $day >= 1 ) and ( $day <= 31 )); | |
try { | |
my $test = DateTime->new( year => $year); | |
} | |
catch { | |
die("'$year' is not a valid year."); | |
}; | |
$dt = DateTime->new( | |
year => $year, month => 2, day => $day, | |
hour => 16, minute => 0, | |
time_zone => "local" | |
); | |
$dt_end = DateTime->new( | |
year => $year, month => 2, day => $day, | |
hour => 22, minute => 30, | |
time_zone => "local" | |
); | |
sub datestring { | |
my $datetime = shift; | |
my ($month, $ordinal_day, $year, $hour, $min, $meridian) = | |
( | |
$datetime->month_abbr, | |
ordinate( $datetime->day ), | |
$datetime->year, | |
$datetime->strftime("%I"), | |
$datetime->strftime("%M"), | |
$datetime->strftime("%P"), | |
); | |
return "$month $ordinal_day, $year $hour:$min$meridian"; | |
} | |
while ( $dt <= $dt_end) { | |
print (datestring($dt) . " $_\n") for @types; | |
print "\n"; | |
$dt->add( minutes => 30 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works along the lines of
which then can be used in a macro that copies the line, alt-tabs over to the input fields, pastes the line, tabs to the next field, enters the count of how many tickets are available for that seat, tabs to the next field, and enters the ticket price for the table (or booth, using a 2nd but equivalent macro on a different keystroke)
when you have dates from the 13th to the 22nd to enter individual seatings and prices from 4pm to 10:30pm, you do whatever you can to ease that data-entry burden, when you're stuck with a system you can't improve and still need to code your way around the tedium to stay awake long enough to finish the job. :-D