Jump to content

Search the Community

Showing results for tags 'ControlSend'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Administração
    • Regras do fórum
    • Anúncios e Noticias
    • Moderação de Usuário
  • Geral
    • Chat (Offline)
    • Chat de Desenvolvedores
    • Diretivas de Segurança
    • Board Test
  • Autoit v3
    • Ajuda e Suporte geral
    • Ajuda e Suporte à GUI (Interface Gráfica de Usuário)
    • Exemplos de Scripts
    • UDFs (Função Definida pelo Usuário)
    • Tutoriais & VideoAulas
    • Microcódigos

Calendars

There are no results to display.

There are no results to display.


Found 2 results

  1. Boa noite a todos , esse e meu primeiro topico aqui e espero que seja util para outras pessoas que tenham a mesma duvida que eu. Antes de mais nada , estou projetando um simulador de um processador cisc para um trabalho de iniciacao cientifica, porem surgiu a necessidade de enviar cliques para uma janela minimizada , sou relativamente novo no Autoit porem e uma linguagem que me agrada muito e me conquistou demais nesses meses que venho mexendo com a mesma . Encontrei esse codigo na internet no seguinte link (https://www.autoitscript.com/forum/topic/88517-solved-sending-a-mouseclick-to-a-window-with-no-controls-without-activating-it/) porem nao consegui interpreta-lo bem , segue o codigo: ---------------------------------------------------------------------------------------------------------------------------------------------- Sleep(3000) For $i = 0 To 10 Step 1     _MouseClickPlus("Cabal", "left", 232, 117)     Sleep(1000) Next ;=============================================================================== ; ; Function Name: _MouseClickPlus() ; Version added: 0.1 ; Description: Sends a click to window ; minimized. ; Parameter(s): $Window = Title of the window to send click to ; $Button = "left" or "right" mouse button ; $X = X coordinate ; $Y = Y coordinate ; $Clicks = Number of clicks to send ; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs. ; Author(s): Insolence <insolence_9@yahoo.com> ; ;=============================================================================== Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)     MsgBox(1, "", "112333")     Local $MK_LBUTTON = 0x0001     Local $WM_LBUTTONDOWN = 0x0201     Local $WM_LBUTTONUP = 0x0202     Local $MK_RBUTTON = 0x0002     Local $WM_RBUTTONDOWN = 0x0204     Local $WM_RBUTTONUP = 0x0205     Local $WM_MOUSEMOVE = 0x0200     Local $i = 0     Select         Case $Button = "left"             $Button = $MK_LBUTTON             $ButtonDown = $WM_LBUTTONDOWN             $ButtonUp = $WM_LBUTTONUP         Case $Button = "right"             $Button = $MK_RBUTTON             $ButtonDown = $WM_RBUTTONDOWN             $ButtonUp = $WM_RBUTTONUP     EndSelect     If $X = "" Or $Y = "" Then         $MouseCoord = MouseGetPos()         $X = $MouseCoord[0]         $Y = $MouseCoord[1]     EndIf     For $i = 1 To $Clicks         DllCall("user32.dll", "int", "SendMessage", _                 "hwnd", WinGetHandle($Window), _                 "int", $WM_MOUSEMOVE, _                 "int", 0, _                 "long", _MakeLong($X, $Y))         DllCall("user32.dll", "int", "SendMessage", _                 "hwnd", WinGetHandle($Window), _                 "int", $ButtonDown, _                 "int", $Button, _                 "long", _MakeLong($X, $Y))         DllCall("user32.dll", "int", "SendMessage", _                 "hwnd", WinGetHandle($Window), _                 "int", $ButtonUp, _                 "int", $Button, _                 "long", _MakeLong($X, $Y))     Next EndFunc  ;==>_MouseClickPlus Func _MakeLong($LoWord, $HiWord)     Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc  ;==>_MakeLong    --------------------------------------------------------------------------------------------------------------------------------------- Alguem poderia me ajudar interpreta-lo por favor porem para minha finalidade se possivel , desde ja agradeço a atençao e a oportunidade de estar compartilhando o meu problema .
  2. Eu estava tentando desenvolver uma UDF assim, procurei várias informações de como fazer, cheguei a tentar obter informações aqui no fórum, mas o importante é que aí está. Pode ser muito útil para alguns, assim como está sendo para mim. Esta udf é muito útil para os casos onde o ControlSend e o ControlClick não são viáveis. Pois há casos de janelas que não possuem o ControlID que é um parâmetro obrigatório para estas duas funções. Apesar de esta UDF não ser "completamente" funcional em relação aos caracteres suportados pelo Send ou ControlSend, achei interessante é que ela suporta a mesma formatação das teclas. "Ex.: {DELETE}{ENTER}{ESC}" * Fiz algumas edições para melhorar a compatibilidade * Adicionei mais teclas aos KeyCodes.su3 * Tornei possível o envio de mais de um caractere PostMessage.au3 ; Name: PostMessage.au3 ; ====================================================================================== ; Author: KillerDeluxe ; Modified: Antony Gabarron ; ====================================================================================== #include-once #include "KeyCodes.au3" #include <WindowsConstants.au3> ;Example $sPidWnd = Run("c:\windows\system32\cmd.exe") sleep(2000) $hWnd = WinGetHandle("[class:ConsoleWindowClass]") _PostMessage_Send($hWnd, "@Echo off{enter}Echo Autoit Brasil{enter}Echo Modified by antony{enter}") Func _PostMessage_Send($hWnd, $Key, $Delay = 10) Local $aux If StringLen($Key) == 1 Then If $Key == "+" Or $Key == "^" Or $Key == "!" Then SetError(1) Else $Key = StringUpper($Key) $Key = StringToBinary($Key) EndIf Else Do If StringMid($Key, 1, 1) = "{" and StringInStr($Key, "}") Then If StringInStr($Key, "}") = StringLen($Key) Then $Key = _ReplaceKey($Key) ExitLoop Else For $i = 1 to StringInStr($Key, "}") $Aux &= StringMid($Key, $i, 1) IF $i = StringInStr($Key, "}") then $Key = StringMid($Key, $i + 1, StringLen($Key)) Next _PostMessage_Send($hWnd, $Aux, $Delay = 10) EndIf Else _PostMessage_Send($hWnd, StringMid($Key, 1, 1), $Delay = 10) $Key = StringMid($Key, 2, StringLen($Key)) EndIf Until StringLen($Key) <= 0 EndIf $Key_ = DllCall("user32.dll", "int", "MapVirtualKey", "int", $Key, "int", 0) If IsArray($Key_) Then DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "int", $WM_KEYDOWN, "int", $Key, "long", _MakeLong(1, $Key_[0])) Sleep($Delay) DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "int", $WM_KEYUP, "int", $Key, "long", _MakeLong(1, $Key_[0]) + 0xC0000000) Else SetError(2) EndIf EndFunc Func _PostMessage_Click($hWnd, $X = Default, $Y = Default, $Button = "left", $Clicks = 1, $Delay = 10) If $Button == "left" Then $Button = $WM_LBUTTONDOWN ElseIf $Button == "right" Then $Button = $WM_RBUTTONDOWN ElseIf $Button == "middle" Then $Button = $WM_MBUTTONDOWN If $Delay < 100 Then $Delay = 100 EndIf $WinSize = WinGetClientSize($hWnd) If $X == Default Then $X = $WinSize[0] / 2 If $Y == Default Then $Y = $WinSize[1] / 2 For $j = 1 To $Clicks DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "int", $Button, "int", "0", "long", _MakeLong($X, $Y)) Sleep($Delay) DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "int", $Button + 1, "int", "0", "long", _MakeLong($X, $Y)) Next EndFunc Func _MakeLong($LoDWORD, $HiDWORD) ;WinAPI.au3 Return BitOR($HiDWORD * 0x10000, BitAND($LoDWORD, 0xFFFF)) EndFunc ---- KeyCodes.au3 ; Name: KeyCodes.au3 ; ====================================================================================== ; Author: KillerDeluxe ; Modified: Antony Gabarron ; ====================================================================================== #include-once #include <Constants.au3> Global Const $VK_BACK = 0x8 Global Const $VK_TAB = 0x9 Global Const $VK_RETURN = 0xD Global Const $VK_CLEAR = 0x0C Global Const $VK_SHIFT = 0x10 Global Const $VK_CONTROL = 0x11 Global Const $VK_MENU = 0x12 Global Const $VK_PAUSE = 0x13 Global Const $VK_CAPITAL = 0x14 Global Const $VK_ESCAPE = 0x1B Global Const $VK_SPACE = 0x20 Global Const $VK_PRIOR = 0x21 Global Const $VK_NEXT = 0x22 Global Const $VK_END = 0x23 Global Const $VK_HOME = 0x24 Global Const $VK_LEFT = 0x25 Global Const $VK_UP = 0x26 Global Const $VK_RIGHT = 0x27 Global Const $VK_DOWN = 0x28 Global Const $VK_SNAPSHOT = 0x2C Global Const $VK_INSERT = 0x2D Global Const $VK_DELETE = 0x2E Global Const $VK_NUMPAD0 = 0x60 Global Const $VK_NUMPAD1 = 0x61 Global Const $VK_NUMPAD2 = 0x62 Global Const $VK_NUMPAD3 = 0x63 Global Const $VK_NUMPAD4 = 0x64 Global Const $VK_NUMPAD5 = 0x65 Global Const $VK_NUMPAD6 = 0x66 Global Const $VK_NUMPAD7 = 0x67 Global Const $VK_NUMPAD8 = 0x68 Global Const $VK_NUMPAD9 = 0x69 Global Const $VK_MULTIPLY = 0x6A Global Const $VK_ADD = 0x6B Global Const $VK_SUBTRACT = 0x6D Global Const $VK_DECIMAL = 0x6E Global Const $VK_DIVIDE = 0x6F Global Const $VK_F1 = 0x70 Global Const $VK_F2 = 0x71 Global Const $VK_F3 = 0x72 Global Const $VK_F4 = 0x73 Global Const $VK_F5 = 0x74 Global Const $VK_F6 = 0x75 Global Const $VK_F7 = 0x76 Global Const $VK_F8 = 0x77 Global Const $VK_F9 = 0x78 Global Const $VK_F10 = 0x79 Global Const $VK_F11 = 0x7A Global Const $VK_F12 = 0x7B Global Const $VK_NUMLOCK = 0x90 Global Const $VK_SCROLL = 0x91 Func _ReplaceKey($Key) $Key = StringReplace($Key, "{DELETE}", $VK_BACK) $Key = StringReplace($Key, "{TAB}", $VK_TAB) $Key = StringReplace($Key, "{ENTER}", $VK_RETURN) $Key = StringReplace($Key, "{BS}", $VK_CLEAR) $Key = StringReplace($Key, "+", $VK_SHIFT) $Key = StringReplace($Key, "{LSHIFT}", $VK_SHIFT) $Key = StringReplace($Key, "{RSHIFT}", $VK_SHIFT) $Key = StringReplace($Key, "^", $VK_CONTROL) $Key = StringReplace($Key, "{LCTRL}", $VK_CONTROL) $Key = StringReplace($Key, "{RCTRL}", $VK_CONTROL) $Key = StringReplace($Key, "!", $VK_MENU) $Key = StringReplace($Key, "{LALT}", $VK_MENU) $Key = StringReplace($Key, "{RALT}", $VK_MENU) $Key = StringReplace($Key, "{PAUSE}", $VK_PAUSE) $Key = StringReplace($Key, "{CAPSLOCK}", $VK_CAPITAL) $Key = StringReplace($Key, "{CAPSLOCK ON}", $VK_CAPITAL) $Key = StringReplace($Key, "{CAPSLOCK OFF}", $VK_CAPITAL) $Key = StringReplace($Key, "{CAPSLOCK TOGGLE}", $VK_CAPITAL) $Key = StringReplace($Key, "{ESCAPE}", $VK_ESCAPE) $Key = StringReplace($Key, "{SPACE}", $VK_SPACE) $Key = StringReplace($Key, "{PGUP}", $VK_PRIOR) $Key = StringReplace($Key, "{PGDN}", $VK_NEXT) $Key = StringReplace($Key, "{END}", $VK_END) $Key = StringReplace($Key, "{HOME}", $VK_HOME) $Key = StringReplace($Key, "{LEFT}", $VK_LEFT) $Key = StringReplace($Key, "{UP}", $VK_UP) $Key = StringReplace($Key, "{RIGHT}", $VK_RIGHT) $Key = StringReplace($Key, "{DOWN}", $VK_DOWN) $Key = StringReplace($Key, "{PRINTSCREEN}", $VK_SNAPSHOT) $Key = StringReplace($Key, "{INSERT}", $VK_INSERT) $Key = StringReplace($Key, "{DELETE}", $VK_DELETE) $Key = StringReplace($Key, "{NUMPAD0}", $VK_NUMPAD0) $Key = StringReplace($Key, "{NUMPAD1}", $VK_NUMPAD1) $Key = StringReplace($Key, "{NUMPAD2}", $VK_NUMPAD2) $Key = StringReplace($Key, "{NUMPAD3}", $VK_NUMPAD3) $Key = StringReplace($Key, "{NUMPAD4}", $VK_NUMPAD4) $Key = StringReplace($Key, "{NUMPAD5}", $VK_NUMPAD5) $Key = StringReplace($Key, "{NUMPAD6}", $VK_NUMPAD6) $Key = StringReplace($Key, "{NUMPAD7}", $VK_NUMPAD7) $Key = StringReplace($Key, "{NUMPAD8}", $VK_NUMPAD8) $Key = StringReplace($Key, "{NUMPAD9}", $VK_NUMPAD9) $Key = StringReplace($Key, "{NUMPADMULT}", $VK_MULTIPLY) $Key = StringReplace($Key, "{NUMPADADD}", $VK_ADD) $Key = StringReplace($Key, "{NUMPADSUB}", $VK_SUBTRACT) $Key = StringReplace($Key, "{NUMPADDOT}", $VK_DECIMAL) $Key = StringReplace($Key, "{NUMPADDIV}", $VK_DIVIDE) $Key = StringReplace($Key, "{F1}", $VK_F1) $Key = StringReplace($Key, "{F2}", $VK_F2) $Key = StringReplace($Key, "{F3}", $VK_F3) $Key = StringReplace($Key, "{F4}", $VK_F4) $Key = StringReplace($Key, "{F5}", $VK_F5) $Key = StringReplace($Key, "{F6}", $VK_F6) $Key = StringReplace($Key, "{F7}", $VK_F7) $Key = StringReplace($Key, "{F8}", $VK_F8) $Key = StringReplace($Key, "{F9}", $VK_F9) $Key = StringReplace($Key, "{F10}", $VK_F10) $Key = StringReplace($Key, "{F11}", $VK_F11) $Key = StringReplace($Key, "{F12}", $VK_F12) $Key = StringReplace($Key, "{NUMLOCK}", $VK_NUMLOCK) $Key = StringReplace($Key, "{NUMLOCK ON}", $VK_NUMLOCK) $Key = StringReplace($Key, "{NUMLOCK OFF}", $VK_NUMLOCK) $Key = StringReplace($Key, "{NUMLOCK TOGGLE}", $VK_NUMLOCK) $Key = StringReplace($Key, "{SCROLLLOCK}", $VK_SCROLL) $Key = StringReplace($Key, "{SCROLLLOCK ON}", $VK_SCROLL) $Key = StringReplace($Key, "{SCROLLLOCK OFF}", $VK_SCROLL) $Key = StringReplace($Key, "{SCROLLLOCK TOGGLE}", $VK_SCROLL) Return $Key EndFunc Fontes: http://www.elitepvpers.com/forum/autoit/809108-controlsend-problem.html#post7479737 http://www.mpgh.net/forum/showthread.php?t=604802&p=7524504&viewfull=1#post7524504 (outra versão, mesmo author)
×