
현재 프로그램에 텍스트 문자열을 보내도록 바로 가기 키를 구성하려면 어떻게 해야 합니까?
일반적인 항목(이메일 주소, 주소, 전화번호, 사용자 이름, 좋아하는 인용문 등)을 더 빠르게 입력하는 것이 목적입니다.
텍스트를 입력하는 것 외에는 추가 자동화가 필요하지 않습니다.
젠투 리눅스(3.2.12-gentoo) Xfce 데스크탑 환경(버전 4.8)
답변1
한 가지 간단한 접근 방식은xdotool
, 좋다
xdotool type 'text'
답변2
xdotool이 작동합니다. 그러나 키보드 단축키와 통합하면 .. 간단한 xdotool 유형 'text'가 실패합니다.
다음 쉘 스크립트가 저에게 도움이 되었습니다.
windowid=$(xdotool getwindowfocus)
sleep 0.5 && xdotool windowactivate --sync $windowid type 'text'
답변3
답변4
이것을 사용하여 Linux에서 파일 열기 대화 상자 입력을 제어할 수 있습니다.
import pyautogui
import subprocess , time
pyautogui.hotkey('ctrl', 'o' , interval = 0.15)
pyautogui.hotkey('ctrl', 'l' , interval = 0.15)
subprocess.Popen("xdotool sleep 0.3 type '{Path_file}'".format(Path_file = "............................") , shell = True)
time.sleep(10)
pyautogui.press('enter')