gilad 0 Posted June 28, 2010 Report Share Posted June 28, 2010 Hi,I did read and try out the advice given here:http://ubotug.com/index.php?/topic/2672-auto-start But seems the "Tab" and "enter" on the AutoIt script doesn't do the trick with the new Ubot files (tab is stuck on the top tabs only).Also tried the /auto but for some reason it works from Command shell but not from my task scheduler (Windows server 2008 R2). Any advice on how to autostart a bot? Even better, a pre-compiled bot? Quote Link to post Share on other sites
alcr 135 Posted June 28, 2010 Report Share Posted June 28, 2010 /auto works here. You would probably need " around the searchpath though Quote Link to post Share on other sites
gilad 0 Posted June 29, 2010 Author Report Share Posted June 29, 2010 Hi,/auto works via cmd shell but running the same command via Windows task scheduler seems to fail.I'll maybe try to wrap it in an AutoIt script to bypass that I guess... Any idea if /auto will work on compiled bots too? Quote Link to post Share on other sites
meter 145 Posted June 29, 2010 Report Share Posted June 29, 2010 Far as I know /auto doesn't work with compiled bots, but I am petitioning for it to be!!! Quote Link to post Share on other sites
Net66 54 Posted June 29, 2010 Report Share Posted June 29, 2010 Far as I know /auto doesn't work with compiled bots, but I am petitioning for it to be!!!Good luck! Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted June 29, 2010 Report Share Posted June 29, 2010 /auto does work. I tried it to one of my bot. Im running windows 7 OS. dont know on others. Quote Link to post Share on other sites
AKprogrammer 7 Posted June 29, 2010 Report Share Posted June 29, 2010 Hi,I did read and try out the advice given here:http://ubotug.com/index.php?/topic/2672-auto-start But seems the "Tab" and "enter" on the AutoIt script doesn't do the trick with the new Ubot files (tab is stuck on the top tabs only). Yeah the main problem with automating the new UBots is that you can't tab to the bottom pane which contains the play button and form fields. That definitely makes automating a little harder. I made a new AutoIt3 script for the new UBots... it opens the UBot, selects the correct tab, and mouses over the play button to press play. Here's the .exe file (more info on my blog). You can create this .exe file by compiling the script below in AutoIt3. Just don't move the mouse when it's trying to click play. ;Basic script AutoRun UBot - takes an .exe as parameter ;Directions: ;Put this .exe inside the same folder of the UBot .exe you want to AutoRun ;Call this script like this from console window or other app: ;AutoRunNewUBot.exe MyUbotExe.exe ;You can now optionally select the script index... (tab) you want to run ;AutoRunNewUBot.exe MyUbotExe.exe 2 ;Above would run the 2nd tab $totCommands = $CmdLine[0] If($totCommands <= 0) Then MsgBox(0, "Need parameter", "You didn't pass a UBot .exe to run."); Exit EndIf ;Move mouse to get rid of screensavers etc. $pos = MouseGetPos() MouseMove($pos[0] + 5, $pos[1], 5); $pos = MouseGetPos() MouseMove($pos[0] - 5, $pos[1], 5); Opt("MouseCoordMode", 0) Opt("PixelCoordMode", 0) $scriptIndex = 1 If($totCommands = 2) Then $exeFile = $CmdLine[1] $scriptIndex = $CmdLine[2] Else $exeFile = $CmdLine[1] EndIf $ubotPath = @WorkingDir & "\" & $exeFile ;RUN UBOT PROCESS ;========================================== $winName = runProcessGetWindowName($exeFile, $ubotPath); $hHandle = WinGetHandle($winName) Sleep(500) WinActivate($winName) WinWaitActive($winName) execNewBot() Func execNewBot() MouseClick("left", 17, 76, 1, 2) Sleep(500) pressKeyLoop("{DOWN}", $scriptIndex - 1) Sleep(500) Send("{ENTER}"); Sleep(500) ;DO A PIXEL SEARCH FOR THE PLAY BUTTON $blackCount = 0 ;how many in a row $playFound = False For $p = 75 To 575 $var = PixelGetColor( 27 , $p, $hHandle ) $hexCol = Hex($var, 6) If StringInStr($hexCol, "000000") Then $blackCount = $blackCount + 1 Else $blackCount = 0 EndIf If $blackCount > 6 Then $playPosition = $p - 3 ;writeToLogFile("Play button found at pixel location: 27," & $playPosition); $playFound = True ExitLoop EndIf Next MouseClick("left", 27, $playPosition, 1, 2) EndFunc Func pressKeyLoop($key, $howMany) If $howMany >= 0 Then ;DoubleCheck For $i = 0 To $howMany Sleep(200) Send($key) Next EndIf EndFunc Func runProcessGetWindowName($ProgramName, $programPath) $rPid = Run($programPath) ;MsgBox(0, "pid", "pid of run process is: " & $rPid) ;ProcessWait($rPid) Sleep(1000) ;Local $Processes = ProcessList() Local $Windows = WinList() Local $PIDSearch = 0 Local $WinSearch = 0 Local $PID $title = "" $maxTries = 20 ;$ProgramName = $ProgramName[$ProgramName[0]] While $title = "" $title = getNameFromPID($rPid) Sleep(1000) $maxTries = $maxTries - 1 If $maxTries < 0 Then Exit EndIf WEnd Return $title EndFunc Func getNameFromPID($rPid) Local $Windows = WinList() Local $WinSearch = 0 Local $PID For $WinSearch = 0 To UBound($Windows, 1) - 1 Step 1 $PID = WinGetProcess($Windows[$WinSearch][0]) $title = $Windows[$WinSearch][0] If $PID = $rPid Then ;And _ProcessGetName ($rPid) = $ProgramName Then If StringLen($title) > 0 And StringInStr($title, "UBot Studio Compiled Bot") Then If _ProcessGetName($rPid) = $exeFile Then ;writeToLogFile("Now monitoring process with WindowTitle: " & $title) ;MsgBox(0, "found pid", "found pid with title: " & $title) Return $title EndIf EndIf EndIf Next Return "" EndFunc Func _ProcessGetName( $i_PID ) If Not ProcessExists($i_PID) Then SetError(1) Return '' EndIf Local $a_Processes = ProcessList() If Not @error Then For $i = 1 To $a_Processes[0][0] If $a_Processes[$i][1] = $i_PID Then Return $a_Processes[$i][0] Next EndIf SetError(1) Return '' EndFunc As a side note... I'm looking to trade bots. If this post was helpful, PM me a list of your bots you're willing to trade (and have rights to give away), and I'll PM you back some of the bots and applications I've made that you might find useful. 3 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.