Jump to content

#include or not #include...


Recommended Posts

... that is the question.

Thanks to all the epic support, and my genius (ha) (Mostly support and Reading :))

I have over 200 lines of so far..

Now i have about 10 functions, more coming..

Should i use include? and Run the functions from separate files?

Is that the whole point of including?

Is #include speeding up the program?

Or is it all just to be Neat and Tidy? (Which i would prefer if it is not slowing down the Program)

Link to comment
Share on other sites

#include is used to separate in logical (maybe reusable) units.

Before execution or compilation, AutoIt scans for #include-directives and replaces them with the content of the file.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

#include is used to separate in logical (maybe reusable) units.

Before execution or compilation, AutoIt scans for #include-directives and replaces them with the content of the file.

Since i am only using functions , and functions i reuse, its too keep track of things you mean right? :)

Thx ;) (Danke)

Edited by Schoening
Link to comment
Share on other sites

Include files make it easier to reuse code in multiple programs. You only need to maintain the one file instead of functions pasted into every app. The down side is if you want to give the user the source code, they may have to chase down a bunch of include files. This can be confusing to non-programmers.

That said I'm all for general-purpose include files. Also if you use SciTE in Tools menu you can use User Calltip Entries to enter the signatures for your functions. When you start typing the params will show as IntelliSense. It saves a lot of aggravation. I used to keep my include files as tabs so I could go look at the function params until I discovered the Calltips file.

Link to comment
Share on other sites

Include files make it easier to reuse code in multiple programs. You only need to maintain the one file instead of functions pasted into every app. The down side is if you want to give the user the source code, they may have to chase down a bunch of include files. This can be confusing to non-programmers.

That said I'm all for general-purpose include files. Also if you use SciTE in Tools menu you can use User Calltip Entries to enter the signatures for your functions. When you start typing the params will show as IntelliSense. It saves a lot of aggravation. I used to keep my include files as tabs so I could go look at the function params until I discovered the Calltips file.

Thx for the Tip, i have no Clue what the User Calltip Entries do atm, but i give it a try !

Link to comment
Share on other sites

  • Moderators

Schoening,

User CallTips are the syntax reminders you get in SciTE when you start filling in the parameters for a function. :)

If you want to know how to add your own functions to the list, take a look at the Adding UDFs to AutoIt and SciTE tutorial in the Wiki. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Schoening,

User CallTips are the syntax reminders you get in SciTE when you start filling in the parameters for a function. :)

If you want to know how to add your own functions to the list, take a look at the Adding UDFs to AutoIt and SciTE tutorial in the Wiki. ;)

M23

Thx ! :D i think this will be very usefull !

I have tried to do several PixelSearch in several areas to find the right pixel and determine which one is closest to the Center of the Screen..

It did not work very well.

But then i found this:

The most basic function allows you to find the pixel in a given color - as PixelSearch - but instead of returning the first found, it returns the closest to a given point.

Exactly what i need !

Is the Wiki Tutorial adding those files for me?

Because i am not sure if it is. In the Download from the Link there are: fastfind.dll and fastfind64.dll and 3 Au3 files. FastFind.au3, and two .au3 that i belive are examples of Fastfind.

I am not 100 % shure if i am supposed to put all files into a new map or just some.

Will i just #Include <fastfind.au3> in the future to use all its functions ?

Link to comment
Share on other sites

  • Moderators

Schoening,

You need to create a folder to hold your downloaded UDFS (and any you create yourself). The tutorial tells you how to get AutoIt and SciTE to recognise that folder as a valid #include folder. You still need to put the UDF files into that folder, but once in there you can use them just as you would the standard #include files that are installed with AutoIt. :)

You will still need to add all the functions in the UDF to the files mentioned in the tutorial if you want them to be colour-coded and have User CallTips. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Another way is to put the include in the same folder as you main script. Do that if you have includes only meant for one special script.

If an include contains DLLs, they have to be in the same folder as your main script, or in %PATH%. Sometimes, it is possible to specify the full DLL-path in a function like _UDFNAME_Startup(), too.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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

×
×
  • Create New...