neverlose Posted July 16, 2015 Posted July 16, 2015 (edited) Hello all.I am having the next code: http://pastebin.com/ngTvAi8GAnd it is not working for me. I have Windows 7 64 bit. Also tried on Win XP 32 bit and it also do not work.The key is in WM_KEYDOWN WM_KEYUP messages. I also tries WM_CHAR - don't works. But it works with MOUSE messages (KEYBOARD doesn't work). I tried to use mouse messages (button down or mouse move - it works, but there is another value of Lparam (coordiantates)).If you can help me with advance, I would very appreciate it. I also tried to use PostMessage function, but it also do not work. UPD: If I use PostMessage function, the space sending is working in my Chrome browser address bar, but it is not working in notepad. - It seems there's some kind of Windows security? Edited July 16, 2015 by neverlose
RaiNote Posted July 16, 2015 Posted July 16, 2015 (edited) "$botenabled" Bot for what? Edited July 16, 2015 by Melba23 Unneccessary quote removed C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~
neverlose Posted July 16, 2015 Author Posted July 16, 2015 ; Program process run While True ; If program is enabled If $botEnabled Then $hwnd = WinActive('') If $hwnd <> 0 Then _SendKey($hwnd, 0x20) ; 0x20 for Space Sleep(500) EndIf ; end of $hdwnd <> 0 EndIf ; end of If $botEnabled WEndIt is just a flag to start/pause of sending the space button
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 neverlose,Just why do you need to spam the {SPACE} button? And why not use the native Send function if you really need to do it?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
neverlose Posted July 16, 2015 Author Posted July 16, 2015 (edited) Space - is just to simplify the example.The Send() function sends keys only to the active window.But with DllCall I can pass custom $hwnd. So I can send keys to the window that is not active. For example: when the window is minimized. Edited July 16, 2015 by neverlose
JohnOne Posted July 16, 2015 Posted July 16, 2015 ControlSend() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 neverlose,What JohnOne said.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
neverlose Posted July 16, 2015 Author Posted July 16, 2015 ControlSend doesn't fit here. Because the $hwnd object may vary. Plus there's no ability to get the CondrolId in $hwnd for which the script will be used.
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 neverlose,ControlSend can take $hWnd as the first parameter - and there is not always a need to specify the ControlID as long as it does not need to be focused. To what inactive app are you trying to send these keystrokes?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
neverlose Posted July 16, 2015 Author Posted July 16, 2015 If ControlID is not required, then it may fit.I just tried to used the following command:ControlSend($hwnd, "", "", "{ENTER}exampletext", 0)But it don't passed the "{ENTER}" button to my $hwnd.If I change code to: ControlSend($hwnd, "", "", "exampletext", 0) and then I will press ENTER in my $hwnd manually the text "exampletext" is written correctly.
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 neverlose,If the text appears AFTER you press {ENTER} then surely you should use:ControlSend($hwnd, "", "", "exampletext{ENTER}", 0)Or evenControlSend($hwnd, "", "", "exampletext", 0) ControlSend($hwnd, "", "", "{ENTER}", 0)And you have still not indicated the nature of this inactive window to which you wish to send keystrokes.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
neverlose Posted July 16, 2015 Author Posted July 16, 2015 (edited) About $hwnd - It doesn't metter. I am trying this on active window (while testing). {ENTER} - toggles chat window. So In total I should get {ENTER}exampletext{ENTER}I tried to use {ALT} for example - it, also, doesn't passed to the $hwnd.But the $hwnd is special. If I try to use the same script in notepad or browser - the keys are send.I can guess that the $hwnd has some kind of security.Because I cannot explain why in one window (notepad) the special keys like {ENTER} {ALT} works, but in the other one (the special one) works only simple letters a-z and chars, but keys {ENTER} {ALT} etc. doesn't work. Edited July 16, 2015 by neverlose
neverlose Posted July 16, 2015 Author Posted July 16, 2015 (edited) Some tests:{!} - Sends 1{#} - Sends 3{SPACE} - Sends common space, as it should be. Edited July 16, 2015 by neverlose
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 neverlose,Because I cannot explain why in one window (notepad) the special keys like {ENTER} {ALT} works, but in the other one (the special one) works only simple letters a-z and chars, but keys {ENTER} {ALT} etc. doesn't workBecause certain "special" windows have anti-bot measurse to prevent you from interacting normally - and interaction with such windows is usually prohibited by the Forum rules. As you have now refused to answer my questions concerning the nature of this "special" window twice, I can only assume that the above is indeed the case (especially looking at your posting history) - so I am locking the thread. If you wish to inform me that the window is indeed legal, feel free to PM me and I will reopen it.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted July 16, 2015 Moderators Posted July 16, 2015 Hi,It seems that the special window was a "MU online" server - which of course the OP claims is not prohibited. Which part of:Launching, automation or script interaction with games or game servers, regardless of the gameis so hard for game-botters to understand? To me it seems quite clear - and there are no "special cases", so stop trying to pretend that you are the exception.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts