-1
我寫了一個AppleScript滴,我想:我想在一個AppleScript液滴一旦設置變量,但它讓我將它設置爲每個文件
- 拖動一個或多個圖像到液滴
- 3個顯示對話框出現問「寬度」,「身高」,「格式」
- 過程中的所有使用上述文本丟棄圖片返回的 3顯示對話框
目前的,3個顯示對話框s出現在每個圖像上(例如,出現3個圖像= 9個對話框)。有沒有辦法我只能回答這些對話一次?這裏是我的腳本:
on run
display dialog "This is a droplet"
end run
on open draggedItems
set tid to AppleScript's text item delimiters
--ask for new width
set newWidth to text returned of (display dialog "New Width" default answer ¬
"45" buttons {"Continue…", "Cancel"} ¬
default button 1)
--ask for new height
set newHeight to text returned of (display dialog "New Height" default answer ¬
"45" buttons {"Continue…", "Cancel"} ¬
default button 1)
--ask for formatType
set newFormat to text returned of (display dialog "Image Format" default answer ¬
"jpg" buttons {"Continue…", "Cancel"} ¬
default button 1)
--repeat
repeat with i in draggedItems
set theFile to (i as alias)
set theFilePath to (the POSIX path of theFile)
set fullFileName to name of (info for theFile without size)
set AppleScript's text item delimiters to "."
set fileNameNoExtension to first text item of fullFileName
--set fileExtension to second text item of fullFileName
set AppleScript's text item delimiters to tid
do shell script ("/usr/local/bin/convert " & quoted form of theFilePath & " -resize " & newWidth & "x" & newHeight & "\\! ~/desktop/" & fileNameNoExtension & "." & newFormat)
end repeat
end open
您的'askForNew'方法完美地工作。非常感謝。 – thizzle