Jump to content

Recommended Posts

Posted (edited)

I've been plagued by this for a while now, but I think I finally pinned it down. If you create three files like this:

;# Main.au3 (Placed anywhere)
#include <Base_Include.au3>
#include <Helper_Include.au3>

; [...]
; <Personal Includes Folder>\Helper_Include.au3
#include-once
#include "Base_Include.au3"
; <Personal Includes Folder>\Base_Include.au3
#include-once
Global Const $__g_bError = True

(This looks strange, but this is the setup with WD Driver (wd_core.au3 and wd_helper.au3), which is where the issue originally showed up. If you have those files, then you can use their names instead)

The other requirement is that the <Personal Includes Folder> that the includes are placed in needs to have a backslash added to the end of the path in the registry value... HKCU\Software\AutoIt v3\AutoIt\Include. After all of that is done, running the main script will result Au3Check stating that $__g_bError was previously declared as a constant.

The solution is to not add a backslash to the end of the registry value OR to use matching brackets/quotes when including files, but I haven't seen this documented anywhere. I'd guess that what ends up happening is that Au3 Check resolves the file name to "<IncludeDir>\Base_Include.au3" and "<IncludeDir>\\Base_Include.au3" because of the trailing backslash in the registry, but that's just a guess.

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

  • Developers
Posted

You shouldn't be adding the "\" to the end, but what happens is the following:

let's assume <Personal Includes Folder> = "c:\temp\"

  1. First included file is "c:\temp\\Base_Include.au3" from the master script
  2. Second included file  is "c:\temp\\Helper_Include.au3" from the master script
  3. Third file tried is "Base_Include.au3" from "Helper_Include.au3". Since it is located in the same directory, that is used and expands to the full path name "c:\temp\Helper_Include.au3". Since that is different from the previous one it thinks it is different. 

Guess we should fix the fully qualified name for a file not to contain "\\", but why did you use the "\"at the end of the include path?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I think I manually changed the include path when I was switching what directory I was using from a network drive to a local drive. I didn't realize that a trailing \ would cause an issue. I always type one to show that it's a directory instead of an extension-less file 🙄

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

  • Developers
Posted

I have made an change to au3check to strip any trailing backslashes from the registry entries so one can't make that mistake.
It's available in the Beta dir: https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/Au3Check.exe in case you want to test it.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...