francesco9696 Posted January 23, 2017 Posted January 23, 2017 I started a little autoit project. I didn't think I would make it big, so I putted all of my functions and includes in one unique au3 file (I know it's a bad idea). I have a file that is like #include <lib1> #include <lib2> #include <lib3> ;... Global $var1 = 1 Global $var2 = "df" Func a() ; do thinghs endfunc Func b() ;do things $something = a() endfunc Func c() ;do things $something = a() $else = b() endfunc ;and so on func main() ;... endfunc main() The problem is that the file is now 3000 lines and it became very difficult to move through. I would love to split my project into more files I tried splitting the function "by category", like ;; FILE funcs1.au3 func a() ;... endfunc func b() ;... a() endfunc ;FILE funcs2.au3 Func c() a() b() ;.. endfunc Func d() e() ;... Endfunc ;FILE funcs3.au3 Func e() c() ;... endfunc Func f() a() d() ;... endfunc But you see that when I need to include one another there is a problem: in function "d" (from funcs2.au3) I call function "e" which is in funcs3.au3, but in funcs3.au3 there is function "f" which call "a" and "d", so I need to include funcs1.au3 and funcs2 again. The function I wrote are nested and I can think a way to include all of them from one file to another. How can I achive this? Thank you and sorry for bad English.
mikell Posted January 23, 2017 Posted January 23, 2017 Suggestion : have a look at the #include-once directive
Moderators Melba23 Posted January 23, 2017 Moderators Posted January 23, 2017 francesco9696, I have a 4500 line script which I manage using the #region/#endregion directives which condense it down to a single line, quickly expandable to 16 sub-regions, each of which contain many functions. Using these directives means that you can retain everything in one file and yet still easily navigate around. More details are in the SciTE4Autoit3 help file - you doo use the full SciTE package? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
francesco9696 Posted January 23, 2017 Author Posted January 23, 2017 Just now, mikell said: Suggestion : have a look at the #include-once directive I tried using #include-once and including every file in every file, but I get "Duplicate function name." errors. Just now, Melba23 said: francesco9696, I have a 4500 line script which I manage using the #region/#endregion directives which condense it down to a single line, quickly expandable to 16 sub-regions, each of which contain many functions. Using these directives means that you can retain everything in one file and yet still easily navigate around. More details are in the SciTE4Autoit3 help file - you doo use the full SciTE package? M23 Yeah, it I could do like that, but sometimes I don't remember a function and when I need to call it, I need to scroll from the line where I'm coding back to the function I'm calling (also using the search feature) and then back to the original line and it's very annoying and time wasting. I use full SciTE, but I miss the quick goto function list feature that is present on other ide (in other languages).
Moderators Melba23 Posted January 23, 2017 Moderators Posted January 23, 2017 francesco9696, Do you use guinness' SciTEJump utility which is included in the package? Using that, along with the bookmark feature of SciTE, I find that I can very quickly move around inside my very large file. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Skysnake Posted January 24, 2017 Posted January 24, 2017 Hey @francesco9696, I understand what you are experiencing. @Melba23 has given good advice that I also use. In addition I make comments where I am working, eg If x=y Then ; 2017.01.23 added IF ;do something ELSE ; do somehting else ; 2017.01.23 - TODO add FOR loop here Endif Now I can search for TODO and the date, so I can jump to my workspace quickly. Skysnake Why is the snake in the sky?
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