본문 바로가기
UiPath/UiPath Practice

UI Interactions : Practice 1 - Input Actions & Methods

by kimyosunnyc 2020. 11. 9.

출처 : UiPath Academy

Practice 1 - Input Actions & Methods (Input data in Notepad)

다음의 메모장 자동화를 수행하는 Sequence를 생성한다.

 

  • 사용자에게 입력할 텍스트를 요청한다.
  • 사용자에게 파일을 저장할 제목을 요청한다.
  • 메모장을 연다.
  • 사용자의 텍스트를 입력한다.
  • 글꼴 스타일을 굵게, 크기를 16으로 변경한다.
  • Save as(다른이름으로 저장)로 이동하여 사용자 제목으로 파일을 저장한다.

UI Interactions : Practice 1 - Input Actions & Methods

 

📌 설정방법

  • 프로젝트를 Sequence로 시작하고 Input Dialog activity를 사용한다. 문자열(String)변수 'UserText'에 텍스트를 저장한다.
  • 다른 Input Dialog acitivity를 사용하여 파일이름을 사용자의 입력으로 가져온다. 문자열(String)변수 'NotePadFileName'에 텍스트를 저장한다. 
  • Open Application 컨테이너를 사용하여 메모장을 연다.
    In the Container : 
    • Type Into activity를 사용하여 'UserText' 변수에 데이터를 기록한다.
    • Click activity를 사용하여 서식 버튼을 클릭한다. 또 다른 Click activity를 사용하여 글꼴 버튼을 클릭한다.
    • Attach Window 컨테이너를 사용하여 글꼴 창이 열렸음을 표시한다.
      In the Container : 
      • Type Into acitivity를 사용하여 글꼴 스타일 아래에 '굵게'를 입력한다.
      • 또 다른 Type Into activity를 사용하여 크기'16'을 입력한다.
      • Send Hotkey activity를 사용하여 'Enter'키를 눌러 글꼴 창을 닫는다.
      • Send Hotkey activity를 사용하여 저장한다. 'Ctrl + S'
    • 파일 이름을 묻는 새 창이 열리면 Type Into activity를 사용하여 'NotePadFileName'변수에 데이터를 입력한다.
    • Send Hotkey activity를 사용하여 'Enter'키를 눌러 Save창을 닫는다.
    • Close Application acitivity를 사용하여 메모장을 닫는다.

1.1 Sequence (Sequence)								
	Private = False							
	Variables							
		UserText(String)						
		NotePadFileName(String)						
	Activities							
		1.71 Input Dialog (InputDialog)						
			Title = 메모장 내용 입력					
			Label = 메모장에 저장 할 내용을 입력하세요.					
			IsPassword = False					
			Result = UserText					
			Private = False					
		1.66 Input Dialog (InputDialog)						
			Title = 메모장 파일명 입력					
			Label = 메모장을 저장 할 파일명을 입력하세요.					
			IsPassword = False					
			Result = NotePadFileName					
			Private = False					
		1.66 Open Application 'notepad.exe 제목' (OpenApplication)						
			Selector = <wnd app='notepad.exe' cls='Notepad' title='제목 없음 - Windows 메모장' />					
			FileName = C:\Windows\System32\notepad.exe					
			Private = False					
			Body					
				1.62 Do (Sequence)				
					Private = False			
					Activities			
						1.63 Type Into UserText 입력 (TypeInto)		
							Text = UserText	
							SimulateType = True	
							Activate = True	
							Target	
								Selector = <wnd aaname='가로' cls='Edit' /><ctrl name='텍스트 편집' role='editable text' />
							Private = False	
						1.63 Click 서식 Button (Click)		
							KeyModifiers = None	
							CursorPosition	
								Position = Center
							SimulateClick = True	
							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.63 Click 글꼴 Button (Click)		
							KeyModifiers = None	
							CursorPosition	
								Position = Center
							SimulateClick = True	
							ClickType = CLICK_SINGLE	
							MouseButton = BTN_LEFT	
							Target	
								Selector = <wnd app='notepad.exe' cls='#32768' idx='*' /><ctrl name='서식(O)' role='popup menu' /><ctrl automationid='33' />
							Private = False	
		1.2 Attach Window 글꼴 수정 (WindowScope)						
			Selector = <wnd app='notepad.exe' cls='#32770' title='글꼴' />					
			Private = False					
			Body					
				1.3 Do (Sequence)				
					Private = False			
					Activities			
						1.4 Type Into 글꼴 스타일 (TypeInto)		
							Text = 굵게	
							SimulateType = True	
							Activate = True	
							Target	
								Selector = <wnd ctrlid='1137' /><wnd ctrlid='1001' />
							Private = False	
						1.4 Type Into 텍스트 크기 (TypeInto)		
							Text = 16	
							SimulateType = True	
							Activate = True	
							Target	
								Selector = <wnd ctrlid='1138' /><wnd ctrlid='1001' />
							Private = False	
						1.4 Send Hotkey 확인 (SendHotkey)		
							KeyModifiers = None	
							Key = enter	
							SpecialKey = True	
							Activate = True	
							Target	
								Selector = <ctrl name='글꼴' role='dialog' />
							Private = False	
		1.2 Send Hotkey 저장하기 (SendHotkey)						
			KeyModifiers = Ctrl					
			Key = s					
			Activate = True					
			Target					
				Selector = <wnd app='notepad.exe' cls='Notepad' title='*제목 없음 - Windows 메모장' /><wnd aaname='가로' cls='Edit' /><ctrl name='텍스트 편집' role='editable text' />				
			Private = False					
		1.2 Type Into 파일이름 (TypeInto)						
			Text = NotePadFileName					
			SimulateType = True					
			Activate = True					
			Target					
				Selector = <wnd app='notepad.exe' cls='#32770' title='다른 이름으로 저장' /><wnd aaname='탐색 창' cls='DirectUIHWND' /><wnd aaname='파일 이름:' cls='ComboBox' /><wnd ctrlid='1001' />				
			Private = False					
		1.2 Send Hotkey 확인 (SendHotkey)						
			KeyModifiers = None					
			Key = enter					
			SpecialKey = True					
			Activate = True					
			Target					
				Selector = <wnd app='notepad.exe' cls='#32770' title='다른 이름으로 저장' /><ctrl name='다른 이름으로 저장' role='dialog' />				
			Private = False					
		1.2 Close Application 메모장 (CloseApplication)						
			Target					
				Selector = <wnd app='notepad.exe' cls='Notepad' title='test.txt - Windows 메모장' />				
			Private = False					
반응형

댓글