2014-06-19 346 views
0

我試圖將用戶選擇的文件夾移動到另一個文件夾,但我不明白:每當我查看它時,它看起來太複雜了,即使我知道它是不應該是。將一個文件夾移動到另一個文件夾 - applescript

這裏是我到目前爲止的代碼 - 請幫忙:

choose folder with prompt "Select folder:" 

on open of finderObject 

    tell application "Finder" to move (finderObject) to folder "Library:Application Support" 

end open 

end 
+0

可能的重複:http://stackoverflow.com/questions/11220379/applescript-create-new-folder-from-file-name-and-move-file-into-that-folder?rq=1 –

回答

1

首先,你要選擇的文件夾分配給一個變量。 另外,OSX文件結構中的許多特殊文件夾都有特殊名稱來獲取其路徑,包括庫和應用程序支持文件夾。因此,您的腳本可以簡單地爲:

set finderObject to choose folder with prompt "Select folder:" 
tell app "Finder" to move finderObject to folder (path to Application Support folder from local domain as string) 

但是,這是根級別的Library文件夾。我懷疑你會想要使用〜/ user域中的Application Support文件夾。爲此,請將「從本地域」更改爲「從用戶域」。

+0

what if我想把它放在應用程序支持文件夾 – GMind

+0

((從本地域作爲字符串到應用程序支持文件夾的路徑)&「MyFolder:」)(由於存檔原因,請接受答案。) – jweaks

+0

並且你能給另一個例子,如果我想把它放在應用程序支持/應用程序/應用程序版本/版本中謝謝 – GMind

相關問題