0

感谢 Stack Overflow 上人们的帮助,我正在使用Applescript开发一个庞大的程序,但我在创建新文件夹的部分卡住了,我正试图将 2 个 illustrator 文件移动到其中。通常这不会是一个问题,因为我在用“选择”选择它们之前已经移动了文件,但是这次我没有选择它们,我只有带有完整路径的变量。

所以我的问题是如何使用它们的完整路径移动这两个文件? 我可以以某种方式将变量操纵成更易于管理的格式吗?

这是代码不起作用的部分(完整的东西很大,但如果需要,我可以发布它)以及变量从哪里获取值的一些片段

 set saveLocation to ((path to desktop) as string) --place to save the files
 set theFile to choose file --choose .ai file to get outlines on
tell application "Finder" to set fileName to name of theFile
set fullPath to (saveLocation & fileName) --file path of new .ai

make new folder at saveLocation with properties {name:(text 1 thru ((length of fileName) - 3) of fileName)}
tell current application
    set newFolder to POSIX path of saveLocation
    set newFolder to newFolder & (text 1 thru ((length of fileName) - 3) of fileName)

*--set newFolder to choose folder* -- I tested to see if manually selecting the new folder helped, it didn't

 move fullPath to newFolder

我非常感谢任何帮助,在此先感谢

4

1 回答 1

1

很简单,把make文件夹设置成一个变量,以后调用。看起来像这样:

tell app "finder" --need to use Finder to move files
    set somevariable to make new folder at saveLocation with properties {name:(text 1 thru ((length of fileName) - 3) of fileName)}
    move file fullPath to folder somevariable
end tell
于 2014-05-12T19:02:16.273 回答