Manus-Magnus Posted December 28, 2003 Share Posted December 28, 2003 HI, i'm building a script, very big one since it have more than 2000 lines, i have functions using 90% of space, any idea of i should separate in multiple parts/files this code ? tx you for suggestions MM http://www.premiumwanadoo.com/manus-magnus/ Link to comment Share on other sites More sharing options...
GEOSoft Posted December 28, 2003 Share Posted December 28, 2003 Put your functions in a logical order and use semi-colons to create comments? For example: ;Return the value of XYZ Function Func1() Your function code EndFunc ; ;Call application 123 Function Func2() Your function code EndFunc 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...
Manus-Magnus Posted December 28, 2003 Author Share Posted December 28, 2003 tx you i already do that. pb should be is it possible to put code in separate files, and use something like <include> ??? http://www.premiumwanadoo.com/manus-magnus/ Link to comment Share on other sites More sharing options...
Manus-Magnus Posted December 29, 2003 Author Share Posted December 29, 2003 erratum, by looking in bug report forums... it's not in standard help but: #include "c:\file.txt" works... http://www.premiumwanadoo.com/manus-magnus/ Link to comment Share on other sites More sharing options...
scriptkitty Posted December 29, 2003 Share Posted December 29, 2003 (edited) You can put common funtions you use often in your own file, and pull them into the main script.; my script $x=1 Func1($x) ... ... Exit #include "myfunctions.au3"; myfunctions.au3 ;Return the value of XYZ Function Func1() Your function code EndFunc ; ;Call application 123 Function Func2() Your function code EndFuncWarning, #include files will be all compiled together at the time you compile it into an exe. So if you plan on including a function file, or any other, it will be pulled in and compiled. If you change the function file, you will need to recompile in order to get any changes.This is unlike reading an external file, as say an INI file. for values, since #include files can have script executable code, it is compiled at the time you create the Exe. Edited December 29, 2003 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Manus-Magnus Posted December 30, 2003 Author Share Posted December 30, 2003 ah, thats perfect since all developped functions files are for 1 dedicated program project. in the case of real "libs" for differents projects, tx you , im warned now http://www.premiumwanadoo.com/manus-magnus/ Link to comment Share on other sites More sharing options...
MattNis Posted December 30, 2003 Share Posted December 30, 2003 have you tried optimizing your code into 500 lines or less?? do you see a pattern of repeating commands? like....if you were use MsgBox while blockinput(1)... you could create and use a separate function called mymsgbox($message) instead of constantly repeating blockinput(0) msgbox(.... blockinput(1) you'd have only one line instead of three..... [quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote] Link to comment Share on other sites More sharing options...
Manus-Magnus Posted January 2, 2004 Author Share Posted January 2, 2004 have you tried optimizing your code into 500 lines or less??do you see a pattern of repeating commands?like....if you were use MsgBox while blockinput(1)...you could create and use a separate function called mymsgbox($message)instead of constantly repeatingblockinput(0)msgbox(....blockinput(1)you'd have only one line instead of three.....yes man, im just a phsyco maniac about "factorise" (contatenate/optimize... im french sorry ) my code, i create alot generic functions with 1 to 8 entry parameters and arrays returns...for multiple usagebut now i have near 3000 lines.but with #include i select functions by "themes" ( i have 10 files of them actually) and use editor with "folder view" btw i can access in 2 sec fo the lib i need and make changes.i didnt founded a bug yet , this autoit3 is a fantastic tool tx you Jon ! and i will enjoy the final release !!ps: if you can optimise the pixelsearch integrated function that should be just great too http://www.premiumwanadoo.com/manus-magnus/ Link to comment Share on other sites More sharing options...
spt Posted January 9, 2004 Share Posted January 9, 2004 be sure to use a LOT of comments too it will make things a lot easier to edit later....... trust me. ~~ Safeguarding The Land ~~ 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