Sign in to follow this  
Followers 0
Schoening

#include or not #include...

9 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#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

Share this post


Link to post
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.

Share this post


Link to post
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 !

Share this post


Link to post
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

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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 ?

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • rickybobby
      By rickybobby
      So I have several functions spread out among different scripts (makes it easier to sort out); Each with some sort of #include, lets say for ex: #include<arrays.au3>. so if in the main script I bring all these scripts together by #including them, then do they over and over #include<array.au3> again and again, unnecessarily bulking the main script up?
       
    • OliverA
      By OliverA
      Sorry for the stupid title but i don't know how to call it ( and how to search it )

      I have three question based on the same subject

      FIRST If i have a script like:

      If _IsPressed("10") ConsoleWrite("OK") And i'll try to execute i have an error because i don't have add at the top:

      #include <Misc.au3> ; >>>>>>>>>>> THIS! If _IsPressed("10") Then ConsoleWrite("OK") It's possible to add automatically the required #include without write it manually?

      SECOND If i have a script like:

      #include <ProgressConstants.au3> ; unnecessary #include <ListViewConstants.au3> ; unnecessary #include <WindowsConstants.au3> ; unnecessary #include <GUIConstantsEx.au3> ; unnecessary #include <GUIConstants.au3> ; unnecessary #include <GuiListView.au3> ; unnecessary #include <Constants.au3> ; unnecessary #include <GuiEdit.au3> ; unnecessary #include <WinAPI.au3> ; unnecessary #include <Array.au3> ; unnecessary #include <Date.au3> ; unnecessary #include <File.au3> ; unnecessary #include <Misc.au3> ; I NEED THIS ONLY! If _IsPressed("10") Then ConsoleWrite("OK") It's possible to remove automatically the unecessary #include?

      THIRD Based on the script of the second question, if i have add to a script an unecessary #include but in the script i don't have "call" it, it's just one line of unecessary code or in the build i have all the include file?

      I have the last stable + scite full.
      Thanks for the help
    • OneManPen
      By OneManPen
      I'm writing a tray based program, and for every different option the user selects, the icon changes... I add the
      #include"icon.ico" where icon.ico would be the icon name obviously... But when I compile the program with the offical autoit compiler it doesn't seem to include the icons... Any clue what I'm doing wrong?