Results 1 to 10 of 10

Need a little help from a smart person

This is a discussion on Need a little help from a smart person within the AutoHotKey Help/Training forums, part of the General/Help category; Ok so I am trying to make a bot in AHK..I never use this and its my first time no ...

  1. #1
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default Need a little help from a smart person

    Ok so I am trying to make a bot in AHK..I never use this and its my first time no hating LOL..I know various programming languages and such and figured this would be easy, but its not LOL

    Anyway, I have 2 questions. 1 How do you impliment the gmail trick into the bot for the the first 2 imput fields?

    And #2 it submits to the search at the top of the page and not the register button, how do you define what submit button on a page when has more than one?

    Here is what I have so far which doesnt work.

    I used the COM tutorial for most of that while I further my understanding..I dont want to be spoonfed,so if someone can help can you explain what your answer is and means and not just say here. K thanks

    FileInstall, IMDB.txt, IMDB.txt

    #Include Com.ahk
    Gui +LastFound
    Gui, Add, Edit, x12 y12 w110 h20 vuserinput1, Email
    Gui, Add, Edit, x132 y12 w110 h20 vuserinput2, Confirm Email
    Gui, Add, Edit, x12 y42 w110 h20 vuserinput4, Year of Birth
    Gui, Add, Edit, x132 y72 w110 h20 vuserinput5, Zip postal code
    Gui, Add, Edit, x12 y72 w110 h20 vuserinput6, Country
    Gui, Add, Edit, x132 y102 w110 h20 vuserinput7, password
    Gui, Add, Edit, x12 y102 w110 h20 vuserinput8, confirm password
    Gui, Add, Button, x132 y132 w110 h20 , OK
    COM_AtLaxWinInit()
    pwb:=COM_AtlAxGetControl(COM_AtlAxCreateContainer( WinExist(), 1, 1, 500, 500, "shell.explorer") )
    COM_Invoke(pwb, "Navigate", "https://secure.imdb.com/register-imdb/?why=personalize")
    Gui, Show, x100 y200 h500 w500, Bot
    Return

    ButtonOK:
    Gui, Submit, NoHide

    JS := "javascript:document.getElementById('email1').valu e='" userinput1 "';void(0)"
    JS1 := "javascript:document.getElementById('email2').valu e='" userinput2 "';void(0)"
    JS2 := "javascript:function D(a,b){c=b.split('|');d=false;for(q=0;q<c.length;q ++){if(c[q]==a)d=true;}return d;}function E(){f1=document.forms[1];for(i=0;i<f1['gender'].length;i++){if(D(f1['gender'][i].value,'F')){f1['gender'][i].checked=true;}}}E()"
    JS4 := "javascript:document.getElementById('year').value= '" userinput4 "';void(0)"
    JS5 := "javascript:document.getElementById('postal').valu e='" userinput5 "';void(0)"
    JS6 := "javascript:document.getElementById('country').val ue='" userinput6 "';void(0)"
    JS7 := "javascript:document.getElementById('pass1').value ='" userinput7 "';void(0)"
    JS8 := "javascript:document.getElementById('pass2').value ='" userinput8 "';void(0)"
    JS9 := "javascript:document.forms[0].submit()"

    M = 1
    loop
    {
    COM_Invoke(pwb, "Navigate", JS)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS1)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS2)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS4)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS5)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS6)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS7)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS8)
    Sleep, 100
    COM_Invoke(pwb, "Navigate", JS9)
    Sleep, 100
    Sleep, 2500
    COM_Invoke(pwb, "Navigate", "https://secure.imdb.com/register-imdb/?why=personalize")
    Sleep, 1500
    }
    GuiClose:
    Exitapp[/CODE]
    Last edited by Nachoman; 05-29-2010 at 12:24 PM.

  2.   Alt These ads help cover server costs and such.


  3. #2
    nick761 is offline 3.14159265358979323846264
    Join Date
    May 2008
    Location
    United States
    Posts
    1,056

    Default

    For the first question, just ask them for their Gmail username before @gmail.com. Then, generate a random number after a + sign. Here's how to do it:

    Code:
    ; Code here for the GUI's username field
    ; Then at the start of the loop...
    Random, num, 1, 10000000
    email = %emailusername%+%num%@gmail.com
    For the second problem, you need to get the ID of the element and can then do document.getElementById("XXX").click();

    Finally, a suggestion. You don't have to use "userinput" for all of your veriables. Why not turn them into something meaningful like firstName or lastName? You could just ctrl+h the two instances of each to replace them easily without problems.
    Test out an early version of my SonyRewards bot! Check it out
    GSN Oodles Answer Database - The original GSN answer database, now with over ten thousand answers.
    gPrize - A fast, lightweight, and customizable Oodles prize checker.

  4. #3
    armman's Avatar
    armman is offline Subscriber
    Join Date
    Apr 2008
    Location
    India
    Posts
    1,301

    Default

    Register button seems to have no ID. You might have to use ControlClick command.
    hmm ... mmk?

  5. #4
    Septimas's Avatar
    Septimas is offline IIm Отец ваш отродье
    Join Date
    Jun 2009
    Location
    Khazakstan, Russia
    Posts
    953

    Default

    Post in
    [/code brackets please.

  6. #5
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    Ok after reading more, I found the window spy. And I figured out the coordinates and how to define them using this, but I dont know if its right

    ControlClick, x321 y505, WinTitle ;

    But it doesnt work. So, any pointers would be greatly appreciated
    Last edited by Nachoman; 05-29-2010 at 12:35 PM.

  7. #6
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    [Today 11:40 AM] Precise: with controlclick you are limited by the way that command is formatted
    [Today 11:40 AM] Precise: and always works
    [Today 11:39 AM] Precise: posting it is cleaner
    [Today 11:39 AM] Septimas: Yay well i finally understand controlclick a lil bit now.
    [Today 11:39 AM] [PM] Septimas: ControlClick, x1163 y581, Register at IMDb.com - Mozilla Firefox idk much about AHK but that works on my firefox window. All you need to do is get your GUI and COM Browser running, then replace the coords by finding with autoitwindow spy, and get the browser window name (like Nachos bot ) etc
    [Today 11:39 AM] Precise: bettar example
    [Today 11:38 AM] Precise: http://privatepaste.com/4b0672db95
    [Today 11:38 AM] Nachoman: Thank you I will see what I can do with that, I think I had it wrong because yours looks different than what I was using
    [Today 11:37 AM] Septimas: Change coords to fit your bot and rename the Register at IMDB.com - Mozilla Firefox to whatever your GUI window name is
    [Today 11:37 AM] Precise: hardcoded for internet explorer_server1 but you can change that
    [Today 11:37 AM] Septimas: ControlClick, x1163 y581, Register at IMDb.com - Mozilla Firefox
    [Today 11:36 AM] Precise: the CX- and CY- are for the offset of the control
    [Today 11:36 AM] Septimas: fuck thing froze on my screen
    [Today 11:36 AM] Septimas: got it
    [Today 11:36 AM] Precise: http://privatepaste.com/575886d068

  8. #7
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    http://pastebin.com/cyVRPrKt

    Here is the bot..But it still doesnt click the button. If anyone can finish this and make it click the button and tell me how did it I would greatly appreciate the assistance. Thanks in advance if anyone can

  9. #8
    nick761 is offline 3.14159265358979323846264
    Join Date
    May 2008
    Location
    United States
    Posts
    1,056

    Default

    Since there's no ID, just do this to click the button:

    Code:
    javascript:document.forms[1].submit();
    Notice the 1 - 0 is the first form on the page, 1 is the second, 2 is the third...
    Test out an early version of my SonyRewards bot! Check it out
    GSN Oodles Answer Database - The original GSN answer database, now with over ten thousand answers.
    gPrize - A fast, lightweight, and customizable Oodles prize checker.

  10. #9
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    OMG That was so much easier LOL..Thanks you truly are the man. Now I can use this to work off of and learn more. And it works finally. Seriously thanks Nick

  11. #10
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    So on some sites just logging out isnt enough, how do you clear cookies in AHK? I think thats the last thing I havnt been able to figure out. I found a couple examples around here, but nothing that just clears cookies. Any help would be greatly appreciated. As always thanks in advance. And thank you to all the people who have helped me so far with learning AHK.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Facebook Bots | Admin Forum