Jump to content
Sign in to follow this  
jimmyjmmy

how to do submodule

Recommended Posts

jimmyjmmy

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

)

Share this post


Link to post
Share on other sites
ChrisL

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

Share this post


Link to post
Share on other sites
jimmyjmmy

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

Share this post


Link to post
Share on other sites
jimmyjmmy

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jimmyjmmy

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

:)

ok, Thank You Very much PsaltyDS and members.

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  

×