Jump to content

Recommended Posts

Posted

Im very new to Autoit and besides some scripts to annoy my brother, this is my first script. Im trying to make a script that signs me up on several guestlist for severals clubs in stockholm. But im using checkboxes to choose what day and club i want to sign up to before i press the "Do it" button. As far as i know, the easisiest way is to use If's for all the checkboxes, but I will have to do 25 different If's, which makes me think that there has to be an easier way of doing this. I though of Arrays, but im not familiar with arrays. any clue?

The script works fine for the first to, since thats where ive used If.

I know Mouseclick might not be the best solution, but i couldnt come up with any better. Any ideas?

btw, the progressbar is just for fun, i know it doesnt actually matters

Anyhow, heres the script.

CODE

#cs

namnet - 10,510

checkbox- kryssad=1, okryssad=4

sthlm kök o bar

---

fredag - 44,139

lördag - 44,152

namn - 44,192

email - 168,191

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

the vibe

drag 130,384 ---> 430,384

624,91 ---> 624,115

namn - 257,204

efternam - 257,229

email - 257,273

persn - 257,250

onsdag - 227,158

fredag - 227,185

lördag - 311,159

#ce

#include <GUIConstants.au3>

#include <IE.au3>

$title = "club"

$vanster = "15"

$mitten = "185"

$hoger = ""

Opt("MouseCoordMode", 0)

Opt("MouseClickDelay", 25)

Opt("MouseClickDownDelay", 25)

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

GUICreate($title, 640, 580, -1, -1, _

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 620, 360)

GUICtrlCreateLabel("Förnamn", $vanster, 380)

$fornamn = GUICtrlCreateInput("", $vanster, 395 , 150 , 20)

GUICtrlCreateLabel("Efternamn", $vanster, 420)

$efternamn = GUICtrlCreateInput("", $vanster, 435 , 150 , 20)

GUICtrlCreateLabel("Email", $vanster, 460)

$email = GUICtrlCreateInput("", $vanster, 475 , 150 , 20)

GUICtrlCreateLabel("Personnummer", $vanster, 500)

$personnummer = GUICtrlCreateInput("ååmmdd-xxxx", $vanster, 515 , 150 , 20)

$sthlm_fredag = GUICtrlCreateCheckbox("Candy Fredag", $mitten, 380)

$sthlm_lordag = GUICtrlCreateCheckbox("Candy Lördag", $mitten, 400)

$vibe_onsdag = GUICtrlCreateCheckbox("The Vibe Onsdag", $mitten, 440)

$vibe_fredag = GUICtrlCreateCheckbox("The Vibe Fredag", $mitten, 460)

$vibe_lordag = GUICtrlCreateCheckbox("The Vibe Lördag", $mitten, 480)

$button_do_it = GUICtrlCreateButton("Do it", $mitten, 505, 75, 30)

$thevibe = GUICtrlCreateButton("The Vibe", $mitten, 540, 75, 30)

GUICtrlCreateGroup("", 10, 370, 160, 200)

GUICtrlCreateGroup("", 180, 370, 160, 200)

GUISetState() ;Show GUI

_IENavigate ($oIE, "http://www.mycandy.se/mycandy/add_listan.aspx")

; Waiting for user to close the window

HotKeySet("!m" , "musen")

HotKeySet("!f" , "sthlm_fredag")

HotKeySet("!l" , "sthlm_lordag")

HotKeySet("!n" , "sthlm_input")

Func thevibe()

_IENavigate($oIE, "http://www.thevibe.se")

thevibe_input()

EndFunc

Func sthlm_input()

MouseClick("" , 44, 192)

Send("" & GUICtrlRead($fornamn) & " " & GUICtrlRead($efternamn))

sleep(50)

MouseClick("" , 168, 191)

Send("" & GUICtrlRead($email))

EndFunc

Func musen()

$pos = MouseGetPos()

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])

EndFunc

Func sthlm_fredag()

MouseClick("" , 44, 139)

EndFunc

func sthlm_lordag()

MouseClick("" , 44, 152)

EndFunc

func vibe_onsdag()

MouseClick("" , 227, 158)

EndFunc

func vibe_fredag()

MouseClick("" , 227, 185)

EndFunc

func vibe_lordag()

MouseClick("" , 311, 159)

EndFunc

;onsdag - 227,158

;fredag - 227,185

;lördag - 311,159

Func thevibe_input()

sleep(1500)

MouseClickDrag("", 130, 384, 430, 384)

MouseClickDrag("", 624, 91, 624, 115)

sleep(50)

MouseClick("" , 257, 204)

Send("" & GUICtrlRead($fornamn))

sleep(50)

MouseClick("" , 257, 229)

Send("" & GUICtrlRead($efternamn))

sleep(50)

MouseClick("" , 314, 250)

Send("{BACKSPACE 11}")

Send("" & GUICtrlRead($personnummer))

sleep(50)

MouseClick("" , 257, 273)

Send("" & GUICtrlRead($email))

sleep(500)

vibe_fredag()

sleep(50)

vibe_lordag()

sleep(50)

vibe_onsdag()

EndFunc

Func skicka_sthlm()

MouseClick("" , 250 , 200)

$sending = GUICreate("Sending...",220,100, -1, -1)

$progressbar1 = GUICtrlCreateProgress (10,10,200,20)

$progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH)

GUISetState ()

WinSetOnTop($sending, "", 1)

$i = 0

while $i < 800

$i = $i + 5

if $i < 99 then

GUICtrlSetData ($progressbar1,$i)

EndIf

if $i < 400 and $i > 100 then

GUICtrlSetData ($progressbar1,($i-100)/3)

EndIf

if $i < 425 and $i > 400 then

GUICtrlSetData ($progressbar1,($i - 400)*4)

EndIf

if $i < 800 and $i > 425 then

GUICtrlSetData ($progressbar1,($i-425)/4)

EndIf

GUICtrlSetData ($progressbar2,($i/8))

Sleep(5)

WEnd

GUIDelete($sending)

EndFunc

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $button_do_it

if GUICtrlRead($sthlm_fredag) = 1 and GUICtrlRead($sthlm_lordag) = 1 Then

sthlm_input()

sthlm_fredag()

skicka_sthlm()

sleep(1000)

WinActivate($title)

sthlm_lordag()

skicka_sthlm()

EndIf

if GUICtrlRead($sthlm_fredag) = 1 and GUICtrlRead($sthlm_lordag) = 4 Then

sthlm_input()

sthlm_fredag()

skicka_sthlm()

EndIf

if GUICtrlRead($sthlm_fredag) = 4 and GUICtrlRead($sthlm_lordag) = 1 Then

sthlm_input()

sthlm_lordag()

skicka_sthlm()

EndIf

if GUICtrlRead($sthlm_fredag) = 4 and GUICtrlRead($sthlm_lordag) = 4 Then

MsgBox(0, "Error", "have to mark a checkbox")

EndIf

Case $msg = $thevibe

thevibe()

EndSelect

WEnd

GUIDelete()

Exit

Thank you for your support

//how do i make the script box become bigger?

Posted

I haven't really looked at your code, but maybe it would be easier to have a combobox for all the clubs. Then you can easily add another club, and you only need to read one control.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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
  • Recently Browsing   0 members

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