Jump to content

Select/End Select problem


 Share

Recommended Posts

I have made a script that pulls up a Gui with buttons asking for what spam i want. Problem is, every time I start the script it gives this error:

Posted Image

I can't figure out what the problem is and what to do

Here is the script:

#include <GUIConstants.au3>

GUICreate("Combos", 200,125)
$Renew = GUICtrlCreateButton("Renew", 70, 20, 70,30)
$LCtest = GUICtrlCreateButton("LCtest",70,55,70,30,)
$Spam = GUICtrlCreateButton("Spam" ,70,90,70,30,)
GUISetState(@SW_SHOW)


Select
    Case $msg = $Renew
      Global $Paused
    HotKeySet("{Home}","Renew")  ;Shift-Alt-d
    GUISetState(@SW_Hide)
    ;;;; Body of program would go here ;;;;
    While 1
        Sleep(100)
    WEnd
    Func Renew()
        $Paused = NOT $Paused
        While $Paused
            MouseClick ("Left",885, 539)
            Sleep (500)
            MouseClick ("Left",485, 223)
            Sleep (500)
            MouseClick ("Left",315, 501)
            Sleep (60000)
        WEnd
    EndFunc 
    Case $msg = $LCtest
        Global $Paused
    HotKeySet("{Pgdn}","LCtest")  ;Shift-Alt-d
    GUISetState(@SW_Hide)
    ;;;; Body of program would go here ;;;;
    While 1
        Sleep(100)
    WEnd
    
    Func LCtest()
        Send ("efr3453f3")
    EndFunc
    Case $msg = $Spam
        Global $Paused
    HotKeySet("{Home}","Spam")  ;Shift-Alt-d
    GUISetState(@SW_Hide)
    ;;;; Body of program would go here ;;;;
    While 1
        Sleep(100)
    WEnd
    Func Spam()
        $Paused = NOT $Paused
        While $Paused
            Send ("7")
            MouseClick ("left")
        WEnd
    EndFunc 
EndSelect
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Thanks :whistle:

Edited by stuckors
Link to comment
Share on other sites

It was working before I replaced the 6 with a 7. Then that error kept coming up.

On what planet?

How does it get past the 1st while loop?

Functions delcared in a select? think not

as Larry stated "Where to start"

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

That was from something I made before it and forgot to remove it. :whistle:

btw i just want to get past that error...

begin with take the functions out of the select and see what happens.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Moderators

How would i set up the hotkeys then?

With a shot of rum and a good woman :whistle:. Your structure is all wrong is what they are trying to tell you. It never worked the way you have before or after you added anything. You can't have a function within a function nor can you have a function within a conditional statement. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

With a shot of rum and a good woman ;). Your structure is all wrong is what they are trying to tell you. It never worked the way you have before or after you added anything. You can't have a function within a function nor can you have a function within a conditional statement.

I wonder how it worked before then... :whistle:
Link to comment
Share on other sites

Wish i knew what I had before....

Can you explain what that error i have is? And if you got any sugestions on how i could fix this please tell me :whistle:

We already have.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Moderators

So do we..... :whistle:

Makes 1 of us... I'm too tired to wonder how :P;) . My guess is everything you added after the Select/EndSelect is what killed it.
Select
    Case $msg = $Renew
      Global $Paused
    HotKeySet("{Home}","Renew")  ;Shift-Alt-d
    GUISetState(@SW_Hide)
    ;;;; Body of program would go here ;;;;
    While 1; you never exit this loop ever
        Sleep(100)
    WEnd
    Func Renew(); you have an entire function within the "conditional statement"
        $Paused = NOT $Paused
        While $Paused
            MouseClick ("Left",885, 539)
            Sleep (500)
            MouseClick ("Left",485, 223)
            Sleep (500)
            MouseClick ("Left",315, 501)
            Sleep (60000)
        WEnd
    EndFunc
    Case $msg = $LCtest
        Global $Paused
    HotKeySet("{Pgdn}","LCtest")  ;Shift-Alt-d........should probably set this before you get to the conditional statement?
    GUISetState(@SW_Hide); trying to s............OH FUCK IT, YOU TELL ME WHAT YOU WERE TRYING TO DO WITH THE REST....
    ;;;; Body of program would go here ;;;;
    While 1
        Sleep(100)
    WEnd
   
    Func LCtest()
        Send ("efr3453f3")
    EndFunc
    Case $msg = $Spam
        Global $Paused
    HotKeySet("{Home}","Spam")  ;Shift-Alt-d
    GUISetState(@SW_Hide)
    ;;;; Body of program would go here ;;;;
    While 1
        Sleep(100)
    WEnd
    Func Spam()
        $Paused = NOT $Paused
        While $Paused
            Send ("7")
            MouseClick ("left")
        WEnd
    EndFunc
EndSelect
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
I got to the 2nd or 3rd thing wrong in your issue, and I just can't see the sense in commenting every line of you code... see my comment, and you comment what you "think" you are doing with each line of code.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Makes 1 of us... I'm too tired to wonder how ;):whistle: . My guess is everything you added after the Select/EndSelect is what killed it.I got to the 2nd or 3rd thing wrong in your issue, and I just can't see the sense in commenting every line of you code... see my comment, and you comment what you "think" you are doing with each line of code.

Those comments that were there were copied from the help files cause I'm to lazy to type it all out. Copy and Paste is really easy.
Link to comment
Share on other sites

  • Moderators

Those comments that were there were copied from the help files cause I'm to lazy to type it all out. Copy and Paste is really easy.

Too lazy to copy and paste them "correctly" as well? If you're too lazy to do what you need to do to make your script work and look right syntax right, then don't bother posting until you get "unlazy". You're just a waist of space until then.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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