Jump to content
Sign in to follow this  

any idea how can i make goto? call function doesnt to seem work

Recommended Posts

I just wanted to return back to the main function if pixelgetcolor did not matched  similiar to goto, but it gaves me error whenever there's no pixelgetcolor matched 

any suggestions?

Func main()
    Local $RandomNumber = Random(1,3,1)
   If $RandomNumber == 1 Then
   Local $click1= PixelGetColor ( 458 , 163 )
   If $click1 = (0x55556b) then
   MouseClick("primary",458,163, 10 , 0)
    call ("main")


    If $RandomNumber == 2 Then
   Local $click2= PixelGetColor ( 668 , 349 )
   If $click2 = (0x55556b) then
   MouseClick("primary",668,349, 10, 0)

    call ("main")


   If $RandomNumber == 3 Then
   Local $click3= PixelGetColor ( 520 , 449 )
   If $click3 = (0x55556b) then
   MouseClick("primary",520,449, 10, 0)

    call ("main")




Share this post

Link to post
Share on other sites
Func main()
    While (True)
        Switch Random(1, 3, 1)
            Case 1
                Local $click1 = PixelGetColor(458, 163)
                If $click1 = (0x55556b) Then
                    MouseClick("primary", 458, 163, 10, 0)
            Case 2
                Local $click2 = PixelGetColor(668, 349)
                If $click2 = (0x55556b) Then
                    MouseClick("primary", 668, 349, 10, 0)
            Case 3
                Local $click3 = PixelGetColor(520, 449)
                If $click3 = (0x55556b) Then
                    MouseClick("primary", 520, 449, 10, 0)
EndFunc   ;==>main


Share this post

Link to post
Share on other sites

Look at the Return command, and think about setting a value (variable) that is then checked.

P.S. That means creating a function with your code, and running/calling that, instead of that same code within your main function ... outsourcing that part of the process, so to speak.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


Share this post

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
Sign in to follow this  

  • Similar Content

    • By Emmhor1
      Hi All,

      Is it possible to Call specific function within a GUI

      So I have a script with multiple functions although I don't want to use every function every time.
      My Idea is to create a simple GUI which allows me to select what functions I want to use then run the funtions by clicking a button.
      I have already made a GUI which allows me to select specific .exe's I would like to run after selection it runs the .exe one by one.
      This script is on my work laptops and cannot access it right now.
      Who can help me with this?
      Then have a boxes which allows me to select the specif Func.(I used GUIChecked and Unchecked in my other script)
      Then a button which executes/calls the selected functions
    • By CosminV
      Hello Guys,
      Could you please let me know if there is a possible way to call a number from PC to Phone using AUTOIT?
      Thank you for your time!
      Best regards,
    • By WannaBeGut
      I want to make a application which calls a User and returns the error / status of the call. I don't think it works, the status stays "routing". Not 100% sure what that means for me.
      $oSkype = ObjCreate("Skype4COM.Skype") $oUser = $oSkype.User("User") $oSkypeEvent = ObjEvent($oSkype,"Skype_") $oError = ObjEvent("AutoIt.Error","MyErrFunc") $cUserStatus_Offline = $oSkype.Convert.TextToUserStatus("OFFLINE") $cUserStatus_Online = $oSkype.Convert.TextToUserStatus("ONLINE") $cCallStatus_Ringing = $oSkype.Convert.TextToCallStatus("RINGING") $cCallStatus_Inprogress = $oSkype.Convert.TextToCallStatus("INPROGRESS") $cCallStatus_Failed = $oSkype.Convert.TextToCallStatus("FAILED") $cCallStatus_Refused = $oSkype.Convert.TextToCallStatus("REFUSED") $cCallStatus_Cancelled = $oSkype.Convert.TextToCallStatus("CANCELLED") $cCallStatus_Finished = $oSkype.Convert.TextToCallStatus("FINISHED") $cCallStatus_Busy = $oSkype.Convert.TextToCallStatus("BUSY") $cAttachmentStatus_Available = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE") If Not $oSkype.Client.IsRunning Then $oSkype.Client.Start() EndIf Func Skype_AttachmentStatus($aStatus) MsgBox(0,"","Attachment status " & $oSkype.Convert.AttachmentStatusToText($aStatus)) If $aStatus = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE") Then $oSkype.Attach() EndIf EndFunc While 1 If $oSkype.CurrentUserStatus = $oSkype.Convert.TextToUserStatus("ONLINE") Then ExitLoop Else $oSkype.ChangeUserStatus($oSkype.Convert.TextToUserStatus("ONLINE")) EndIf Sleep(1000) WEnd If $cUserStatus_Offline = $oSkype.CurrentUserStatus Then $oSkype.ChangeUserStatus($cUserStatus_Online) EndIf $oCall = $oSkype.PlaceCall($oUser.Handle); Start Call $callstatusraw = $oCall.Status;Raw Call Status $callstatus = $oSkype.Convert.CallStatusToText($callstatusraw);Call Status converted to Text While $callstatusraw <> $cCallStatus_Inprogress MsgBox(0, "", ""&$callstatus);Displays the Call Status WEnd The part until the $oCall Variable is from Andy Flesner (Airwolf123). But works fine.
    • By Dhilip89
      What is this?
      This is designed for allow any AutoIt scripts (must include UDF provided) to call remote functions (host script written in AutoIt) and consume returned results.
      How to allow remote client to call functions?
      Edit the AppHost.au3, change the following:

      Download Links:
      (Version 1.0) : http://www.mediafire.com/download/vcc1lacvmts21xd/AutoIt_RPC.zip
    • By Command3r
      Hi, at this path "@programfilesdir\AutoIt3\SciTE\api" there's file "au3.user.calltips.api" this file add funcs to autoit
      okay, now i added my func. but i want make it's color blue like other funcs.

      how should i do this

  • Create New...