Hey John,
I don't think you've made yourself clear here.
Finding that date should be easy enough. Here's how to get the text of the page you're going to save:
------------------------------------------------------------------------------
tell application "Safari"
tell front document
set pageText to its text
end tell
end tell
------------------------------------------------------------------------------
If you have the Satimage.osax AppleScript Extension installed then the task is easy.
------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/05/04 00:30
# dMod: 2017/05/04 00:35
# Appl: Safari
# Task: Extract Text from the front page and search for a regular expression.
# Libs: None
# Osax: Satimage.osax
# Tags: @Applescript, @Script, @Safari, @Satimage.osax, @Extract, @Text, @Front, @Page, @Search, @Regular, @Expression, @RegEx
------------------------------------------------------------------------------
tell application "Safari"
tell front document
set pageText to its text
end tell
end tell
set docDate to fndUsing("Period:.*\\n(\\d{2}/\\d{2}/\\d{2} thru \\d{2}/\\d{2}/\\d{2})", "\\1", pageText, false, true) of me
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on fndUsing(_find, _capture, _data, _all, strRslt)
try
set findResult to find text _find in _data using _capture all occurrences _all ¬
string result strRslt with regexp without case sensitive
on error
false
end try
end fndUsing
------------------------------------------------------------------------------
Getting around the Save as PDF sheet is not nearly so simple, but it's doable.
------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/05/03 23:00
# dMod: 2017/05/04 22:03
# Appl: Safari
# Task: Set focus to various fields in Save as PDF Sheet and set their values.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Safari, @System_Events, @Set, @Focus, @Fields, @Save_As, @PDF, @Sheet, @Value
------------------------------------------------------------------------------
tell application "System Events"
tell application process "Safari"
tell (first window whose subrole is "AXStandardWindow")
tell sheet 1
tell sheet 1
tell text field 1 -- Save As field
set focused to true
set value to "Goofy File Name.pdf"
end tell
tell group 1
tell text field 3 -- Title field
set focused to true
set value to "Goofy PDF Title"
end tell
tell text field 4 -- Author field
set focused to true
set value to "Goofy Author's Name"
end tell
tell text field 2 -- Subject field
set focused to true
set value to "Goofy Subject"
end tell
tell text field 1 -- Keywords field
set focused to true
set value to "Keyword01,Keyword02,Keyword03"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
------------------------------------------------------------------------------
-Chris