Jump to content

how to do submodule


Recommended Posts

Hi,

Can someone here point to me the command for writing submodule. Example :-

here are the various statements

if statements Then

do stuffs here

if true Then

perfom this submodule-A

else

do stuffs here

-----------------

submodule-A (

doing all the stuff here

and here etc..

)

Link to comment
Share on other sites

Is this what you mean?

For $i = 1 to 2
    
    If $i = 1 then 
        Stuff1()
        Elseif $i = 2 then 
        Stuff2()
    EndIf
    
Next

    



Func Stuff1()
    Msgbox(0,"Stuff1","$i = 1 so use stuff1 function")
EndFunc


Func Stuff2()
    Msgbox(0,"Stuff2","$i = 2 so use stuff2 function")
EndFunc
Link to comment
Share on other sites

Yes, correct.

Thanks.

Is this what you mean?

For $i = 1 to 2
    
    If $i = 1 then 
        Stuff1()
        Elseif $i = 2 then 
        Stuff2()
    EndIf
    
Next

    
Func Stuff1()
    Msgbox(0,"Stuff1","$i = 1 so use stuff1 function")
EndFunc
Func Stuff2()
    Msgbox(0,"Stuff2","$i = 2 so use stuff2 function")
EndFunc
Link to comment
Share on other sites

I have a question, should I declare the subroutine before or after Stuff1()

Thanks

Is this what you mean?

For $i = 1 to 2
    
    If $i = 1 then 
        Stuff1()
        Elseif $i = 2 then 
        Stuff2()
    EndIf
    
Next

    
Func Stuff1()
    Msgbox(0,"Stuff1","$i = 1 so use stuff1 function")
EndFunc
Func Stuff2()
    Msgbox(0,"Stuff2","$i = 2 so use stuff2 function")
EndFunc
Link to comment
Share on other sites

I have a question, should I declare the subroutine before or after Stuff1()

AutoIt uses the term "function" instead of subroutine. And AutoIt does not care where in the script a function is declared (before or after it is used).

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...