Jump to content

help for a coding newb :\


Sepz
 Share

Recommended Posts

k, im trying to make a bot that presses 1 button over and over.

the catch is, i need it to keep the window that its pressing the buttons in minimized. so i can press the button, and surf the web at the same time XD. its for a game called silkroad.

heres what i have so far.

$sTitle = "Gaia (New) - TIGGOBITTIES"

WinWait($sTitle)

$hWin = WinGetHandle($sTitle)

$buff1 = ControlSend($hWin, "", "", 1)

While 1=1

if $buff1 then

ControlSend($hWin, "", "", 1)

endif

Send ( "1" )

ControlSend($buff1, "", "", 1)

sleep(2000)

Wend

like i said im VERY new at this, infact i dont really know what im doing at all XD. i got the idea from this post http://sawboo.com/macrome/?p=18 , and just deleted/modified code to make it work (kinda LOL)

i thought "hey, if this guy can make something like that, i can too... i was wrong, but maybe u guys can help me :).

like i said, it switches to the window, and starts pressing the button. but i need it to be minimized the whole time, thanks guys

Link to comment
Share on other sites

cmon i know one of u knows... its almost all here, i just cant figure out why it wont do it while minimized >.<

btw i know im not supposed to bump for 24 hours, but i made this thread in the middle of the night lol

Link to comment
Share on other sites

First of all, welcome to AutoIt forums :)

2nd, Send() Function use like this: Send ("{1}"), not Send ( "1" )...

3rd, here is a little demo script, maybe can help you, I don't understand very well what do you want exactly (I'm bad in English :))

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$pressed = 0
$Form1 = GUICreate("Gaia (New) - TIGGOBITTIES", 242, 90, -1, -1)
$Button1 = GUICtrlCreateButton("Buff", 17, 16, 207, 57, 0)
GUISetState(@SW_SHOW)

While 1
    ControlClick($sTitle, "", "Button1")

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $pressed += 1
            TrayTip("Test", "Button pressed "& $pressed & " times...", 5 ,1)
            Sleep(1000)
    EndSwitch
WEnd
Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

I forgot, for minimizing, with this you can minimize that window:

Local $hWnd = WinGetHandle("[CLASS:Notepad]");from help scripts...
Local $sHWND = String($hWnd)   ; Convert to a string
WinSetState(HWnd($sHWND), "", @SW_MINIMIZE)

Just use AutoIt help...

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

i dont need it to automatically minimize, i just need it to send the commands to that window while its minimized. so it doesnt come back up while its pressing the button... i compiled what u gave me, and it still requires the window to be selected for it to press the button, i cant think of anything else, it should work the way i have it, but it doesnt... any ideas?

thanks

Link to comment
Share on other sites

ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window")

title The title of the window to access. 
text The text of the window to access. 
controlID The control to interact with. See Controls. 
string String of characters to send to the control. 
flag [optional] Changes how "keys" is processed:
  flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.
  flag = 1, keys are sent raw.
Edited by walle
Link to comment
Share on other sites

k, im trying to make a bot that presses 1 button over and over.

the catch is, i need it to keep the window that its pressing the buttons in minimized. so i can press the button, and surf the web at the same time XD. its for a game called silkroad.

heres what i have so far.

$sTitle = "Gaia (New) - TIGGOBITTIES"

WinWait($sTitle)

$hWin = WinGetHandle($sTitle)

$buff1 = ControlSend($hWin, "", "", 1)

While 1=1

if $buff1 then

ControlSend($hWin, "", "", 1)

endif

Send ( "1" )

ControlSend($buff1, "", "", 1)

sleep(2000)

Wend

like i said im VERY new at this, infact i dont really know what im doing at all XD. i got the idea from this post http://sawboo.com/macrome/?p=18 , and just deleted/modified code to make it work (kinda LOL)

i thought "hey, if this guy can make something like that, i can too... i was wrong, but maybe u guys can help me :).

like i said, it switches to the window, and starts pressing the button. but i need it to be minimized the whole time, thanks guys

If you want to send a "1" keypress to Gaia you can do it with a controlsend()

Something like this " ControlSend("Gaia (New)","","","1") - This is off the TOP OF MY HEAD. It's been a year or so since I did a minimized bot...

Because you've copied code, you're over complicating your script... making it harder for you to understand.

Break it down like this :

Step 1: Set a hotkey to run your script

hotkeyset("{INSERT}","BotFunc")

Step 2: Create a loop so that your script will stay running when you start it.

While 1

Sleep(100)

WEnd

Step 3: Create a function that will do your work. What I laid out is very basic. It sends a keypress, sleeps for 1 second and then starts over again.

((You'll find out that games keep track of keypresses and there are some things needed to make this script undetectable... message me sometime if you're interested.))

Func BotFunc()

While 1;This loops untill the script is ended.

ControlSend("Gaia (New)","","","1"); This sends a "1" to gaia window.

Sleep(1000) ; This sleeps for 1 second

WEnd; This closes the loop

EndFunc; This closes the func

Link to comment
Share on other sites

ok, i had it working last night. it would use meds by itself, but when i log 2 accounts in. it wants to snap to a screen. so whenever i start the script and it presses a button, it always focuses on that screen so it isnt even minimized anymore.

my script reads this

While 1=1

ControlSend("Gaia", "", "Edit1", "1")

Sleep(1000)

Wend

this script works until i bring up a second client.

the full client names are. Gaia (New) - Septum and Gaia (New) - TIGGOBITTIES

ive tried changing it to this.

ControlSend("Gaia (New) - TIGGOBITTIES", "", "Edit1", "1") and

ControlSend("TIGGOBITTIES", "", "Edit1", "1") no luck

if anyone can help me figure this out, it would be a great help, thanks all :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...