Olá estou tentando desenvolver um bot e estou com um pequeno problema como todos sabemos Tibia usa muito Shift e ctrl...
tentei de desenvolver varios métodos diferentes até vir aqui e pesquisei de mais, mais a maioria das pesquisas era algo do tipo aperte a key que ele vai te dizer qual é...
então resolvi vir em um forum de tibia para fazer a pergunta...
alguém pode me ajudar com este código, quero que ele aperta do shift + f1 até o shift+f12 inclusive o ctrl com a mesma coisa e também os f1 até o f12 por si só.
Mas esse processo eu acredito que seja 1 pouco demorado e pode ocorrer muitas falhas, tanto que o Shift não está funcionando só o do f-1 até o f12 e o ctrl até o f12 também...
alguém teria um outro tipo de ideia ou algo do gênero para me ajudar?
pois bem meu código está assim:
function hotkey(x :string): string;
var
h: HWND;
i : integer;
begin
~~~~~~~~~~~~~~~~~~aqui ele começa vendo se o que foi enviado veio como f1..f-12 se não for o i vai receber 0 porém ele executa o
sendMEssage com valor de 0..
i :=0;
if x ='F1' then
i := 112
else if x ='F2' then
i := 113
else if x ='F3' then
i := 114
else if x ='F4' then
i := 115
else if x ='F5' then
i := 116
else if x ='F6' then
i := 117
else if x ='F7' then
i := 118
else if x ='F8' then
i := 119
else if x ='F9' then
i := 120
else if x ='F10' then
i := 121
else if x ='F11' then
i := 122
else if x ='F12' then
i := 123;
if i=0 then
if x ='SHIFT+F1' then
i := 112
else if x ='SHIFT+F2' then
i := 113
else if x ='SHIFT+F3' then
i := 114
else
i:=0;
h := FindWindow(nil, 'Tibia'); // acha a janela do tibia
SendMessage(h, WM_KEYdown, i, 0); //pressiona a tecla
SendMessage(h, WM_KEYUP, i, 0); //solta tecla
~~~~~~~~~~~~~~~~~~~~Nisso se o i chegar com valor de 0 ele não vai ter sido aceito por nenhum dos hotkey então vai continuar a procura....
if i=0 then
if x ='SHIFT+F1' then
i := 112
else if x ='SHIFT+F2' then
i := 113
else if x ='SHIFT+F3' then
i := 114
else if x ='SHIFT+F4' then
i := 115
else if x ='SHIFT+F5' then
i := 116
else if x ='SHIFT+F6' then
i := 117
else if x ='SHIFT+F7' then
i := 118
else if x ='SHIFT+F8' then
i := 119
else if x ='SHIFT+F9' then
i := 120
else if x ='SHIFT+F10' then
i := 121
else if x ='SHIFT+F11' then
i := 122
else if x ='SHIFT+F12' then
i := 123;
~~~~~~~~~~~~~~~~~~~~~~~porém ele executa aqui de novo com valor de 0
h := FindWindow(nil, 'Tibia'); // acha a janela do tibia
SendMessage(h, WM_KEYDOWN, VK_SHIFT, 0);
SendMessage(h, WM_KEYDOWN, i, 0); //pressiona a tecla
SendMessage(h, WM_KEYUP, i, 0); //solta tecla
SendMessage(h, WM_KEYUP, VK_SHIFT, 0); //solta tecla
~~~~~~~~~~~~~~~~~~~~A qui faz a mesma coisa se chegar com valor de 0 ele cointinua o processo e executa la embaixo...
if i=0 then
if x ='CTRL+F1' then
i := 112
else if x ='CTRL+F2' then
i := 113
else if x ='CTRL+F3' then
i := 114
else if x ='CTRL+F4' then
i := 115
else if x ='CTRL+F5' then
i := 116
else if x ='CTRL+F6' then
i := 117
else if x ='CTRL+F7' then
i := 118
else if x ='CTRL+F8' then
i := 119
else if x ='CTRL+F9' then
i := 120
else if x ='CTRL+F10' then
i := 121
else if x ='CTRL+F11' then
i := 122
else if x ='CTRL+F12' then
i := 123;
h := FindWindow(nil, 'Tibia'); // acha a janela do tibia
SendMessage(h, WM_KEYDOWN, VK_CONTROL, 0);
SendMessage(h, WM_KEYDOWN, i, 0); //pressiona a tecla
SendMessage(h, WM_KEYUP, i, 0); //solta tecla
SendMessage(h, WM_KEYUP, VK_CONTROL, 0); //solta tecla
end;
Mas esse processo eu acredito que seja 1 pouco demorado e pode ocorrer muitas falhas, tanto que o Shift não está funcionando só o do f-1 até o f12 e o ctrl até o f12 também...
alguém teria um outro tipo de ideia ou algo do gênero para me ajudar?