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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By dejhost
      Hi.
      I am trying to automate a software called "LabelImg" (https://pypi.org/project/labelImg/).
      My autoit-script is started once I selected a folder with images within LabelImg. Pressing the button "Next Image" or pressing the shortcut "d" (https://github.com/tzutalin/labelImg#Hotkeys) jumps to the next image in the selected folder. This shall happen once per second.
      #include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Opt("WinTitleMatchMode", 1) Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("1B", $hDLL) Then ExitLoop Else Local $temp = WinActivate("labelImg") ConsoleWrite($temp & @CRLF) If WinActivate("labelImg") Then ConsoleWrite("All Set!" & @CRLF) EndIf ;Send("d") Local $temp = MouseClick($MOUSE_CLICK_RIGHT, 50, 200) If $temp <> 1 Then MsgBox(1, "$temp", $temp) ExitLoop EndIf Sleep(1000) EndIf WEnd DllClose($hDLL) So the Send ("d")-command and the MouseClick are alternative methods to jump to the next image. Both fail.
      Both ConsoleWrite's deliver proper feedback (I continiously get the handle and "All set" ).

      Could you tell me what I'm doing wrong? 
      Thank you.
    • By MrKm
      AutoIT-OCRSpace-UDF1.3.zip
      This tiny yet powerful UDF will help you to convert Images to text with the help of  OCRSpace API version 3.50 .
      Detect text from a local file.
      ; ========================================================= ; Example 2 : Gets text from an image from a local path reference ; : Searchable PDF is not requested by default. ; : Processes it using a basic OCR logic. ; ========================================================= $b_Create_Searchable_PDF = True ; Use a table logic for receipt OCR $b_Table = True ; Set your key here. $v_OCRSpaceAPIKey = "" $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, $b_Table, True, "eng", True, Default, Default, $b_Create_Searchable_PDF) $sText_Detected = _OCRSpace_ImageGetText($OCROptions, @scriptdir & "\receipt.jpg", 0, "SEARCHABLE_URL") ConsoleWrite( _ " Detected text : " & $sText_Detected & @CRLF & _ " Error Returned : " & @error & @CRLF & _ " PDF URL : " & Eval("SEARCHABLE_URL") & @CRLF)  
      Detect text from a URL reference.
      ; ========================================================= ; Example 1 : Gets text from an image using a url reference ; : Searchable PDF is not requested. ; : Processes it using a basic OCR logic. ; ========================================================= $v_OCRSpaceAPIKey = "" ; SetUp some preferences.. $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, False, True, "eng", True, Default, Default, False) ; Make the request.. $sText_Detected = _OCRSpace_ImageGetText($OCROptions, "https://i.imgur.com/vbYXwJm.png", 0) ConsoleWrite( _ " Detected text : " & $sText_Detected & @CRLF & _ " Error Returned : " & @error & @CRLF)    
      Detect text from a URL reference to an array
      #include "OCRSpaceUDF\_OCRSpace_UDF.au3" #include <array.au3> ; Set your key here. $v_OCRSpaceAPIKey = "" $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, $b_Table, True, "eng", True, Default, Default, False) ; Below, the return type is set to 1 to return an array containing the coordinates of the bounding boxes for each word detected, ; in the format : #WordDetected , #Left , #Top , 3Height, #Width $aText_Detected = _OCRSpace_ImageGetText($OCROptions, "https://i.imgur.com/Z1enogD.jpeg", 1) _ArrayDisplay($aText_Detected, "")  
       
       
       
       
      https://github.com/KabueMurage/AutoIT-OCRSpace-UDF
      Download Latest Version : 
       
    • By Danyfirex
      AT Command UDF - for control AT Modems, send SMS, get SMS
       
      Changelog:
      #cs 1.0.0 2020/10/03 . First version - Danyfirex + mLipok 1.0.1 2020/10/04 . Added - Function - _ATCmd_IsPINReady - Danyfirex . Added - Function - _ATCmd_IsPINRequired - Danyfirex . Added - Function - _ATCmd_IsSIMInserted - Danyfirex . Added - Function - _ATCmd_IsSenderSupported - Danyfirex . Added - Function - _ATCmd_OnPINReques - Danyfirex . Added - Function - _ATCmd_SMS_ListTextMessages - Danyfirex . Added - Function - _ATCmd_SetPIN - Danyfirex . Added - Function - __ATCmd_GetPINCounter - Danyfirex - Added - ENUM - $ATCmd_ERR_PIN - Danyfirex - Added - ENUM - $ATCmd_ERR_SIM - Danyfirex . Changed - __ATCmd_ComposePDU() - using _ATCmd_UseUCS2() internally instead parameter - Danyfirex . Suplemented - #CURRENT# - Danyfirex . . 1.0.2 2020/10/05 . Added - ENUM - $ATCmd_MSGLIST_* - mLipok . Added - ENUM - $ATCmd_STATUS__* - mLipok - Added - ENUM - $ATCmd_ERR_PARAMETER - mLipok . Added - _ATCmd_UsePDU() - parameter validation - mLipok . Added - _ATCmd_UseUCS2() - parameter validation - mLipok . Added - more error logs . Changed - MagicNumber replaced with Standard UDF constants - mLipok . Small refactoring - mLipok . . 1.0.3 2020/10/05 . CleanUp - Danyfirex . . 1.0.4 2020/10/05 . Small refactoring - Danyfirex . CleanUp - Danyfirex . . 1.0.5 2020/10/23 . _ATCmd_FullLoging - mLipok . _ATCmd_CMEESetup() ... @WIP - mLipok . $ATCMD_STATUS_11_SUBSCRIBERNUMBER - mLipok . . 1.0.6 2020/10/25 . __ATCmd_CMSErrorParser() - mLipok . . @LAST https://www.nowsms.com/gsm-modem-cms-error-code-list https://m2msupport.net/m2msupport/at-command-to-enable-error-codes/ https://www.micromedia-int.com/en/gsm-2/73-gsm/669-cme-error-gsm-equipment-related-errors https://assets.nagios.com/downloads/nagiosxi/docs/ATCommandReference.pdf https://www.maritex.com.pl/product/attachment/40451/15b4db6d1a10eada42700f7293353776 https://www.multitech.net/developer/wp-content/uploads/2010/10/S000463C.pdf https://www.telit.com/wp-content/uploads/2017/09/Telit_AT_Commands_Reference_Guide_r24_B.pdf https://docs.rs-online.com/5931/0900766b80bec52c.pdf PDU Format / Testers / Encoders / decoders https://m2msupport.net/m2msupport/sms-at-commands/#pduformat http://smstools3.kekekasvi.com/topic.php?id=288 #ce  
       
      Saludos
    • By Drac89
      Hi Team, 
      I am trying to send credentials via autoit on a web app launched via IE. I am passing the credentials into variables and trying to send them send("$username") but username field isn't getting populated. But the password field, I can send the credential, also when I try ieformsetvalue and set the username wrt username field fetched, it's getting send but my login button remains greyed out. 
      Can angularjs keydown function interfere in the autoit send process and not allow the credentials passed if it's not typed out? This is a general question to understand if javascript or angular js etc could detect if the credentials are automated, then it might not detect it as a keydown? 
×
×
  • Create New...