ljkkda Posted March 30, 2006 Share Posted March 30, 2006 (edited) i found this code to send key to a window trought dllcall but how can i send the text or key to a "Edit1" Control in the window? what do i have to change in the code? i dont know anything about dllcall so anyone can help me with this? expandcollapse popupGlobal Const $VK_OEM_PLUS = 0xBB Global Const $VK_OEM_MINUS = 0xBD Global Const $VK_OEM_3 = 0xC0 Global Const $VK_TAB = 0x9 Global Const $VK_ESC = 0x1B Global Const $VK_F5 = 0x74 Global Const $VK_F12 = 0x7B $window = WinGetTitle("") Dim $hWnd = WingetHandle( $window ) _SendKeys($hWnd, "123123123"); using send keys Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Func _SendKeys($hWnd, $keys) If $hWnd <= 0 Or StringLen($keys) = 0 Then SetError(-1) Return False EndIf $keys = StringUpper($keys) $keys = StringReplace($keys, "`", Chr($VK_OEM_3)) $keys = StringReplace($keys, "~", Chr($VK_OEM_3)) $keys = StringReplace($keys, "-", Chr($VK_OEM_MINUS)) $keys = StringReplace($keys, "=", Chr($VK_OEM_PLUS)) $keys = StringReplace($keys, "{ENTER}", Chr(0xD)) $keys = StringReplace($keys, "{TAB}", Chr(0x9)) $keys = StringReplace($keys, "{ESC}", Chr($VK_ESC)) $keys = StringReplace($keys, "{F5}", Chr($VK_F5)) $keys = StringReplace($keys, "{F12}", Chr($VK_F12)) $keys = StringReplace($keys, "{SHIFT}", "+") Local $i, $ret Local $shiftdown = False For $i = 1 To StringLen($keys) If StringMid($keys, $i, 1) = "+" Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001) $shiftdown = True Sleep(1) ContinueLoop Else $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0) If IsArray($ret) Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0])) Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000) EndIf EndIf If $shiftdown Then Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001) $shiftdown = False EndIf Next Return True EndFunc Edited March 30, 2006 by ljkkda Link to comment Share on other sites More sharing options...
GaryFrost Posted March 30, 2006 Share Posted March 30, 2006 i.e. expandcollapse popupGlobal Const $VK_OEM_PLUS = 0xBB Global Const $VK_OEM_MINUS = 0xBD Global Const $VK_OEM_3 = 0xC0 Global Const $VK_TAB = 0x9 Global Const $VK_ESC = 0x1B Global Const $VK_F5 = 0x74 Global Const $VK_F12 = 0x7B Run("notepad") WinWaitActive("Untitled") $window = WinGetTitle("Untitled") Dim $hWnd = ControlGetHandle($window,"","Edit1") _SendKeys($hWnd, "123123123"); using send keys Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Func _SendKeys($hWnd, $keys) If $hWnd <= 0 Or StringLen($keys) = 0 Then SetError(-1) Return False EndIf $keys = StringUpper($keys) $keys = StringReplace($keys, "`", Chr($VK_OEM_3)) $keys = StringReplace($keys, "~", Chr($VK_OEM_3)) $keys = StringReplace($keys, "-", Chr($VK_OEM_MINUS)) $keys = StringReplace($keys, "=", Chr($VK_OEM_PLUS)) $keys = StringReplace($keys, "{ENTER}", Chr(0xD)) $keys = StringReplace($keys, "{TAB}", Chr(0x9)) $keys = StringReplace($keys, "{ESC}", Chr($VK_ESC)) $keys = StringReplace($keys, "{F5}", Chr($VK_F5)) $keys = StringReplace($keys, "{F12}", Chr($VK_F12)) $keys = StringReplace($keys, "{SHIFT}", "+") Local $i, $ret Local $shiftdown = False For $i = 1 To StringLen($keys) If StringMid($keys, $i, 1) = "+" Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001) $shiftdown = True Sleep(1) ContinueLoop Else $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0) If IsArray($ret) Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0])) Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000) EndIf EndIf If $shiftdown Then Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001) $shiftdown = False EndIf Next Return True EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ljkkda Posted March 30, 2006 Author Share Posted March 30, 2006 runs perfect on notepad...but i want make a login script for thishttp://www.knuddels.de/applet_old.html?c=-3it works only if i have checked the Edit box not if minimized why? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 30, 2006 Moderators Share Posted March 30, 2006 Have you tried IE.au3? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ljkkda Posted March 31, 2006 Author Share Posted March 31, 2006 guys is it impossible to send trought the user 32.dll to this 3 contrl´s ?!http://www.knuddels.de/applet_old.html?c=-3i test now 4 - 5 days and nothing will workplease can anybody help me with that Link to comment Share on other sites More sharing options...
GaryFrost Posted March 31, 2006 Share Posted March 31, 2006 guys is it impossible to send trought the user 32.dll to this 3 contrl´s ?!http://www.knuddels.de/applet_old.html?c=-3i test now 4 - 5 days and nothing will workplease can anybody help me with thatThat happens with java scripts. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ljkkda Posted March 31, 2006 Author Share Posted March 31, 2006 that means its impossible with autoit? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 1, 2006 Moderators Share Posted April 1, 2006 (edited) that means its impossible with autoit?^^^ Free Bump, but at least peeps will see the post being deleted and re posted over and over for the bump Edited April 1, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now