set OriginalURL to "" as Unicode text
set thePath to "" as Unicode text
set pathAns to "" as Unicode text
set binPath to "" as Unicode text
set CombinPath to "" as Unicode text
set OriginalURL to "" as Unicode text
set UserDesktop to "" as Unicode text
set Savepath to "" as Unicode text
set nowTime to my DateAndTIme(current date)
set PdfFileName to nowTime & ".pdf" as Unicode text
tell application "Finder"
activate
display dialog "PDFを作りたいURLをペーストしてください" default answer the OriginalURL buttons {"PDFを作成する", " 終了 "} with icon 1 with title "PDFをペーストしてください" default button 1
copy the result as list to {the OriginalURL, BottPressNo}
set ReplaceText to the OriginalURL as text
end tell
set thePath to path to current application as string
set pathAns to thePath as Unicode text
set binPath to pathAns & "Contents:bin:wkhtmltopdf" as Unicode text
set CombinPath to POSIX path of binPath
set UserDesktop to the path to desktop from user domain as Unicode text
set Savepath to the POSIX path of (POSIX path of UserDesktop)
set ComLine to CombinPath & " " & ReplaceText & " " & Savepath & PdfFileName
with timeout of 60 seconds
do shell script ComLine
end timeout
to DateAndTIme(theDate)
set y to (year of theDate)
set m to my monthNumStr(month of theDate)
set d to day of theDate
set hms to time of theDate
set hh to h of sec2hms(hms)
set mm to m of sec2hms(hms)
set ss to s of sec2hms(hms)
return (y as text) & my zero1(m) & my zero1(d) & "_" & zero1(hh) & zero1(mm) & zero1(ss)
end DateAndTIme
to monthNumStr(theMonth)
set monList to {January, February, March, April, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if item i of monList is theMonth then exit repeat
end repeat
return i
end monthNumStr
to zero1(n)
if n < 10 then
return "0" & n
else
return n as text
end if
end zero1
to sec2hms(sec)
set ret to {h:0, m:0, s:0}
set h of ret to sec div hours
set m of ret to (sec - (h of ret) * hours) div minutes
set s of ret to sec mod minutes
return ret
end sec2hms