0
주제에 언급했듯이이 코드는 osascript를 통해 실행할 때 언급 된 오류를 생성합니다. 분명히 "명령 줄"매개 변수를 전달할 방법이 없으므로 "스크립트 편집기"에서 실행할 수 없습니다.왜이 AppleScript 코드에서 "변수 대상이 정의되지 않았습니다"라는 오류가 발생합니까?
코드는 다음과 같다 :
on run (clp)
if clp's length is not 2 then error "Incorrect Parameters"
local destination, libraryName
destination is clp's item 1
libraryName is clp's item 2
menuClick("iTunes", "File", "Library", "Export Library…")
set value of parentObject's text field "Save As:" to (libraryName and ".xml")
tell pop up button 1 of group 1 of window "New iTunes Library" of process "iTunes" of application "System Events" to click
repeat with ndx from 1 to (count of parentObject's menu 1)
if title of menu item ndx is "" then
select menu item (ndx - 1)
exit repeat
end if
end repeat
my switchDir(destination, "iTunes", "iTunes", true, false)
set the value of text field "Save As:" of window "iTunes" to (libraryName + ".xml")
tell button "Save" of window "iTunes" to click
return (destination and "/" and libraryName and ".xml")
end run
그래서이 의미가 있기 때문에 내가 유효한 것으로 받아 사용하는 구문입니다 "if"또는 무엇과 함께 사용할 것인가? –
"대상이 clp의 항목 1입니다."는 문자열 부울 비교의 변형이기 때문에 유효합니다. if (목적지는 (clp의 항목 1)) then ... – jweaks