Sign in to follow this  
Followers 0
christian11

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

5 posts in this topic

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)
 
else
    call ("main")


    EndIF
    EndIF

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

    
    else
    call ("main")

  EndIF
  EndIF


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

    
    else
    call ("main")

  EndIF
  EndIF

EndFunc

 

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)
                EndIf
            Case 2
                Local $click2 = PixelGetColor(668, 349)
                If $click2 = (0x55556b) Then
                    MouseClick("primary", 668, 349, 10, 0)
                EndIf
            Case 3
                Local $click3 = PixelGetColor(520, 449)
                If $click3 = (0x55556b) Then
                    MouseClick("primary", 520, 449, 10, 0)
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>main

 

Share this post


Link to post
Share on other sites

i appreciate your help. but i forgot to say. it is inside the loop so puting inside the loop doesnt seem work

 

 

 

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Spoiler

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)

userbar.png

Share this post


Link to post
Share on other sites

Also if you play with loops look at: Exitloop

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  
Followers 0

  • Similar Content

    • WannaBeGut
      By WannaBeGut
      Hey,
      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.
    • Dhilip89
      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:
      Const $DEFAULT_RPC_ACCESS = $RPC_ACCESS_LOCALHOST to
      Const $DEFAULT_RPC_ACCESS = $RPC_ACCESS_REMOTE -
      Screenshots:

      Download Links:
      (Version 1.0) : http://www.mediafire.com/download/vcc1lacvmts21xd/AutoIt_RPC.zip
    • Command3r
      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

      thanks.