# \[파이썬\] 특정문단 혹은 문자열이 하이퍼링크가 적용되었는지 판단하는 방법

**URL:** <https://forum.developer.hancom.com/t/topic/672>\
**Category:** 한글 오토메이션\
**Created:** [5월 11, 2023, 9:30오전 UTC](https://forum.developer.hancom.com/t/topic/672 "2023-05-11T09:30:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user25](https://avatars.discourse-cdn.com/v4/letter/u/e56c9b/32.png) [@user25](https://forum.developer.hancom.com/u/user25)\
**Post date:** [5월 11, 2023, 9:30오전 UTC](https://forum.developer.hancom.com/t/topic/672/1 "2023-05-11T09:30:46Z")

</div>

하이퍼링크가 적용된 문자열은 gettext로 읽어들이지 못하는데요…  
해당 문자열이 하이퍼링크가 적용되었는지 판단하는 방법은 있는지요?

---

<div class="post-metadata">

**Author:** ![bhjung](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/bhjung/32/259_2.png) [@bhjung](https://forum.developer.hancom.com/u/bhjung)\
**Post date:** [5월 12, 2023, 1:09오전 UTC](https://forum.developer.hancom.com/t/topic/672/2 "2023-05-12T01:09:45Z")

</div>

안녕하세요 ^^

문자열에 대해서 하이퍼링크 적용 여부를 알수있는 방법은 따로 없습니다 ㅠ …!

그러네 테스트를 해보니 GetText api를 사용시 하이퍼링크 문자열도 잘 읽히는것으로 확인했습니다.

혹시 어떻게 사용시 어떤 문자열을 읽지 못하는지 알려주시면 조금더 도움을 드릴수 있을것 같습니다.

감사합니다 ^^

 ![image](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/1X/6ecde1448a372af907501b354c2ee2aa4ba39a30.png)

---

<div class="post-metadata">

**Author:** ![user25](https://avatars.discourse-cdn.com/v4/letter/u/e56c9b/32.png) [@user25](https://forum.developer.hancom.com/u/user25)\
**Post date:** [5월 12, 2023, 1:34오전 UTC](https://forum.developer.hancom.com/t/topic/672/3 "2023-05-12T01:34:19Z")

</div>

선택영역에 대해 문자열을 가져오면 하이퍼링크 적용된 경우를 문자열을 가져오지 못하는 경우가 있습니다.

InitScan(Range=0xff)

---

<div class="post-metadata">

**Author:** ![bhjung](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/bhjung/32/259_2.png) [@bhjung](https://forum.developer.hancom.com/u/bhjung)\
**Post date:** [5월 12, 2023, 1:45오전 UTC](https://forum.developer.hancom.com/t/topic/672/4 "2023-05-12T01:45:01Z")

</div>

가져오지 못하는 경우가 있다는 말씀이시면, 가져올때도 있지만 안가져올떄도 있다는 걸까요?

음 주신 부분으로는 파악 및 테스트가 불가하네요 ㅠ … !

어떻게 사용하셨는지 예제 코드와 테스트 방법을 알려 주시면 확인해보겠습니다.

감사합니다.

---

<div class="post-metadata">

**Author:** ![user25](https://avatars.discourse-cdn.com/v4/letter/u/e56c9b/32.png) [@user25](https://forum.developer.hancom.com/u/user25)\
**Post date:** [5월 12, 2023, 1:50오전 UTC](https://forum.developer.hancom.com/t/topic/672/5 "2023-05-12T01:50:33Z")

</div>

def Get\_TextA():  
hwp.InitScan(Range=0xff)  
a1 =   
a2 = hwp.GetText()[1].splitlines()  
a1.append(a2)  
hwp.ReleaseScan()  
return a1

위 처럼 적용하니 선택된 문자열에서 하이퍼링크가 적용된 문자열을 읽지 못합니다.  
혹시 제가 뭘 잘못한걸까요?..ㅠㅠ

---

<div class="post-metadata">

**Author:** ![bhjung](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/bhjung/32/259_2.png) [@bhjung](https://forum.developer.hancom.com/u/bhjung)\
**Post date:** [5월 12, 2023, 4:14오전 UTC](https://forum.developer.hancom.com/t/topic/672/6 "2023-05-12T04:14:52Z")

</div>

아제가 잘못 이해를 했네요 ㅠ …!

GetText에서는 현재 텍스트 영역만 지원을 하고 하이퍼링크 영역에 대해서 정상 동작을 하고있지 않습니다.

필요하시다면 GetTextFile을 통해 선택 영역에 대한 텍스트를 가지오는 부분을 사용해야할것 같네요 …

추후 개선이 될수있도록 노력해보겠습니다 …!

---

<div class="post-metadata">

**Author:** ![ilco](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/ilco/32/1213_2.png) [@ilco](https://forum.developer.hancom.com/u/ilco)\
**Post date:** [12월 31, 2023, 2:59오후 UTC](https://forum.developer.hancom.com/t/topic/672/7 "2023-12-31T14:59:58Z")

</div>

InitScan 함수의 Range=0xff는 탐색범위를 블록선택 영역으로 제한하는 명령이에요.  
Range=0x77로 주시면 문서 전체에서 탐색합니다.

한/글 2018 기준으로는 하이퍼링크 문자열 추출이 잘 됩니다.

![녹화_2023_12_31_23_59_27_873](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/1X/6da6605cbc2aff7b72606a769c818f867eb18caf.gif)
