Jump to content

question about send function - (Moved)


Recommended Posts

hello autoit group

please i've a question

i had make a function that put some thing into the clipBoard and paste it

using the send function

e.g

ClipPut("hello")

send("^v")

 

when the keyboard is english all things work fine

but when the keyboard is arabic the send command write the ltr v insted of the text in clipboard

i was tryed to use

send("{ctrldown}v{ctrlUp}")

but the same

please can any one help me

 

Link to comment
Share on other sites

@Nine, i don't know if it work with an external GUI
this is the code that i tried
i hope  if it work with me
because my program is spicielly to the arabs users for that the arabic must be in the keybord
 

$text = "text to paste"
$OldText = ClipGet()
WinActivate($h_CRNTWND, ""); the handle of the Active Window
do
Until WinActive($h_CRNTWND)
clipPut($text)
BlockInput(1)
Send("{CTRLDOWN}")
sleep(20)
Send("v")
sleep(20)
Send("{CTRLUp}")
BlockInput(0)
ClipPut($OldText)

 

Link to comment
Share on other sites

29 minutes ago, nacerbaaziz said:

i don't know if it work with an external GUI

Well the only way to know for sure is to test it, right ?

Use the control handle of the input box you want to paste it to.

Link to comment
Share on other sites

1 minute ago, Nine said:

Well the only way to know for sure is to test it, right ?

Use the control handle of the input box you want to paste it to.

hello sir, the problem i can't know the plase where the user paste, i tried controle set text, but the problem the user can paste the text into web edit or an GUI or java application,

what am trying to make is an multi clipBoard i meen an clipboard history store

for that i can't know the place where the user will paste it

i tried the sendMessage with the handle of the window but it didn't work

Link to comment
Share on other sites

I see...Sorry, I don't know.  But I am pretty sure there is a way to paste text with arabic keyboard, no ?

Anyway, one last solution I can think of is to use 

Local $hWnd = _WinAPI_WindowFromPoint ($tPoint)

to get the handle of a static input box.  I tested and it works. Use preferably mouse position.  Caret position may not work properly.

Link to comment
Share on other sites

hello again
please community there are no function can press the keys with not send command
because i think the problem is with send function
when i try to paste the text with ctrl+v manualy all thing work fine even if the keyboard is arabic or english or franch
i couldn't find any solution to that
i finished my tool this problem only if it corrected i'll share the tool to othersbut if the keyboard in arabic and i pressed control+v manualy it work with out problem

Link to comment
Share on other sites

Send is not the problem.  I have a french keyboard, I am using send function all the time without a single issue. It is probably the window ($h_CRNTWND) that should receive the paste that is causing the problem.  When I run your code, it works perfect.  If you want us to help you, you must provide a runable script that replicates the dysfonction of the Send.  Otherwise, I don't think anyone here can help you out. 

Link to comment
Share on other sites

this code e.g

when i run it and the keyboard in english or franch all things work fine

but in arabic no

it write the l V

but when i press ctrl+v manualy it paste the text

here is the code

global $text = "some text"
hotkeySet("^{f2}", "pasteText")
hotkeySet("{esc}", "Kill")
While 1
sleep(100)
Wend
func pasteText()
local $crntClip = ClipGet()
ClipPut($text)
Send("^v")
clipPut($crntClip)
return 0
endFunc
func kill()
exit
endFunc

 

Link to comment
Share on other sites

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

hello team

now i did a test and it successed 

i tried to send the l in arabic that in the same place to the l v

it ر

after that i've make a function to get the keyboard lng and i did an if to detect the kb lng

here is the code

and thank you for your help

with my greetings

#include <WinAPILocale.au3>
global $text = "some text"
hotkeySet("^{f2}", "pasteText")
hotkeySet("{esc}", "Kill")
While 1
sleep(100)
Wend
func pasteText()
local $crntClip = ClipGet()
ClipPut($text)
Send("{CTRLDOWN}")
if GetSystemLNG(@KBLayout) = "arabic" then
Send("ر")
else
Send("v")
endIf
send("{CTRLUp}")
clipPut($crntClip)
return 0
endFunc
func kill()
exit
endFunc
func GetSystemLNG($String = "")
if $String = "" then
local $s_Lng = _WinAPI_GetLocaleInfo(0x0400, 0x0001)
else
local $s_Lng = $String
endIf
local $LngID ='0x' & StringTrimLeft($s_lng, 4) & StringTrimLeft($s_lng, 4)
local $idBord = _WinAPI_GetLocaleInfo(BitAND($LngID, 0xFFFF), 0x1001)
return $idBord
endFunc
#include <WinAPILocale.au3>
global $text = "some text"
hotkeySet("^{f2}", "pasteText")
hotkeySet("{esc}", "Kill")
While 1
sleep(100)
Wend
func pasteText()
local $crntClip = ClipGet()
ClipPut($text)
Send("{CTRLDOWN}")
if GetSystemLNG(@KBLayout) = "arabic" then
Send("ر")
else
Send("v")
endIf
send("{CTRLUp}")
clipPut($crntClip)
return 0
endFunc
func kill()
exit
endFunc
func GetSystemLNG($String = "")
if $String = "" then
local $s_Lng = _WinAPI_GetLocaleInfo(0x0400, 0x0001)
else
local $s_Lng = $String
endIf
local $LngID ='0x' & StringTrimLeft($s_lng, 4) & StringTrimLeft($s_lng, 4)
local $idBord = _WinAPI_GetLocaleInfo(BitAND($LngID, 0xFFFF), 0x1001)
return $idBord
endFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...