Jump to content

Recommended Posts

Posted

Hello everyone, I need your help because my program does not work in a program called "facturacion", only WinActivate works.

I try to use "send()", "Controlsend()" or send text with an "array[ ]" but nothing works.
This is my code:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Excel.au3>
#include <Array.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Ventana", 200, 250, 300, 50)
GUICtrlCreateLabel("Orden de Compra",20,10)
Global $compra = GUICtrlCreateInput("123456",20,30,90,20)
GUICtrlCreateLabel("No. de casillas",20,60)
Global $casillas = GUICtrlCreateInput("1",20,80,90,20)
$boton = GUICtrlCreateButton("boton",40,150,100,50)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop


Case $msg = $boton
    
Local $sWorkbook = @ScriptDir & "\facturacion.xlsx"
$oWorkbook = _Excel_BookAttach($sWorkbook)

Global $array[0]

Local $num = "2"


    For $i = 1 To GuiCtrlRead($casillas)
        
$c = $oWorkBook.ActiveSheet.Range("C" & $num).value
$b = $oWorkBook.ActiveSheet.Range("B" & $num).value
$a = $oWorkBook.ActiveSheet.Range("A" & $num).value

_ArrayAdd($array, $c)
_ArrayAdd($array, $b)
_ArrayAdd($array, $a)

$num = $num + 1
    
    Next
    
WinActivate("Complemento Carta Porte - Mercancías","")

;;; this does not work
Send("alex")
ControlSend("Complemento Carta Porte - Mercancías","","TMCCEditMascara11","hola")
Send($array[1])
;;;

EndSelect
Wend
Exit

I think it's something from the program "Facturacion" because if I want to use "send()", "Controlsend()" or send text with an "array[ ]" in another program it works correct.

sorry for my english, google helped me

 

pruebas.au3

Posted

There is an easy way to see if it works. Run the script below, then open your application and focus the input that should take the send characters and then press CTRL+M.

HotKeySet('^m', 'TestSend')

While True
    Sleep(10)
WEnd

Func TestSend()
    Send('Alex')
    Exit
EndFunc

If it works then your problem is that you fail to focus the control that should receive the Send() characters.

Posted
14 minutes ago, Andreik said:

There is an easy way to see if it works. Run the script below, then open your application and focus the input that should take the send characters and then press CTRL+M.

HotKeySet('^m', 'TestSend')

While True
    Sleep(10)
WEnd

Func TestSend()
    Send('Alex')
    Exit
EndFunc

If it works then your problem is that you fail to focus the control that should receive the Send() characters.

it doesn't work 😭, but if i do it in an excel sheet or in a notepad it does work.

Posted (edited)

Place this as first line in your script and play with different values, it might work.

AutoItSetOption('SendKeyDownDelay', 50)

You can also try to set SendKeyDelay option as well and play with different values.

Edited by Andreik

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
×
×
  • Create New...