Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
How would I go about saving a PDF that a URL points to to a PDF File?
The emails have links to PDF files.
I want to be able to take the URL of the link and save the refernced PDF file to a file on my hard drive.
How to retrieve attachments from e-mails via Automation
faq184-2838
The following code will detect if there are any attachments, in an e-mail and save it to a directory.
Local lcFilename,lcPath
lcPath="c:\savedattachments\"
If !Directory("c:\savedAttachments")
Md "c:\savedAttachments" && Create the directory if it doesn't exist.
Endif
oOutLookObject = Createobject("Outlook.Application")
olNameSpace = oOutLookObject.GetNameSpace("MAPI")
myAtts=olNameSpace.GetDefaultFolder(6).Items
For Each loItem In myAtts
If loItem.attachments.Count >0 && Make sure there is an actual attachment.
For i = 1 To loItem.attachments.Count
lcFilename=""
lcFilename = loItem.attachments.Item(i).filename
lcFilename = Alltrim(lcPath)+lcFilename
loItem.attachments.Item(i).SaveAsFile(lcFilename)
*loItem.Delete() && The option to delete the message once the attachment has been saved.
Next
Endif
Next
lcPdfUrl = "[URL unfurl="true"]http://www.myserver.com/MyDoc.pdf"[/URL]
lcPdfData = ReadUrl( lcPdfUrl )
if not isnull(lcPdfData) and vartype(lcPdfData)='C'
* Success! Write to a local file:
StrToFile(lcPdfData,'C:\MyPath\MyPDFFile.PDF')
endif
* OR:
llResult = ReadUrl(lcPdfUrl, .f.,.f., 'C:\MyPath\MyPDFFile.PDF')
if not isnull(llResult) and vartype(llResult)='L' and llResult
* Success!!
ENDIF