0

내 목표는 Illustrator의 no break 매개 변수를 AppleScript와 함께 텍스트 프레임의 두 단어에 적용하는 것입니다.noBreak 적용 AppleScript 일러스트 레이터

문자열에서 비 구분 영역을 감지 할 수 있습니다. 그럼 난 더 휴식 공간이 일러스트 레이터

지원하지 않는 한 후 문자 (202) 전에 말씀을 노 브레이크 매개 변수를 적용 할 필요가 오픈이 Scriplet 당신의 편집기에서 :

set ourText to "Hello my friend Jon<non-breaking-space>Doe." 
set findThis to (ASCII character 202) 
set MW to words of ourText 

repeat with aWord in MW 
    if findThis is in aWord then 
     set myWord to aWord 
     exit repeat 
    end if 
end repeat 

myWord - > 디스플레이 : Jon Doe

그런 다음 텍스트 프레임에서 "Jon Doe"를 검색하여 no break 매개 변수를 적용하고 싶습니다. Illustrator에서 수동으로 시도했지만 작동합니다.

+0

희망적으로 보이지 않습니다 https://forums.adobe.com/thread/2273633 – matt

+0

또는 텍스트 프레임에서 "JonØDoe"라는 단어의 색을 변경하는 방법을 알고 있다면 정말 도움이 될 것입니다! – martinjack

+0

http://macscripter.net/viewtopic.php?id=14695 – matt

답변

0

단어 목록을 작성 중이므로 스크립트가 작동하지 않습니다. 공백 (중단없는 공백 포함)은 단어 분리 문자이므로 단어 목록 (MW)에 포함되지 않습니다.

우리는 텍스트 항목 구분 기호로 노 휴식 공간을 사용하는 경우 그것은 작동합니다

use scripting additions 

set theResult to {} 
set ourText to "Hello my friends Jon Doe, Jane Doe and Joe Doe!" # Each name contains a no-break space 
set findThis to character id 160 # Decimal notation of U+00A0 (no-break space) 

set saveTID to AppleScript's text item delimiters 
set AppleScript's text item delimiters to findThis # The no-break space 
set countTextItems to count of text items of ourText 

if countTextItems > 1 then 
    repeat with i from 1 to countTextItems - 1 
     set end of theResult to word -1 of text item i of ourText & findThis & word 1 of text item (i + 1) of ourText 
    end repeat 
else 
    set theResult to "[no character id " & id of findThis & " found]" 
end if 

set AppleScript's text item delimiters to linefeed 
display dialog theResult as text 
set AppleScript's text item delimiters to saveTID 

입력 (ourText) :

안녕 내 친구 존 [noBreakSpace] 미상을, 제인 [noBreakSpace ] Doe and Joe [no BreakSpace] Doe!

출력 :

Output


내 친구 같은 경우에

때문에 J. [noBreakSpace] 미상을 실패 있습니다 w e는 반복 루프 내에서 word을 사용하고 있습니다.

이러한 경우가 자주있는 경우 word -1word 1text -1text 1으로 바꿉니다. 출력은 공백 둘레의 두 문자 만 포함하게됩니다. 그러나 검색 목적을 위해서 이것은 여전히 ​​충분합니다.

관련 문제