Hello, I not good at all in Applescripting and I would like to utilize the large text display in Alfred. Also my coding is a bit sloppy... Any suggestions would be great.
I am making a workflow to convert a date into roman numeral date. Once done will be posting the finished results..
on alfred_script(q)
try
tell (current date)
set yearInt to its year
set monthInt to its month as integer
set dayInt to its day
end tell
set defaultDateString to (dayInt & monthInt & yearInt) as text
tell current application
set userDateString to text returned of (display dialog "Enter a date of the form: DD/MM/YYYY" with title "AppleScript By Christopher Stone" default answer defaultDateString as text)
end tell
if userDateString ≠ defaultDateString then
set AppleScript's text item delimiters to "/"
set {dayInt, monthInt, yearInt} to text items of userDateString
end if
on error e number n
set e to e & return & return & "Num: " & n
if n ≠ -128 then
try
tell current application to button returned of ¬
(display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
default button "OK" giving up after 30)
if ddButton = "Copy" then set the clipboard to e
end try
end if
end try
try
set RomanYear to ""
repeat with i from 1 to (count (yearInt as string))
set RomanYear to item (((item -i of (yearInt as string)) as integer) + 1) of item i of ¬
{{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}, ¬
{"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}, ¬
{"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}, ¬
{"", "M", "MM", "MMM"}} & RomanYear
end repeat
set RomanMonth to item monthInt of {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XII", "XII"}
set RomanDay to item dayInt of {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX", "XXI", "XXII", "XXXII", "XXIV", "XXV", "XXVI", "XXVII", "XXVIII", "XXIX", "XXX", "XXXI"}
set the clipboard to RomanDay & "-" & RomanMonth & "-" & RomanYear
display notification RomanDay & "-" & RomanMonth & "-" & RomanYear with title "Roman Numerles set to Clipboard" sound name "Submarine"
on error e number n
set e to e & return & return & "Num: " & n
if n ≠ -128 then
try
tell current application to button returned of ¬
(display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
default button "OK" giving up after 30)
if ddButton = "Copy" then set the clipboard to e
end try
end if
end try
end alfred_script
Much appreciated,
Bill