2017-11-02 7 views
0

私は、ユーザの入力があるフォルダを作成するAppleScriptスクリプトを作成しようとしていましたが、残念ながらそれを動作させることはできません。どんな助けもありがとうございます。フォルダを作成して名前を付けるスクリプトエディタ

set theResponse to display dialog "Enter the name of folder" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue" 
display dialog "Name of the folder: " & (text returned of theResponse) & "." 
tell application "Finder" 
    make new folder at desktop with properties {name:"theResponse"} 
end tell 
+0

スクリプトを書くために何を使用していますか? bash、node.js ...? – stealththeninja

+1

@stealththeninja:それは私にとってAppleScriptのようです(Script Editorのデフォルト言語)。 – Ssswift

+0

あなたの質問の下にある 'edit'をクリックし、コードを選択してコードフォーマットアイコン' {} 'をクリックしてください –

答えて

1

はここで働くあなたのコードの修正版です:

set theResponse to text returned of (display dialog "Enter the name of folder" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue") 
display dialog "Name of the folder: " & theResponse & "." 
tell application "Finder" 
    make new folder at desktop with properties {name:theResponse} 
end tell 

をあなたの元コード{name:"theResponse"}では、"theResponse"と引用符で、それは文字通りtheResponseないthe text returnedです。

ので、コードの最初の行で、私はそれが後でスクリプト内などとして参照される必要がないので、the text returnedからtheResponse変数設定で始まりました。 コードの2行目のこのよう

(text returned of theResponse)について可変そのを含む、単にtheResponseに設定されています。それが来るとき

は今nameプロパティmake new folderするための時間は、引用符なしで、theResponseであり、それはすでにコードの最初の行からthe text returnedが含まれています。

関連する問題