간단한 질문 : 다음 AppleScript 코드의 문제점은 무엇입니까? 그것이 해야하는 일은 문자열 내에서 텍스트 항목 (사용자가 제공 한 구분 기호로 구분)의 위치를 얻는 것입니다. 그러나 지금까지는 작동하지 않습니다. Script Debugger는 특정 오류없이 "return_string_position을 계속할 수 없습니다"라고 간단히 말합니다. 무엇이 잘못 되었습니까?왜이 짧은 코드가 작동하지 않습니까?
tell application "System Events"
set the_text to "The quick brown fox jumps over the lazy dog"
set word_index to return_string_position("jumps", the_text, " ")
end tell
on return_string_position(this_item, this_str, delims)
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to delim
set this_list to this_str as list
repeat with i from 1 to the count of this_list
if item i of this_list is equal to this_item then return i
end repeat
set AppleScript's text item delimiters to old_delims
end return_string_position
고마워요! 그것은 매력처럼 작동했습니다! –
동의하려면 내 대답 옆에있는 체크 표시를 클릭하십시오. – fireshadow52