Copying and pasting a text line with ctrl+c/v instead of Sendraw Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
reetis
Posts: 8
Joined: 03 Dec 2022, 11:54

Copying and pasting a text line with ctrl+c/v instead of Sendraw

Post by reetis » 04 Dec 2022, 09:40

Hello,

I have a script that takes one line from the specified .txt file, then pastes and presses CTRL+ENTER and does so until the end of the file is reached. It works fine. However, there are lines with Lithuanian symbols, and the pasted line becomes gibberish like į žygį. This must be due to me "pasting" it with the command Sendraw. I need your help in changing the script so that the pasting part is just ctrl+v, because pasting by hand without AHK gets rid of the gibberish. Code below

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Sleep, 2000
Loop
{
	FileReadLine, line, C:\Users\Rytis\Desktop\testuojam.txt, %A_Index%
	{
		Sendraw %line%
		Send ^{enter}
		Sleep, 3000
	}
}
return
!Escape:: exitapp

User avatar
boiler
Posts: 16949
Joined: 21 Dec 2014, 02:44

Re: Copying and pasting a text line with ctrl+c/v instead of Sendraw  Topic is solved

Post by boiler » 04 Dec 2022, 10:28

reetis wrote: This must be due to me "pasting" it with the command Sendraw.
That is not the reason. Save your script file with "UTF-8 with BOM" encoding, then run it again.

reetis
Posts: 8
Joined: 03 Dec 2022, 11:54

Re: Copying and pasting a text line with ctrl+c/v instead of Sendraw

Post by reetis » 04 Dec 2022, 10:47

boiler wrote:
04 Dec 2022, 10:28
reetis wrote: This must be due to me "pasting" it with the command Sendraw.
That is not the reason. Save your script file with "UTF-8 with BOM" encoding, then run it again.
You are right - upon saving BOTH the script file and the source file with BOM encoding, my original code works fine.

Thank you.

Post Reply

Return to “Ask for Help (v1)”