Jump to content

Going Into A Function


Recommended Posts

Hey Fellas,

I have a function called _Button2_Pressed(). And I have another function called Func script_1b(). My question is, how do I run Function _Button2_Pressed() after script_1b()? In my previous scripts, I was told to place the function within a while loop. Like so

...While 1
    If WinExists("", "") Then
         _Button2_Pressed()

    EndIf
    WEnd

but I'm a little unsure this time.

Here is Func script_1b()........

Func script_1b()
    sleep(5000)
    ControlFocus("HyperVRE", "", "Button1");this is where the mouse over the Msgbox for 0 or 1 selected keywords.
    ControlSend("HyperVRE", "", "Button1","{ENTER}")
    sleep(4000)
    ControlFocus ("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC10" );this is where the mouse over the 'close button'.
    ControlSend("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC10","{ENTER}")
    sleep(4000)
    ControlFocus ("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2" );This is the "Suggest Keywords"
    ControlSend("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2","{ENTER}")
    sleep(3000)
    #region --- ScriptWriter generated code Start --- 
    Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)
WinWait("Step 1 - Keyword Selection","")
If Not WinActive("Step 1 - Keyword Selection","") Then WinActivate("Step 1 - Keyword Selection","")
WinWaitActive("Step 1 - Keyword Selection","")
MouseMove(738,20)
MouseDown("left")
MouseUp("left")
 _Button2_Pressed()

You can see I have Func_Button2_Pressed() just hangin there.....how can I execute it?

Thanks in advance
Link to comment
Share on other sites

Where's your EndFunc?

If you want a function to execute after another function, just call the function you want at the end of your first function, before the EndFunc of the first function.

Func script_1b();this is the script AutoIT follows if 0 or 1 keywords are selceted.
    ;Right here you need the script to close HyperVRE,grab the next $Firstline keyword.
    sleep(5000)
    ControlFocus("HyperVRE", "", "Button1");this is where the mouse over the Msgbox for 0 or 1 selected keywords.
    ControlSend("HyperVRE", "", "Button1","{ENTER}")
    sleep(4000)
    ControlFocus ("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC10" );this is where the mouse over the 'close button'.
    ControlSend("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC10","{ENTER}")
    sleep(4000)
    ControlFocus ("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2" );This is the "Suggest Keywords"
    ControlSend("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2","{ENTER}")
    sleep(3000)
    #region --- ScriptWriter generated code Start --- 
    Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)
WinWait("Step 1 - Keyword Selection","")
If Not WinActive("Step 1 - Keyword Selection","") Then WinActivate("Step 1 - Keyword Selection","")
WinWaitActive("Step 1 - Keyword Selection","")
MouseMove(738,20)
MouseDown("left")
MouseUp("left")
 _Button2_Pressed()

EndFunc

Like so?

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