Jump to content

Search the Community

Showing results for tags 'include'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 20 results

  1. Hi all. I have created an external au3 (a library of functions and vars) that is #included in a main script that i must compile. I wish that the content of the library is not merged with the main script when compiling. My goal is to keep the ability to modify the library even after the main exe is compiled and that these changes are effective when executing the exe. I guess this is not possible using the standard #include method. Is there a way to do that ? thx a lot :-)
  2. I have many scripts with dozens of UDF's that I want to put into my own Include file. I moved a UDF from one of my scripts to my own "Include file" I added the include script file to my script and the script ran OK. (#include <C:\folder\MyInclude.au3>) I thought "Wow", lets put a bunch of my UDF's into my include script and reduce my 1200 line script a whole bunch. No matter what I do, the second UDF that I moved out of my main script causes an error "Undefined function Abc2()" when I attempt to run the script. I have "include-once" at the top of the include script file. Thanks for your help
  3. Consider this example: This is MyInclude.au3 #Include-once Func Abc() Msgbox(0,'','Hello from "ABC" ') EndFunc Func Def() Msgbox(0,'','Hello from "DEF" ') EndFunc This is my main script: #include <C:\Folder\MyInclude.au3> Abc() ;Runs OK if Def() is commented out Def() ;Produces error "Undefined function" script does not run This is the structure that I see in all of the existing AutoIt "Include" scripts that am currently using. THIS particular script is not in the same location as all of the other "Includes" , that is why I have the path in the "Include" statement (Which works for ABC() ) Why does this not work?? Thanks for your help
  4. When I started using AutoIt, I used to dump all the community UDFs as well as my own frequently-used scripts into C:\Program Files (x86)\AutoIt3\Include - - terrible idea, of course, and I wouldn't advise anyone to do this. These days I have the following folder structure for UDFs: - I have a folder C:\AutoIt which has subfolders: - - C:\AutoIt\MyLibraries, which has my own scripts, organized as C:\AutoIt\MyLibraries\MyUDFName\MyUDFName.au3 - - C:\AutoIt\CommunityLibraries, which has scripts from other forum members, organized as: C:\AutoIt\CommunityLibraries\CommunityMemberUsername\UDFName\UDFName.au3 For example, I've been playing around with TheXman's "jq" UDF, and this is the storage path: This in itself won't make everything run. Some UDFs will have hardcoded DLL paths which you'll have to edit. And finally, you'll have to make registry edits so you can #include these UDFs without entering the entire path. Here's what I did: #include <Array.au3> #include <File.au3> Global Const $CUSTOMINCLUDE_REGKEYNAME = "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" Global Const $CUSTOMINCLUDE_REGKEYVALUENAME = "Include" Global Const $CUSTOMINCLUDE_REGKEYVALUETYPE = "REG_SZ" Global Const $FOLDER_COMMUNITYLIBRARIES = "C:\AutoIt\CommunityLibraries" Global Const $FOLDER_MYLIBRARIES = "C:\AutoIt\MyLibraries" Global $CUSTOMINCLUDE_REGKEYVALUE = "" Local $CommunityUsers = _FileListToArray($FOLDER_COMMUNITYLIBRARIES, "*", $FLTA_FOLDERS, False) _ArrayDelete($CommunityUsers, 0) Local $CommunityLibraries = 0 Local $UDFPath = "" For $i = 0 To UBound($CommunityUsers) - 1 $CommunityLibraries = _FileListToArray($FOLDER_COMMUNITYLIBRARIES & "\" & $CommunityUsers[$i], "*", $FLTA_FOLDERS, False) _ArrayDelete($CommunityLibraries, 0) For $j = 0 To UBound($CommunityLibraries) - 1 $UDFPath = $FOLDER_COMMUNITYLIBRARIES & "\" & $CommunityUsers[$i] & "\" & $CommunityLibraries[$j] If FileExists($UDFPath) Then $CUSTOMINCLUDE_REGKEYVALUE &= $UDFPath & ";" Next Next Local $MyLibraries = _FileListToArray($FOLDER_MYLIBRARIES, "*", $FLTA_FOLDERS, False) _ArrayDelete($MyLibraries, 0) For $j = 0 To UBound($MyLibraries) - 1 $UDFPath = $FOLDER_MYLIBRARIES & "\" & $MyLibraries[$j] If FileExists($UDFPath) Then $CUSTOMINCLUDE_REGKEYVALUE &= $UDFPath & ";" Next $CUSTOMINCLUDE_REGKEYVALUE = StringTrimRight($CUSTOMINCLUDE_REGKEYVALUE, 1) ConsoleWrite($CUSTOMINCLUDE_REGKEYVALUE) RegWrite("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "Include", "REG_SZ", $CUSTOMINCLUDE_REGKEYVALUE) This script scans the "CommunityLibraries" and "MyLibraries" folders and adds all the folder paths where the folder name matches the au3 file name to the registry. So far, it has worked out great for me, because now I can use this: #include <jq.au3> instead of: #include "C:\AutoIt\CommunityLibraries\TheXman\jq\jq.au3" Okay, that's all, I hope this'll be useful for newbies who want an easy system for storing their UDFs :)
  5. I whittled down much code and have isolated my problem to where a #include is located in the code, but apparently do not understand the scope of #include. In the example code below I open up a window, then when you press Alt+W I open a second window with a List All button. Clicking the List All button invokes a _DebugArrayDisplay(). At line 4 and 50 are the #include <Debug.au3> for the _DebugArrayDisplay(). If I comment out the line 4 #include <Debug.au3> the program crashes. I thought the line 50 #include <Debug.au3> would work however it does not, so I'm concluding I don't understand what' going on. Any assistance greatly appreciated. #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK #include <Debug.au3> ;for _DebugArrayDisplay() ;<-- commenting this out makes it fail vs #include at line 50 ??? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) ;create an example window with an edit control Local $hGUI = GUICreate("Test", 500, 400) ;the main window Local $cIDEdit1 = GUICtrlCreateEdit("Edit control #1", 10, 10, 200, 250, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL)) GUISetState(@SW_SHOW, $hGUI) ;show it MsgBox(262144, "USAGE", "Example window." &@CRLF&@CRLF& "Press Alt+W (once or twice) after clicking OK to enter window/control mode.") Local $nMsg While 1 ;this is your code main loop $nMsg = GUIGetMsg() If $nMsg <> 0 Then ;we have a message so Switch $nMsg ;Check for GUI events Case $GUI_EVENT_CLOSE ;the GUI is closed red [X] is clicked Exit Case Else ;do nothing EndSwitch ;End running through GUI events. Else ;no message Sleep(100) ;do something in your program EndIf ;---------------------------------------------------------------------------------------------------------------------------+ ;ADD this function into your $nMsg loop after the $nMsg EndIf ;as shown here or in your While 1 loop so it gets executed | _WindowControlOperations() ;let's go into move/adjust window/control operations if Alt+W pressed | ;comment out this function call when all done, or delete it | ;---------------------------------------------------------------------------------------------------------------------------+ WEnd ;------------------------------------------ this code below intended to be in a UDF eventually ---------------------------------------- Local $hDLL = DllOpen("user32.dll") ;also Global to all functions called - DO NOT close as calling program may be using user32.dll ;actually we CAN close it as user's call to same user32.dll will have a different handle #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK #include-Once #include <Debug.au3> ;for _DebugArrayDisplay() ;<-- this one does not seem to work, only one in user's program above seems to work #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <Misc.au3> ;for _IsPressed() #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) Func _WindowControlOperations() ;called by user program and only continues below if Alt+W pressed else returns to calling program above If NOT ( ((_IsPressed("12") = 1) AND (_IsPressed("57") = 1)) ) Then ;check for Alt+W ;12 ALT key, 57 W key ; default DLL=user32.dll Return(0) ;as Alt+W not pressed Else ;Alt+W pressed to call rest _WindowControlOperationsContinue() EndIf EndFunc ;Func _WindowControlOperations() Func _WindowControlOperationsContinue() ;Alt+W was pressed Global $aWindowControlLog[1][3] = [ ["Window/Control", "Title", "Left, Top, Width, Height"] ] ;element [0] [Row][Column] ;v2a - create an Instructions window Global $iLeft = 0, $iTop = 0, $iWidth = 0, $iHeight = 0 ;init values Global $sStatus = "$iLeft, $iTop, $iWidth, $iHeight" &@CRLF& $iLeft &", "& $iTop &", "& $iWidth &", "& $iHeight ;create main Instructions window Global $hWndInstructions = GUICreate("Instructions", 300, 457) ;the main instructions window Local $sInstructions = "Click List All to list all adjustments made." &@CRLF& _ " " &@CRLF& _ "Click upper right X to exit program." ;create an edit control - into which we'll put the instruction text Local $cIDInstructions = GUICtrlCreateEdit("", 10, 10, 280, 300, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) ;no , $WS_HSCROLL)) Global $sStatus = "$iLeft, $iTop, $iWidth, $iHeight" &@CRLF& $iLeft &", "& $iTop &", "& $iWidth &", "& $iHeight Global $hStatus = _GUICtrlEdit_Create($hWndInstructions, $sStatus, 10, 318, 280, 50) Global $idButton_List = GUICtrlCreateButton("List All" &@CRLF& "Sizes/Positions", 152, 412, 139, 35, 0x2000) ;create control button ,0x2000=multi-line GUISetState(@SW_SHOW, $hWndInstructions) ;show window and edit controls ControlSetText("", "", $cIDInstructions, $sInstructions) ;show instructions ControlSetText("", "", $hStatus, $sStatus) ;show status _While1() ;enter our message loop Return(0) ;to main calling program EndFunc ;Func _WindowControlOperationsContinue() Func _While1() Local $nMsg While 1 ;look for button presses $nMsg = GUIGetMsg() If $nMsg <> 0 Then ;we have a message so Switch $nMsg ;Check for GUI events Case $GUI_EVENT_CLOSE ;the GUI is closed red [X] is clicked GUIDelete($hWndInstructions) ;destroy the Instructions window and all controls therein Return(0) ;to Func _WindowControlOperationsContinue() Case $idButton_List _DebugArrayDisplay($aWindowControlLog, "$aWindowControlLog") ;<-- problem here with #include <Debug.au3> scope Case Else ;do nothing EndSwitch ;End running through GUI events. Else ;no message - do nothing ;no message EndIf WEnd ;While 1 EndFunc ;Func _While1()
  6. Func z009() If FileExists("search\009\009.au3") Then #include <search\009\009.au3> EndIf EndFunc This wont work... Is there any workarround for this or I should do it in a different way?
  7. How do i add a path to a file in Include. I want my script to get the udf in the same folder as the script/exe: Include "@ScriptDir/udf.au3" can this be done?
  8. I have recorded a gui installation and modified the au3 file as per my requirement. But the problem is, whenever I try to compile the au3 file, I am getting a special character on top of the file. Can you suggest how to resolve this as it is appearing everytime during compilation. And also I am trying to include a au3 file which is separate folder so I am adding the <..\Library.au3> line. It is able to pick that but in that file "Library.au3" there is a file install line. FileInstall(".\SendMail.ps1", @ScriptDir & "\SendMail.ps1") Library.au3 is being used by many other codes in the previous folder.. But the current file is looking for the ps1 file in current folder. So is there any option to tell the compiler to pick the dependent files relative to Library.au3 instead of the current code.
  9. Hey AutoIT Community, Just wanted to know if there is a way I can #include all *.au3 files in my script without having to #include each individual .au3 file. For instance, currently I have a laundry list of #includes like this: #include <IE.au3> #include <Inet.au3> #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GuiMenu.au3> [ECT...ECT...] Would there be a way I could include all of the files above or all .au3 file in a one liner? That way I do not have to burn up a bunch of lines of code for just my includes.... Your help is greatly appreciated...
  10. Is there possibility to do it like this? Cause as I see compiler doesn't see If statement in case of #include functions. It includes these two files all time. If $var == True Then #include 'func/funcsByTabs/main_Moda.au3' Else #include 'func/funcsByTabs/main_Others.au3' EndIf
  11. Good afternoon AutoIt community!, I was on Stackoverflow the other day and came across this question: How To Include Files From A Directory. This got me thinking... There has to be a way to do it... After a bunch of research, I wasn't able to find anything. So, I created this UDF to dynamically include every file from the directory. Of course, there are some bugs that I'd like to fix eventually, but for the most part, it works. Simply call the main function (Shown below) right after the rest of the includes before any of your actual code, and the UDF will include all of the au3 files in the specified directory. Without further ado, here is the _includeDir UDF and how to use it! _includeDir.au3 Download this code (_includeDir.au3 attached as well) and place it into the directory with your current script. Next, include it in your main file. For now, I'm going to be using one called Example.au3. #Include "_includeDir.au3" Now, include whatever else you're going to be including in this script, then call the _includeDir function. NOTE: THIS MUST BE CALLED AT THE TOP OF THE SCRIPT, BEFORE ANY CODE IS WRITTEN! THE FUNCTION FORCES THE SCRIPT TO RESTART SO PUTTING IT LATER IN THE SCRIPT WILL RE-RUN THE CODE! Example.au3 #Include "_includeDir.au3" #Include <File.au3> ; Not needed. Just here as an example of a normal script. #Include <Array.au3> ; Not needed. Just here as example of normal script. _includeDir("Directory to Include") MsgBox(0,"Example","This is just an example!") See how the function is called near the top? This is the proper use of the UDF. If you had a folder called "Directory to Include" and had a bunch of .au3 files inside of it, the function would include them all into the Example.au3 script. If you run the Example.au3 file now, it will most likely tell you "The directory Things to Include does not exist!". Make sure you enter the name of the directory you're trying to include. Just as a side note, when including files, you should put all of the code in the INCLUDED files inside of functions so they aren't automatically run when included. Variables can be outside of the functions so they are automatically set. Remember, if you have a variable in one included file with the same name of variable in another included file, it will be overwritten with whichever include file was included last. Anyways, if you have pointed the directory to include parameter to a folder that exists and run the Example.au3, it will generate a folder called IncludeDirUDF. It will also write a new line inside of Example.au3. It will write the line on line one. Of course, you don't always want it to be written to line one, right? Maybe you want this bit of code to be written on line 3 in order to keep your code organize. Is there a way to do this? Absolutely! Simply add the line number as a second parameter to the function. For example, we want to have this bit of code written on line 3, we would set up our Example.au3 file to look like this. #Include "_includeDir.au3" #Include <File.au3> ; Not needed. Just here as an example of a normal script. #Include <Array.au3> ; Not needed. Just here as example of normal script. _includeDir("Directory to Include", 3) MsgBox(0,"Example","This is just an example!") See how we added the 3 to the end of _includeDir? This will tell the function to write the #Include "IncludeDirUDF\loadIncludes.au3" on line 3 of Example.au3. Note, the line HAS TO EXIST in order to be written to it. For example, if your Example.au3 code only has 6 lines, and you specify to be written on line 7, it WILL NOT WORK. The code is designed to include and restart in order to process the included files. For some reason, if you want to JUST generate the included file and NOT restart, you can add one more parameter to the code. If you don't want the code to restart, simply set your code up to look like this: #Include "_includeDir.au3" #Include <File.au3> ; Not needed. Just here as an example of a normal script. #Include <Array.au3> ; Not needed. Just here as example of normal script. _includeDir("Directory to Include", 3, False) MsgBox(0,"Example","This is just an example!") Note, if you set this last parameter to false, it will simply generate the included file and write to line 3 of Example.au3 (As specified before) and exit before the code reaches the MsgBox() and it will not be displayed. The last important thing to note: In order to re-include a different set of files, you must delete the #Include "IncludeDirUDF\loadIncludes.au3" from your main script (In this case, Example.au3) and delete the generated file, IncludeDirUDF. Now you can simply rerun Example.au3 and it will include any the dir with any changes you made to it. Only .au3 files should be in the directory you're trying to include as it will not process the other files and will generate an error. I hope this UDF helps somebody out! Comment any questions/concerns you may have and I will try to address them as soon as possible! Thanks, Timothy CEO - Amarok Studios _includeDir.au3
  12. Hey guys I have a script in which I have included some self-made files in the script directory. In these files I have various variables defined. This is how the file is included and then called in the main script: #include "Data\test.au3" MsgBox(0,"",$variable1) test.au3 could contain something like: $variable1 = "Hello1" $variable2 = "Hello2" $variable3 = "Hello3" Now, if I want to change the value of $variable1 and then run the script, no problem. The script uses the new edited variable. But If I compile the script, the includes are compiled within the EXE file as intended. Now, if I change the value of $variable1 and run the EXE file, it doesn't look for my change, since it uses whatever variable that was defined when the script was compiled. Is there any way that I can have files with variables that changes, and then have a compiled version using these changes, without having to compile again? Thanks in advance. David
  13. Is there any way to skip the execution of a particular block of code like any condition or expression, if the au3 file is included as library.? Like, in my code I wrote all the functionality as functions and called them in 4 lines. Now I have another requirement where I need to use the same code but different.So I am importing this code so that I can use these functions. But the code block which is outside the functions (main code) is being executed when I import the au3 file.Is there any condition to check whether the file is running directly or included in another au3 file as library, so that I can keep the same here. Please suggest if any ideas.
  14. Hello , X:\Root Folder\Sub Folder Root Folder contains the script to include in the script located in Sub Folder... Is it possible without specifying the exact path? #include "X:\Root Folder\Sub Folder" Thanks in Advance! TD
  15. in the file button/ BLoginvip72.au3 I want to get data of file input/ Passwordvip72.au3 and input/Usernamevip72.au3 in file button . #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include "..input/Passwordvip72.au3" #include "..input/Usernamevip72.au3" :(, Erros ,Please, help me.
  16. Hello, I was browsing the help file (as recommend by many members) & I found out a new way to include a file I am using this: #include "...\Includes\StringSize.au3"But I get this error: Error opening the file I have already re-checked the filenames Thanks in advance, TD
  17. www.autoitscript.com/forum/topic/155442-arraymulticolsort-initial-release-16-oct-13 When I try to include Melba's ArrayMultiColSort.au3 in my large program and the current beta, I get this... So I thought it must be an incompatibility with the beta. But if I put just the before mentioned code in a new file, it *does* seem to accept the include in the beta! Therefore my question...
  18. I don't know why there are many external files that are not existed on the pre-written functions of AutoIt software.. The examples in this page are telling to include "MsgBoxConstants.au3" but I doesn't have one: http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm Where can I download the TRUSTED and the official "MsgBoxConstants.au3" file?
  19. 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?
  20. I have a GUI script and setup Case with Variables and then functions for each case. The script runs fine with no errors until I add something into this one function (for a button on the GUI that when pushed, should simply launch a website). Not sure if I need the entire code here or if someone can identify whether I'm just unable to accomplish this within a Func / EndFunc. Syntax Check shows no errors in the script when this portion of the script is simply: Func _OpenDIDButton() EndFunc But when I take that portion of the script, and add something inside of it, such as: Func _OpenDIDButton() #include <IE.au3> _IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = 1]]]]] ) EndFunc Then I run Syntax Check and it reports: C:\Program Files\AutoIt3\Include\WinAPIError.au3(29,1) : ERROR: syntax error Func ^ Is that referencing line 29, character 1? Line 29 is in this portion: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GenChecklistButton _GenCheckListButton() Case $EmailMgrsButton _EmailMgrsButton() Case $DisableADButton _DisableADButton() Case $OpenDIDButton _OpenDIDButton() EndSwitch WEnd
  • Create New...