gpt4 book ai didi

http - AppleScript 从 HTTP 服务器下载文件,改变 URL?

转载 作者:可可西里 更新时间:2023-11-01 16:22:28 24 4
gpt4 key购买 nike

我从来没有弄乱过 AppleScript,所以这对我来说只是一个概念。这行得通吗?

游戏设计师 Bungie 在系统命名的文件和目录中为 Halo Reach 托管了大量 PNG。即:

http://www.bungie.net/images/reachstats/commendations/onyx/onyx_large_precision_multiplayer.png

改变同一个词的两个实例,你会生成另一个版本的图像。将“onyx”更改为“iron”、“bronze”、“silver”或“gold”,您将获得相应的图像,如下所示:

http://www.bungie.net/images/reachstats/commendations/gold/gold_large_precision_multiplayer.png

AppleScript 是否能够获取输入的 URL,查找并更改 URL 中单词的实例,然后将相关文件下载到目录中?今天是我的生日(10 月 27 日!因此是 XXVII),如果这行得通,如果有人能做到,我会非常兴奋!

感谢您的热心回答!

最佳答案

这个有效:

set the destination_file to ((path to desktop as string) & "picture.jpg") as file specification
set thisImageSRC to "http://www.bungie.net/images/reachstats/commendations/gold/gold_large_precision_multiplayer.png"
tell application "URL Access Scripting"
download thisImageSRC to destination_file replacing yes
end tell

字符串操作完全通过更改 Applescript 的文本项分隔符来完成。因此,要将 URL 的组件放入列表中,您需要执行以下操作:

set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set theUrlComponents to (every text item of theURL) as list
set AppleScript's text item delimiters to oldDelims

加盐调味,但我同意第一位评论者的观点,即有更好的语言可以做到这一点。 Applescript 将是我最后的选择。

关于http - AppleScript 从 HTTP 服务器下载文件,改变 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4033360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com