본문 바로가기
UiPath/UiPath Practice

UI Interactions : Demo - Input Actions & Input Methods

by kimyosunnyc 2020. 10. 23.

출처 : UiPath Academy

Video Demo - Input Actions & Input Methods

메모장 파일에 텍스트 입력 및 여러 글꼴 스타일, 크기 변경 수행

 


📌 설정방법

프로젝트를 Sequence로 시작하고 UiExplorer를 통해 선택한 메모장과 함께 'Attach Window' 컨테이너를 추가한다. 모든 Activities는 컨테이너에 배치된다.

 

  • 'Type Into' activity를 사용해서 텍스트가 입력 될 화면을 표시한다. 우리는 그 activity에서 text를 소개했다.
  • 'Click' activity를 사용하여 메모장 창을 최소화하고 'SimulateClick' option을 선택하여 백그라운드에서 작동하도록 한다.
  • 다른 'Type Into' activity를 사용하여 새 텍스트를 작성하고 SendWindowMessages 옵션을 선택한다.
  • 'Click' activity를 사용하여 Format(서식) 버튼을 클릭한다. ('SimulateClick' 옵션 선택)
  • Format(서식) 창에는 Attach Window 컨테이너를 사용한다. 컨테이너 내부에서 'Click' activity를 사용하여 Font...버튼을 클릭한다.
  • Font windowAttach Window 컨테이너를 사용했다. 컨테이너 내부 : 
    • 'Type into' activity를 사용하여 전용 필드에 새 글꼴의 이름을 작성한다.
    • 'Type into' activity를 사용하여 글꼴 스타일 필드에 "Italic"을 쓴다.
    • 'Get text' activity를 사용하여 텍스트 크기를 캡쳐하고 새로 만든 변수("fontSize")에 저장한다.
    • 'Type into' activity를 사용하여 Size 필드에 새 글꼴 크기(이전 글꼴 크기 + 5)를 작성한다.
      새 글꼴 크기는 '(cint(fontSize) + 5).ToString' Methods를 사용하여 결정된다.
      'cint'를 사용하여 값을 정수(Integer)로 변환 한 다음, 5를 더하고 .ToString을 사용하여 다시 문자열로 변환한다.
  • 'Send Hotkey' activity를 사용하여 Enter 키를 전송하여 글꼴을 닫는다.

1.1 Sequence (Sequence)								
	Private = False							
	Activities							
		1.2 Attach Window 'notepad.exe 제목' (WindowScope)						
			Selector = <wnd app='notepad.exe' cls='Notepad' title='제목 없음 - Windows 메모장' />					
			Private = False					
			Body					
				1.3 Do (Sequence)				
					Private = False			
					Activities			
						1.4 Type Into 'editable text  텍스트 편집' (TypeInto)		
							Text = 이것은 Video Demo 연습입니다.[k(enter)]	
							SendWindowMessages = True	
							Activate = True	
							Target	
								Selector = <wnd aaname='가로' cls='Edit' /><ctrl name='텍스트 편집' role='editable text' />
							Private = False	
						1.4 Click 'push button  최소화' (Click)		
							KeyModifiers = None	
							CursorPosition	
								Position = Center
							ClickType = CLICK_SINGLE	
							MouseButton = BTN_LEFT	
							Target	
								Selector = <ctrl idx='1' name='최소화' role='push button' />
							Private = False	
						1.4 Type Into 'editable text  텍스트 편집' (TypeInto)		
							Text = 이 활동은 백그라운드에서 진행된다.	
							SendWindowMessages = True	
							Activate = True	
							Target	
								Selector = <wnd aaname='가로' cls='Edit' /><ctrl name='텍스트 편집' role='editable text' />
							Private = False	
						1.4 Click 'menu item  서식(O)' (Click)		
							KeyModifiers = None	
							CursorPosition	
								Position = Center
							ClickType = CLICK_SINGLE	
							MouseButton = BTN_LEFT	
							Target	
								Selector = <ctrl automationid='MenuBar' idx='1' name='응용 프로그램' role='menu bar' /><ctrl name='서식(O)' role='menu item' />
							Private = False	
		1.2 Attach Window 'notepad.exe 제목' (WindowScope)						
			Selector = <wnd app='notepad.exe' cls='#32768' idx='*' />					
			Private = False					
			Body					
				1.3 Do (Sequence)				
					Private = False			
					Activities			
						1.4 Click 'menu item  글꼴(F)...' (Click)		
							KeyModifiers = None	
							CursorPosition	
								Position = Center
							ClickType = CLICK_SINGLE	
							MouseButton = BTN_LEFT	
							Target	
								Selector = <ctrl name='서식(O)' role='popup menu' /><ctrl automationid='33' />
							Private = False	
		1.2 Attach Window 'notepad.exe  글꼴' (WindowScope)						
			Selector = <wnd app='notepad.exe' cls='#32770' title='글꼴' />					
			Private = False					
			Body					
				1.3 Do (Sequence)				
					Private = False			
					Variables			
						fontSize(String)		
					Activities			
						1.4 Type Into 'Edit' (TypeInto)		
							Text = 배달의민족 주아	
							Activate = True	
							Target	
								Selector = <wnd ctrlid='1136' /><wnd ctrlid='1001' />
							Private = False	
						1.4 Type Into 'Edit' (TypeInto)		
							Text = 기울임꼴	
							Activate = True	
							Target	
								Selector = <wnd ctrlid='1137' /><wnd ctrlid='1001' />
							Private = False	
						1.4 Get Text 'Edit' (GetValue)		
							Value = fontSize	
							Target	
								Selector = <wnd ctrlid='1138' /><wnd ctrlid='1001' />
							Private = False	
						1.4 Type Into 'Edit' (TypeInto)		
							Text = (cint(fontSize)+5).ToString	
							Activate = True	
							Target	
								Selector = <wnd ctrlid='1138' /><wnd ctrlid='1001' />
							Private = False	
						1.2 Send Hotkey 'notepad.exe  글꼴' (SendHotkey)		
							KeyModifiers = None	
							Key = enter	
							SpecialKey = True	
							Activate = True	
							Target	
							Private = False	

✅ 참고사항

  • F2를 눌러 UiExplorer를 3초 동안 일시중지한다.
    예를 들어, 마우스오버 시 나타나는 요소를 화면에 표시해야 할 때 매우 편리하다.
  • 'Send Hotkey' activity를 의도하지 않은 위치로 보내지 않으려면 오직 컨테이너 안에서만 전송(Send)하기를 사용한다.

 

반응형

댓글