Page 1 of 1

GUI help

Posted: 17 May 2018, 11:19
by exbuzz
Hi guys,
Just need some help with a GUI, not very experienced with them. I will paste the script below. I have made a bot that gets me stuff from a website in under 4 seconds, assuming the address has been saved, it is very useful as when the website drops hyped items, I can buy them fast. Basically I want an input box where you can enter card number, security code and expiration date. The card number and security code are what I assume to be quite easy as the variables are stated at the start of the script and can be altered. However, the arrangement I have with the expiry date is more relative to the website. obviously on most websites you enter expiry date from a drop down menu. The site I have programmed for uses a drop down menu also, however the current month and year is what it is automatically set too. For example the month now is may (5) and 2018, if my expiry date was October (10) and 2019, the arrangement would be:

Code: Select all

 send {tab}
  send {enter}
  send {down 5}
  send {enter}
this goes from the previous box, to the current month box, presses enter, moves the highlighted box down 5, to October. After this, the code is:

Code: Select all

sleep, 5
  send {tab}
  send {enter}
  send {down 1}
  send {enter}
This takes the highlighted 2018 to 2019.
This means I have to update the bot every month, decreasing the amount the highlighted box needs to move.
I thought of using image search instead, so it finds the "10" in the drop down, however when it gets to October 2018, the image search will not be carried out as the image it is looking for will have changed colour. Also I assume it makes it harder for the GUI to change the expiration date as you would need a collection of pictures and a way of getting around the highlighted month that changes monthly.


Overall, I would love help for these things:
1. Creating an input box for the card number, along with some sort of enter box, that submits it into the code.
2. the same box and button, except for a 3 digit security code
3. A drop down menu for the month and year that somehow correlates to the code which selects the drop down menu on the site
4. A way of selecting the information on the drop down menu for the site, that would not have to be changed monthly but does not compromise the GUI

any help is greatly appreciated :D

If anyone is wondering, the website is supremenewyork.com

----------------------------

Code: Select all

#SingleInstance, Force 
Gui, -AlwaysOnTop
Gui, Font, s10, courier
Gui, Add, Text, x10 y10, The First Truly Untraceable Supreme Bot 
Gui, Add, Button, x100 y300 w300 h30 gSupreme_Bot, Let's Cook
Gui, Color, white
Gui, Show, w500 h500, Supreme Bot - By Ben Danziger
return

GuiClose:
ExitApp
Return

Supreme_Bot:
credit_card := "1234 5678 1234 5678"
credit_card_pin := "123"
SetWorkingDir %A_ScriptDir%
SetWorkingDir, ?C:\Users\bdanz\Documents\AHK
coordmode, mouse, screen
coordmode, pixel, screen
while(FoundX_1 == null)
{
  ImageSearch, FoundX_1, FoundY, 0,380, 1905, 920, ?C:\Users\bdanz\Documents\AHK\addtobasket.png
  ImageSearch, FoundX_1, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_MyDocuments%\AHK\addtobasket.png
}
mousemove, %FoundX_1%, %FoundY%
click 
sleep, 150
while(FoundX_2 == null)
{
  ImageSearch, FoundX_2, FoundY, 473, 463, 620, 493, ?C:\Users\bdanz\Documents\AHK\checkoutnow.png
  ImageSearch, FoundX_2, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_MyDocuments%\AHK\checkoutnow.png
}
mousemove, %FoundX_2%, %FoundY%
click 
sleep, 3000
while(FoundX_3 == null)
{
ImageSearch, FoundX_3, FoundY, 473, 463, 620, 493, ?C:\Users\bdanz\Documents\AHK\cardnumber.png
  ImageSearch, FoundX_3, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_MyDocuments%\AHK\cardnumber.png
}
mousemove, %FoundX_3%, %FoundY%
click 
send, %credit_card%
sleep, 5
  send {tab}
  send {enter}
  send {down 5}
  send {enter}
sleep, 5
  send {tab}
  send {enter}
  send {down 1}
  send {enter}
sleep, 10
  send {tab}
send, %credit_card_pin%
while(FoundX_4 == null)
{
ImageSearch, FoundX_4, FoundY, 0, 678, 1918, 1045, C:\Users\bdanz\Documents\AHK\terms.png
  ImageSearch, FoundX_4, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_MyDocuments%\AHK\terms.png
}
mousemove, %FoundX_4%, %FoundY%
Click 
sleep, 10
while(FoundX_5 == null)
{
ImageSearch, FoundX_5, FoundY, 950, 775, 1918, 1045, ?C:\Users\bdanz\Documents\AHK\processpayment.png
  ImageSearch, FoundX_5, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_MyDocuments%\AHK\processpayment.png
}
mousemove, %FoundX_5%, %FoundY%
Click 
Reload
return






escape::ExitApp
always use code tags for ahk scripts!

Re: GUI help

Posted: 17 May 2018, 19:46
by Hellbent
is this what you mean by inputs?

Code: Select all

#SingleInstance,Force

Card_Number:="123 456 789"
Card_Pin:="123"
EX_Date:=1
Gui,1:+AlwaysOnTop
Gui,1:Color,Black
Gui,1:Font,cWhite s12 Q4 ,Segoe UI Black
Gui,1:Add,Groupbox,x10 y10 w150 h60 Section,Card Number
Gui,1:Add,Edit,cBlack xs+10 ys+25 w130 r1 vCard_Number gSubmit_All ,% Card_Number
Gui,1:Add,Groupbox,xs+170 y10 w100 h60 Section,Card Pin
Gui,1:Add,Edit,cBlack xs+10 ys+25 w80 r1 vCard_Pin gSubmit_All ,% Card_Pin
Gui,1:Add,Groupbox,x10 ys+70 w270 h60 Section,Expire Date
Gui,1:Add,DDL,cBlack xs+10 ys+25 w250 AltSubmit vEX_Date gSubmit_All,Jan||Feb|march|April|May|June|July|Aug|Sept|Oct|Nov|Dec|
Gui,1:Add,Button,x10 ys+70 w270 r1 gTest_This,GO

Gui,1:Show,,Blah Blah Blah
Gui,1:Submit,NoHide
return
GuiClose:
GuiEscape:
*^Esc::
	ExitApp

Submit_All:
	Gui,1:Submit,NoHide
	return
Test_This:
	Gui,1:+OwnDialogs
	msgbox,The card number is %Card_Number% `nThe Card Pin is %Card_Pin% `nThe Month is %EX_Date% `n Once you close this message the script will `nwait 3 seconds and then send the arrow key down %EX_Date% times.
	sleep,3000
	 send {down %EX_Date%} 
	return

Re: GUI help

Posted: 18 May 2018, 06:43
by DRocks
Hey Hellbent its nice to see a post of you herr. Just letting you know that you really helped me alot to start my AHK journey!! From.your YouTube channel! For instance your Gui tutorials for example!

Cheers
All the best

Re: GUI help

Posted: 18 May 2018, 14:33
by Hellbent
DRocks wrote:Hey Hellbent its nice to see a post of you herr. Just letting you know that you really helped me alot to start my AHK journey!! From.your YouTube channel! For instance your Gui tutorials for example!

Cheers
All the best
I'm glad to have helped in what little way I could :)

Re: GUI help

Posted: 18 May 2018, 18:12
by exbuzz
Hi Hellbent, Thanks for the help so far, I have learnt a lot from the script you sent back and altered it slightly.

I have attached it below for you to run.

I would like it so, when I enter card details etc, when you press the button, it changes %card_number% or %card_pin% to the one entered in the script.

There are a few other things I would like to do with it as well but don't want to ask too much of you. You have been a great help so far, please tell me if you would like to continue work on this so you can help with few other minor issues.

Anyway, here is the script,
Thanks!

#SingleInstance,Force

Card_Number:="1234 5678 1234 5678"
Card_Pin:="123"
EX_Date:=1
EX_Date2:=1
Gui,1:-AlwaysOnTop
Gui,1: Show, w415 h275, Supreme Bot - By Ben Danziger
Gui,1:Color, ee0606
Gui,1:Font,cWhite s14 Q4 ,courier
Gui,1:Add,Groupbox,x20 y30 w230 h60 Section,Card Number
Gui,1:Add,Edit,cBlack x35 y55 w200 h80 r1 vCard_Number gSubmit_All ,% Card_Number
Gui,1:Add,Groupbox,xs+260 y30 w100 h60 Section,Pin
Gui,1:Add,Edit,cBlack xs+10 ys+25 w80 r1 vCard_Pin gSubmit_All ,% Card_Pin
Gui,1:Add,Groupbox,x20 ys+80 w230 h60 Section,Expiry Date
Gui,1:Add,DDL,cBlack xs+10 ys+25 w210 AltSubmit vEX_Date gSubmit_All,January||Febuary|March|April|May|June|July|August|September|October|November|December|
Gui,1:Add,Groupbox,xs+260 ys+0 w100 h60 Section,Year
Gui,1:Add,DDL,cBlack xs+10 ys+25 w80 AltSubmit vEX_Date2 gSubmit_All,2018||2019|2020|2021
Gui,1:Add,Button,x20 ys+90 w360 r1 gTest_This, Set Details / Start


Gui,1:Show,,Supreme Bot
Gui,1:Submit,NoHide
return
GuiClose:
GuiEscape:
*^Esc::
ExitApp

Submit_All:
Gui,1:Submit,NoHide
return
Test_This:
MsgBox, I would like it so when this button is pressed, the details set above are implemented into the script, and the script window minimizes
return