Jump to content

window with buttons


BB4e
 Share

Recommended Posts

Link to comment
Share on other sites

ok

ma code is this far

but when i klicked one button and want to click it one more time it does nothing.

first klick works

#include <GuiConstantsEx.au3>

#include <EditConstants.au3>

#include <StaticConstants.au3>

#include <GuiEdit.au3>

GUICreate("loginbot", 150, 100)

$1=guictrlcreatebutton("CH1", 0, 0, 30)

$2=guictrlcreatebutton("CH2", 30, 0, 30)

$3=guictrlcreatebutton("CH3", 60, 0, 30)

$4=guictrlcreatebutton("CH4", 90, 0, 30)

$5=guictrlcreatebutton("CH5", 120, 0, 30)

GUICtrlCreateLabel("ID:", 10, 34)

GUICtrlCreateLabel("PW:", 10, 64)

$id=GuiCtrlCreateInput("", 40, 30, 100)

$pw=GuiCtrlCreateInput("", 40, 60, 100, 25, $ES_PASSWORD)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg(1)

Select

Case $msg[0] = $1

$ID=GUICtrlRead($id, 1)

$PW=GUICtrlRead($pw, 1)

Dim $pixel = PixelGetColor(266,292)

MouseMove(700,590)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(930,570)

MouseClick("left")

MouseMove(960,880)

MouseClick("left")

Send($ID)

Send("{TAB}")

Send($PW)

Send("{enter}")

Do

sleep(500)

$pixel = PixelGetColor(266,292)

Until hex($pixel) = 00400504

MouseMove(230,640)

MouseClick("left")

Case $msg[0] = $2

$ID=GUICtrlRead($id, 1)

$PW=GUICtrlRead($pw, 1)

Dim $pixel = PixelGetColor(266,292)

MouseMove(700,590)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(930,588)

MouseClick("left")

MouseMove(960,880)

MouseClick("left")

Send($ID)

Send("{TAB}")

Send($PW)

Send("{enter}")

Do

sleep(500)

$pixel = PixelGetColor(266,292)

Until hex($pixel) = 00400504

MouseMove(230,640)

MouseClick("left")

Case $msg[0] = $3

$ID=GUICtrlRead($id, 1)

$PW=GUICtrlRead($pw, 1)

Dim $pixel = PixelGetColor(266,292)

MouseMove(700,590)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(930,605)

MouseClick("left")

MouseMove(960,880)

MouseClick("left")

Send($ID)

Send("{TAB}")

Send($PW)

Send("{enter}")

Do

sleep(500)

$pixel = PixelGetColor(266,292)

Until hex($pixel) = 00400504

MouseMove(230,640)

MouseClick("left")

Case $msg[0] = $4

$ID=GUICtrlRead($id, 1)

$PW=GUICtrlRead($pw, 1)

Dim $pixel = PixelGetColor(266,292)

MouseMove(700,590)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(930,621)

MouseClick("left")

MouseMove(960,880)

MouseClick("left")

Send($ID)

Send("{TAB}")

Send($PW)

Send("{enter}")

Do

sleep(500)

$pixel = PixelGetColor(266,292)

Until hex($pixel) = 00400504

MouseMove(230,640)

MouseClick("left")

Case $msg[0] = $5

$ID=GUICtrlRead($id, 1)

$PW=GUICtrlRead($pw, 1)

Dim $pixel = PixelGetColor(266,292)

MouseMove(700,590)

MouseClick("left")

MouseClick("left")

Sleep(500)

MouseMove(930,638)

MouseClick("left")

MouseMove(960,880)

MouseClick("left")

Send($ID)

Send("{TAB}")

Send($PW)

Send("{enter}")

Do

sleep(500)

$pixel = PixelGetColor(266,292)

Until hex($pixel) = 00400504

MouseMove(230,640)

MouseClick("left")

Case $msg[0] = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

Edited by BB4e
Link to comment
Share on other sites

Do
    Sleep(500)
    $pixel = PixelGetColor(266, 292)
Until Hex($pixel) = 00400504

Look closely at this loop. External loop will not work until you finish this loop, ie until Hex($pixel) is not equal to "00400504".

Link to comment
Share on other sites

#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GuiEdit.au3>

GUICreate("loginbot", 150, 100)

$1 = GUICtrlCreateButton("CH1", 0, 0, 30)
$2 = GUICtrlCreateButton("CH2", 30, 0, 30)
$3 = GUICtrlCreateButton("CH3", 60, 0, 30)
$4 = GUICtrlCreateButton("CH4", 90, 0, 30)
$5 = GUICtrlCreateButton("CH5", 120, 0, 30)

GUICtrlCreateLabel("ID:", 10, 34)
GUICtrlCreateLabel("PW:", 10, 64)

$id = GUICtrlCreateInput("", 40, 30, 100)
$pw = GUICtrlCreateInput("", 40, 60, 100, 25, $ES_PASSWORD)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $1
            ConsoleWrite('1' & @CR)
        Case $msg[0] = $2
            ConsoleWrite('2' & @CR)
        Case $msg[0] = $3
            ConsoleWrite('3' & @CR)
        Case $msg[0] = $4
            ConsoleWrite('4' & @CR)
        Case $msg[0] = $5
            ConsoleWrite('5' & @CR)
        Case $msg[0] = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Everything works.

???

Link to comment
Share on other sites

no it does nothing

but thx

Yashied wants to know what you get if you run the script he posted and you click a button. Do you get a message printed?

If you are not using SciTE then maybe you wouldn't see the console output lines so change those lines like this

instead of

ConsoleWrite('1' & @CR)

write

MsgBox(262144,"Stage",1)

Then, if you get a message box for each button, simply add the MsgBox lines after your loops like this

Do
    Sleep(500)
    $pixel = PixelGetColor(266, 292)
Until Hex($pixel) = 00400504
MsgBox(262144,"Stage",1);or 2 or 3 etc

so you can be sure your script gets past them because Yashied suspects that you script is could be stuck in those loops. I think he is correct but it just needs you to add some debugging code as described above to test it.

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.
Link to comment
Share on other sites

im totally sure it gets through the loops, because when i click first time it works.

but if i wannt to click on more time it does not again.

I do understand. You have made a post asking for help, but natuarally when someone suggests something that might find out what's wrong you don't want to do it because ... er..because um. Why did you post again?

EDIT.Or look at it this way.

"Why doesn't this match light? I know it's ok because it worked the first time."

Edited by martin
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.
Link to comment
Share on other sites

ive got 2 problems beside my script.

1. i don't understand english very good and do not allwys know what youre saying.

2. im not very good in scite but im trying to make a script and dont know what i should do when you tell me sth.

now for understanding what you meamt i should do.

you think it does not get through this loop

Do
    Sleep(500)
    $pixel = PixelGetColor(266, 292)
Until Hex($pixel) = 00400504
Edited by BB4e
Link to comment
Share on other sites

ok i understood what you meant.

it does get stuck in the loop. i tested

im sorry if i made you angry.

No, I wasn't angry, I just couldn't work out your logic.

Have you solved the problem now?

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.
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...