방금 / Macintosh HD/라이브러리/스크립트/폴더 작업 .../폴더에서 new item alert.scpt
파일을 편집했습니다. 일부 사용 권한을 편집 한 후에 저장했지만, Run
또는 Compile
을 클릭해도 아무런 변화가 없습니다.수정 된 AppleScript의 문제
일반적인 오류입니까, 아니면 누군가가 신경 쓸 필요가없는 경우 내 AppleScript에 문제가 있습니까?
property Docs : "Macintosh HD:Users:Max:Downloads:Docs"
property Music : "Macintosh HD:Users:Max:Downloads:Music"
property Videos : "Macintosh HD:Users:Max:Downloads:Videos"
property Images : "Macintosh HD:Users:Max:Downloads:Images"
property Profiles : "Macintosh HD:Users:Max:Downloads:iPhone:Profiles"
property Zips : "Macintosh HD:Users:Max:Downloads:Zips"
property PSDs : "Macintosh HD:Users:Max:Downloads:PSDs"
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
if (name of eachitem ends with ".png") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".JPEG") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".gif") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".jpg") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".jpeg") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".PNG") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".mov") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".avi") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".wma") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".m4v") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".mp4") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".mp3") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".wav") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".wma") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".pdf") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".doc") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".docx") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".pages") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".ppt") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".pptx") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".mobileprovision") then
move eachitem to folder Profiles
end if
if (name of eachitem ends with ".zip") then
move eachitem to folder Zips
end if
if (name of eachitem ends with ".psd") then
move eachitem to folder PSDs
end if
end tell
-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
--create the alert string
set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
if the item_count is greater than 1 then
set alert_message to alert_message & (the item_count as text) & " new items have "
else
set alert_message to alert_message & "One new item has "
end if
set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
set the user_choice to the button returned of the result
if user_choice is "Yes" then
tell application "Finder"
--go to the desktop
activate
--open the folder
open this_folder
--select the items
reveal the added_items
end tell
end if
end try
end adding folder items to
난 그냥 그랬와 함께 새로운 스크립트를 생성 코드를 넣지 만 폴더에 항목을 추가 할 때마다 아무 일도 일어나지 않습니다. 내가 뭘 잘못하고 있는거야? 이 파일을보고 싶은지 묻는 경고 메시지가 나타납니다. –
바로'--creatate the alert string' 행이 스크립트를 작성한 것과 같습니다. 따라서 코드는 최소한 포더 액션에 의해 시작되지만 코드는 의도 한대로 행동하지 않습니다. 스택 오버플로에 대한 또 다른 질문인데, 방금 물어 본 것과 관계가 없습니다. – Yuji