; Copy text from PDF viewer, ; replace CRLF in clipboard with space, ; paste it into deepl. #include ; Dim $pdfviewer = "[CLASS:Chrome_WidgetWin_1]" Dim $pdfviewer = "[CLASS:AcrobatSDIWindow]" Dim $deeplclass = "DeepL" Dim $state Local $btn1, $btn2 Local $msg ; create GUI window Local $hGUI = GUICreate("Copy Paste", 280, 70) $btn1 = GUICtrlCreateButton("Translation", 8, 8, 180, 50) GUICtrlSetFont($btn1, 18, 700, 0, "Arial") $btn2 = GUICtrlCreateButton("Exit", 200, 8, 70, 28) GUISetState() ; HotKeySet("{ESC}", "Terminate") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ; Click window close button ExitLoop EndIf If $msg = $btn1 Then ; Click button 1 trans() EndIf If $msg = $btn2 Then ; Click button 2 ExitLoop EndIf WEnd GUIDelete($hGUI) Exit 0 Func Terminate() GUIDelete($hGUI) Exit 0 EndFunc Func trans() ; Activate PDF viewer $state = WinActivate($pdfviewer) If $state = 0 Then MsgBox(0, "Error", "Error: Not found PDF viewer") Exit 0 EndIf Send("^c") ; send Ctrl+C Sleep(500) ; Replace CRLF in clipboard with space ClipPut(StringReplace(ClipGet(), @CRLF, " ")) ; Activate DeepL $state = WinActivate($deeplclass) If $state = 0 Then MsgBox(0, "Error", "Error: Not found DeepL") Exit 0 EndIf Send("^a") ; send Ctrl+A Sleep(250) Send("{DELETE}") ; Delete key Sleep(250) Send("^v") ; send Ctrl+V EndFunc