DarkManX Posted February 28, 2012 Share Posted February 28, 2012 Hello, im trying to code a bot, that sends ENTER, waits 3sec and sends ENTER again. But that works just sometimes: Hotkeyset("{F1}","startBot") Hotkeyset("{F2}","stopBot") Func stopBot() Exit; EndFunc Func startBot() Sleep(100) Send("{ENTER}") Sleep(3000) Send("{ENTER}") EndFunc While 1 Sleep(1000) WEnd Sometimes it doesnt send the first, sometimes doesnt send the second ENTER. I dont know why, can somebody help pls?! TY Link to comment Share on other sites More sharing options...
rodent1 Posted February 28, 2012 Share Posted February 28, 2012 The first thing that comes to mind is that you don't know what application the {ENTER} is sent to. It depends on what has the focus at the time. And that might not be what you expect. If that's the case, I'd make sure the app I mean to get the {ENTER} has the focus at the right time with a WinActivate statement before each Send command. Link to comment Share on other sites More sharing options...
digiworks Posted February 28, 2012 Share Posted February 28, 2012 Alternatively to doing what rodent1 suggested and checking if the window is active, you could use ControlSend instead of Send and it would work even if the window isn't active. There is also a possibility that the software itself is the problem.. What program are you trying to send to? Out of helpfiles: ControlSend ( "title", "text", controlID, "string" [, flag] ) Link to comment Share on other sites More sharing options...
DarkManX Posted February 28, 2012 Author Share Posted February 28, 2012 Its Fifa12, i have to do always the same changes in the teamformation i want to hit just 1 button to make it. So now i made some changes: Func startBot() If WinActivate("FIFA") Then Sleep(3000) Send("{ENTER}") Sleep(2000) MsgBox(0,"","1") Else MsgBox(0,"","0") EndIf Endfunc It shows me the message 1 everytime, but doesnt sends ENTER. If i do this: Send("{ENTER}{ENTER}{ENTER}{ENTER}{ENTER}") it works sometimes, but i dont like it. there is a certain change it wont send it. What do i have to enter in controlID, i dont get it? I cant select the fifa-window via autoit window info tool, because fifa always gets fullscreen and there is no way to change it. Am I doing something wrong? Why it doesnt work? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 28, 2012 Moderators Share Posted February 28, 2012 DarkManX,Welcome to the AutoIt forum. Its Fifa12Unfortunately you appear to have missed the Forum Rules on your way in. Please read them now and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. 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 Link to comment Share on other sites More sharing options...
Recommended Posts