Search the Community
Showing results for tags 'include path'.
-
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 :)
-
OK so long story short about a year ago I upgraded auto it and have pretty much had problems since. Mostly stemming from the fact that my scripts were old enough to be using different library file versions. Since a bunch of my stuff does production level work I can't afford to have it break on every update so what I want to do is isolate all the include files per script. ie each new script would get it's own folder for the au3 and a complete copy of the libraries at the time it was written. Thus all it's dependencies would be self contained and each script could be upgraded individually. Now I know I can explicitly put a path for my includes. for example if i had array.au3 i could copy that library to the project then explicitly point to the copy . however array.au3 has it's own includes which will point back to the install root, and those includes could have includes etc etc. hand editing each library isn't practical. Is there a way to indicate at the top of a script where the include folder is (without doing a registry hack each script) ?