Jump to content

Hello experts i need help to finish this project. I'am student and newbie


Go to solution Solved by Jos,

Recommended Posts

Posted (edited)

   

#include <GUIConstantsEx.au3>
   GUICreate("AutoIT", 979, 297)
   GUICreate("AutoIT", 500, 663)
   GUISetState(@SW_SHOWMINIMIZED)


   HotKeySet("{F4}", "ExitProg1") ; ;;Sets F4 as a hotkey to exit the progam
   Global $g_iVariable = 0


   While 1

        


         If PixelGetcolor (500,663) = 3509706 Then 


            If PixelGetColor (979,297) = 10709289 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(28900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

              MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(28900)

            EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(28900)

            EndIf

            If PixelGetColor(979,297) = 7891747 Then

             MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(28900)

            EndIf

            

            If PixelGetColor(979,297) = 10709289 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(28900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(28900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

              MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(28900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

              MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(28900)

            EndIf


               If PixelGetColor(979,297) = 10709289 Then

                 Func _SelfRestart() 
                 
                ; code for returning in top of my code

                  EndFunc   ;==>_SelfRestart

               EndIf

            ;----------------------------------------------------------------

            If PixelGetColor(979,297) = 10709289 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(26900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(26900)

            EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(26900)

            EndIf


               If PixelGetColor(979,297) = 10709289 Then

                  Func _SelfRestart() 
                 
                ; code for returning in top of my code

                  EndFunc   ;==>_SelfRestart

               EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(27900)

            EndIf

            

            If PixelGetColor(979,297) =10709289 Then

               MouseClick("left",479,671);5PESOS;16pesos
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(26900)

            EndIf


               If PixelGetColor(979,297) = 10709289 Then

                 Func _SelfRestart() 
                 
                ; code for returning in top of my code

                  EndFunc   ;==>_SelfRestart

               EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",479,671)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(26900)

            EndIf


            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",479,671)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(26900)

            EndIf

               If PixelGetColor(979,297) = 10709289 Then


                   Func _SelfRestart() 
                 
                ; code for returning in top of my code

                  EndFunc   ;==>_SelfRestart

               EndIf


            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",479,671)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(26900)

            EndIf

            ;---------------------------------------------------------


            If PixelGetColor(979,297) = 10709289 Then

               MouseClick("left",596,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(25500)

            EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",596,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(25500)

            EndIf


               Func _SelfRestart() 
                 
                ; code for returning in top of my code

                  EndFunc   ;==>_SelfRestart

               EndIf


            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",596,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(300)
               MouseClick("left",941,541)
               Sleep(25500)

            EndIf

            If PixelGetColor(979,297) = 7891747 Then

               MouseClick("left",596,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",359,670)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(300)
               MouseClick("left",369,526)
               Sleep(25500)

            EndIf

         EndIf

WEnd

 

Edited by Melba23
Added code tags
Link to post
Share on other sites
  • Moderators

lenorcam,

Welcome to the AutoIt forums.

Using Pixel* and MouseClick functions is a pretty poor way of automating an app. Just what are you trying to do - we might be able to offer you a better solution, and perhaps get you a higher grade.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

lenorcam,

Quote

this is for learning purpose only

But of course.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Developers
7 minutes ago, lenorcam said:

Can you please write a code

Did you open the helpfile and check out ALL the examples of the different loop option like For...Next, While...Wend  etc?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
1 hour ago, Jos said:

Did you open the helpfile and check out ALL the examples of the different loop option like For...Next, While...Wend  etc?

Jos

Yes i try but like what i said I'm a student and new for coding 

Link to post
Share on other sites
  • Developers
  • Solution
3 minutes ago, lenorcam said:

Yes i try but like what i said I'm a student and new for coding 

That is no excuse so goes into the BS bucket!

Try again and this time show something with some substance that clearly shows what you have tried and isn't working.
On top of that you have to clearly tell us what it is your are trying to get done as  "this is for learning purpose only" is already dumped into that same BS bucket!

So try again and this time be absolutely clear. ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • 3 weeks later...

1: For bonus marks, study loops and passing parameters to functions and returning values. Add comments for what the values are that you are testing for in your code to make it self documenting,

pseudocode: If pixelcolorvalue = whatever, go call the function and pass values for mouseclick values. In your function do the mouseclicks using the passed values. You may not need to return any value in this example.

It makes you code more flexible, far shorter, and easier to read and debug.

2: Using "AutoIT" as the name for your GUI is asking for confusion. Make it unique. Does the second one need to be there with exactly the same name?

3: I'm curious why you are testing the exact edges of your created GUI screen?

4: What is the purpose of this code?

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

    No registered users viewing this page.

×
×
  • Create New...