ADS3 Posted June 20, 2009 Share Posted June 20, 2009 Well i'm trying to make a program that uses multiple scripts so can do multiple purposes and don't mix all on a single Au3, first i make the 3 Au3 then i make the main script that handle the Includes with something like this Switch $CMDline[1] Case "names" #include "Names.au3" Case "Owners" #include "owners.au3" Case Else #include "none" EndSwitch after the weird error, i notice that you can't conditionate includes. So, is there a workaround or UDF that i can use without have to compile multiple EXEs? any advice will help, and thanks ADS Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 20, 2009 Share Posted June 20, 2009 No such thing. That doesn't even make any sense. Link to comment Share on other sites More sharing options...
ADS3 Posted June 20, 2009 Author Share Posted June 20, 2009 i'm just trying to Run the proper Script without to compile multiple Exes or mess with mixes Au3s, also when i'm compiling the main Au3, it includes the others 3 Au3s. there should be a way to do it that's why i'm asking for help here Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 20, 2009 Share Posted June 20, 2009 You need multiple scripts for multiple programs. OR write large If statements and separate each program. Link to comment Share on other sites More sharing options...
ADS3 Posted June 20, 2009 Author Share Posted June 20, 2009 should be a way i will wait if someone else have a way to do this Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 (edited) Well i'm trying to make a program that uses multiple scripts so can do multiple purposes and don't mix all on a single Au3, first i make the 3 Au3 then i make the main script that handle the Includes with something like this Switch $CMDline[1] Case "names" #include "Names.au3" Case "Owners" #include "owners.au3" Case Else #include "none" EndSwitch after the weird error, i notice that you can't conditionate includes. So, is there a workaround or UDF that i can use without have to compile multiple EXEs? any advice will help, and thanks ADSI don't think you can stop or force any include file being used by having an If statement or any other logic in the script, so you have to create the file as you want it before you compile. The way you could do it is to have the include replaced by some special text say like this ;common script ~~~###include012###~~~ other stuff [code] Then you convert this as needed with a relatively simple script which lets you choose the version you want to compile. Maybe it remembers the options and maybe you select the includes you want to be used. This second script just has to do something like [code] $text = FileRead("commonScript.au3") $text = StringReplace("~~~###include012###~~~","#include <Names.au3>") $hf = FileOpen("temp1.au3",2) Filewrite($hf,$text) FileClose($hf) Run("Aut2exe.exe ...;see help for using Aut2exe.exe to compile scripts. I Edited June 20, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ADS3 Posted June 20, 2009 Author Share Posted June 20, 2009 Well i find out that you can acctually use a #include on a conditional, but it can't have Func inside, so i can run all the Fund First and in the Switch use the core Script. Yeah i know it's alot of work for something stupid, but it's better do that, and don't compile multiple sources codes everytime i make a new version Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 Well i find out that you can acctually use a #include on a conditional, but it can't have Func inside, so i can run all the Fund First and in the Switch use the core Script. Yeah i know it's alot of work for something stupid, but it's better do that, and don't compile multiple sources codes everytime i make a new versionYes, I'm forgetting about recent changes to AutoIt. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ADS3 Posted June 20, 2009 Author Share Posted June 20, 2009 yep it worked like i said, now i have everything on one EXE If $CmdLine[0] <> 0 Then Switch $CmdLine[1] Case "Nombres" #include "NombresCore.au3" Case "Contador" #include "ContadorCore.au3" EndSwitch ... #include "NombresFunc.au3" #include "ContadorFunc.au3" also i had to delete all the #includes like constanst and add it outside Link to comment Share on other sites More sharing options...
Valik Posted June 20, 2009 Share Posted June 20, 2009 Congratulations, you now know how to write bad code. Link to comment Share on other sites More sharing options...
Zedna Posted June 20, 2009 Share Posted June 20, 2009 You may look at A3X compiled scripts (without runtime library in it). You may compile your includes into A3X and then no need to recompile them when changing/recompiling main your script. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 21, 2009 Share Posted June 21, 2009 (edited) yep it worked like i said, ...No, it didn't. ... now i have everything on one EXE If $CmdLine[0] <> 0 Then Switch $CmdLine[1] Case "Nombres" #include "NombresCore.au3" Case "Contador" #include "ContadorCore.au3" EndSwitch ... #include "NombresFunc.au3" #include "ContadorFunc.au3" also i had to delete all the #includes like constanst and add it outside That made no sense at all. The entire contents of "NombresCore.au3" and "ContadorCore.au3" are included in the source where you put those lines (inside the Switch Case). How would the compiler know at compile time what your command line parameter was going to be at run time? Have you written a psychic compile function that can read parameters from the future? Yes, I'm forgetting about recent changes to AutoIt.What changes are you referring to, martin? Edited June 21, 2009 by PsaltyDS 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 More sharing options...
martin Posted June 21, 2009 Share Posted June 21, 2009 No, it didn't.That made no sense at all. The entire contents of "NombresCore.au3" and "ContadorCore.au3" are included in the source where you put those lines (inside the Switch Case). How would the compiler know at compile time what your command line parameter was going to be at run time? Have you written a psychic compile function that can read parameters from the future? What changes are you referring to, martin?I was referring to the changes that had obviously occurred after my previous post in this thread. These were even larger than I suspected because as you say the compiler now has to either foretell the future or to travel into the past, maybe both. It's all just getting too much for me Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
storme Posted June 21, 2009 Share Posted June 21, 2009 G'day ADS3 You mentioned in one of your earlier posts "and don't compile multiple sources codes everytime i make a new version"The trouble is (as I understand it) #include ALLWAYS adds the code from the included file when the file is run or compiled. So your code If $CmdLine[0] <> 0 Then Switch $CmdLine[1] Case "Nombres" #include "NombresCore.au3" Case "Contador" #include "ContadorCore.au3" EndSwitch ... #include "NombresFunc.au3" #include "ContadorFunc.au3" Will ALWAYS compile to If $CmdLine[0] <> 0 Then Switch $CmdLine[1] Case "Nombres" <THE CONETNTS OF "NombresCore.au3"> Case "Contador" <THE CONETNTS OF "ContadorCore.au3"> EndSwitch ... <THE CONETNTS OF "NombresFunc.au3"> <THE CONETNTS OF "ContadorFunc.au3"> Now your code will still work fine as the lines from "NombresCore.au3" and "ContadorCore.au3" will only be executed when the respective "case" conditions are true. BUT ALL of the code will be included in the compiled file. I hope that clarifies things a little. Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Inverted Posted June 21, 2009 Share Posted June 21, 2009 Since it's kinda on-topic, is there a discussion about whether the devs will implement include ...selection ? So the compiled executable is smaller and only important/useful code is included ? Link to comment Share on other sites More sharing options...
GEOSoft Posted June 21, 2009 Share Posted June 21, 2009 Since it's kinda on-topic, is there a discussion about whether the devs will implement include ...selection ? So the compiled executable is smaller and only important/useful code is included ?I doubt that it will ever be done in AutoIt but what you are asking for is possible using the AutoItWrapper directives. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Zedna Posted June 21, 2009 Share Posted June 21, 2009 (edited) Since it's kinda on-topic, is there a discussion about whether the devs will implement include ...selection ? So the compiled executable is smaller and only important/useful code is included ?Things NOT on the ToDo Listhttp://www.autoitscript.com/trac/autoit/wi...ItNotOnToDoList Edited June 21, 2009 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Inverted Posted June 21, 2009 Share Posted June 21, 2009 Are you confusing this with modularized compilation ? Selective including is different. Link to comment Share on other sites More sharing options...
Valik Posted June 21, 2009 Share Posted June 21, 2009 Are you confusing this with modularized compilation ? Selective including is different.Not really. It's the same concept. Link to comment Share on other sites More sharing options...
Inverted Posted June 21, 2009 Share Posted June 21, 2009 Hmm, sorry then, I thought that was about modularizing AutoIt's functions, not the include files (?) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now