如何自动从不同位置下载多个 PDF 文件(AppleScript 或 JavaScript)
我每周必须分析大约 30 个促销商店文件夹。如今,我已经熟记在哪里可以找到 HTML 文件夹,但我仍然必须重写每个位置手册中的 URL,我希望将其自动化。
我只能使用 AppleScript,或者可能是 JavaScript(在我的 MobileMe 托管上,没有 PHP eo。)
在 URL 中,有一些变量:
http://store.website.com/[store]/[region]/[date]NL/[store]_[region]_[date]NL.pdf
我希望它像这样工作:
A from 或dialog which请我告诉
a.商店:[填写商店];
b.地区:[填写地区];
c.日期:[填写日期]。下载文件并保存在我的计算机上的
//special/path
上。
我是 AppleScript 和 JavaScript 的菜鸟,但我无法使用 PHP/ SQL,所以我希望有人可以帮助我展示其他一些方向。
I have to analyse about 30 promotional store folders every week. Nowadays I know where to find the folder HTML by heart, but still I have to rewrite the URL from every location manual, which I'd like to automate.
I only have the ability to use AppleScript, or possibly JavaScript (On my MobileMe Hosting, no PHP eo.)
In the URL there are some variables:
http://store.website.com/[store]/[region]/[date]NL/[store]_[region]_[date]NL.pdf
I'd like to have it work like this:
A from or dialog which ask me to tell
a. Store: [fill in Store];
b. Region: [fill in region];
c. Date: [fill in date].Download file and save on
//specific/path
on my machine.
I'm a noob with AppleScript and JavaScript, but I'm unable to use PHP/ SQL, so I hope someone can help me showing some other directions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AppleScript(下载到您的桌面):
AppleScript (downloads to your desktop):
安妮给了你一个很好的剧本,但我认为你可以自己轻松做到这一点。我假设商店始终与区域和网站相关联,因此您可以将此信息输入到脚本中,然后您可以从列表中选择它,而不是每次都输入它。
因此,您需要创建包含该信息的记录列表。我在脚本顶部的 storeRegionRecord 中为您输入了 4 个示例。您还需要在 downloadFolder 变量中输入要下载文件的文件夹路径。
以下是您按照说明输入信息后脚本的工作方式。将弹出一个对话框,您可以在其中选择一个或多个要下载的商店/地区/网站组合。如果某个日期适用于其中多个,您将选择多个。按住 Shift 键单击或按住 Command 键单击可在对话框中选择多个。然后会弹出第二个对话框,您可以在其中输入特定日期。重复循环循环遍历您选择的商店/区域/网站,并将每个 pdf 文件下载到下载文件夹,并按照 Anne 在代码中建议的方式命名下载的 pdf。
我希望这有帮助...
Anne gave you a good script however I figure you can make this very easy on yourself. I'm assuming that a store is always associated with a region and website, therefore you can enter this information into the script and then you can just choose it from a list instead of typing it in every time.
As such, you need to create a list of records with that information. I entered 4 samples for you in the storeRegionRecord at the top of the script. You also need to enter a folder path in the downloadFolder variable where the files should be downloaded.
Here's how the script works after you enter the information as explained. A dialog pops up where you can choose one or more store/region/website combinations to download. You would choose more than 1 if a date would apply to several of them. Shift-click or Command-click to choose more than 1 in the dialog. Then a second dialog pops up where you enter the particular date. A repeat loop cycles through the store/region/websites you chose and downloads each pdf file to the download folder, naming the downloaded pdf as Anne suggested in her code.
I hope this helps...