Jump to content

Conditional Includes or Workaround


Recommended Posts

Congratulations, you now know how to write bad code.

Thanks, at least works for me ^^,

it's simple, the compiler when read an include just use all the code that is inside of the included au3, i could just past all that code myself instead, but i think in this way you have more organizated everything

this is my code

If $CmdLine[0] <> 0 Then
    Switch $CmdLine[1]
        Case "Nombres"
            #include "NombresCore.au3"
        Case "Contador"
            #include "ContadorCore.au3"
    EndSwitch

Else

    If @Compiled = 0 Then
        ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" Nombres')
        ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" Contador')
    Else
        ShellExecute(@ScriptFullPath, "Nombres")
        ShellExecute(@ScriptFullPath, "Contador")
    EndIf
EndIf

so you have 2 process running the same EXE but with different purposes

i will add the solution in the first post, so if anyway have the same problem that can help a little

Link to comment
Share on other sites

But it's stupid. Put the code inside a function. Call the function inside the conditional statements. Duh. Very basic problem very basic solution. The code you have now is a disaster waiting to happen. Using an #include file as a block of code in this manner is flat out bad programming and I'm exceptionally disappointed that the numerous MVPs who've seen this thread haven't come down on you for it.

Link to comment
Share on other sites

But it's stupid. Put the code inside a function. Call the function inside the conditional statements. Duh. Very basic problem very basic solution. The code you have now is a disaster waiting to happen. Using an #include file as a block of code in this manner is flat out bad programming and I'm exceptionally disappointed that the numerous MVPs who've seen this thread haven't come down on you for it.

i'm limited on how much autoit can offer. well at least look pretty decent to me

btw the exes work together, i have a GUI with multiple tabs just like Chrome but way basic :D

anyway i'm still waiting for a more professional way to do it without having to have multiple exes or a3x

Link to comment
Share on other sites

But it's stupid. Put the code inside a function. Call the function inside the conditional statements. Duh. Very basic problem very basic solution. The code you have now is a disaster waiting to happen. Using an #include file as a block of code in this manner is flat out bad programming and I'm exceptionally disappointed that the numerous MVPs who've seen this thread haven't come down on you for it.

I was just leaving him to fail... And to have you come along and talk to him :D

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