Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Include <Foo> includes twice #4

Closed
Lexikos opened this issue Aug 18, 2011 · 2 comments
Closed

#Include <Foo> includes twice #4

Lexikos opened this issue Aug 18, 2011 · 2 comments

Comments

@Lexikos
Copy link
Contributor

Lexikos commented Aug 18, 2011

The following includes Foo.ahk twice, when compiled:

#Include <Foo>

The original Ahk2Exe writes the processed script text into a temporary file as it goes along, and passes this file to AutoHotkey.exe /iLib. Because the #Include line was stripped out before it got to AutoHotkey.exe, it didn't add the lib file to its output. I implemented #Include <Lib> support in Ahk2Exe to resolve this, though I realize now that I could have simply written the original #Include line into the temporary file and let AutoHotkey.exe do the rest.

Since your script passes the original filename to AutoHotkey.exe /iLib, both it and your script process the #Include line. This causes the file to be included twice. I think the best solution is to simply ignore any instances of #Include <Lib> and let AutoHotkey.exe handle it. You can either pass the original filename as you do now, or pass a temporary file containing the processed text.

@fincs
Copy link
Collaborator

fincs commented Aug 18, 2011

I think your original approach is better because the library file is inserted at the same position the interpreter reads it, and there might be scripts that rely on this behaviour, especially class libraries ("Why doesn't my script work when it's compiled?"). Anyway, I think that it would be an even better idea to change AutoHotkey to not write the #Include <Lib> files to the iLib script; this would avoid the need for a temporary file and would avoid having to write said temporary file to the input script's folder (needed for resolving local library scripts), which may be read only.

@Lexikos
Copy link
Contributor Author

Lexikos commented Aug 18, 2011

Ah, yes. Now that you mention it, I think that's why I did it that way. Letting /iLib handle it would probably also cause #Include <Lib> to include the file even if there was a previous #Include Lib\Lib.ahk, although I think that case would be rare. I will make the necessary change to AutoHotkey some time in the next few days.

@fincs fincs closed this as completed Sep 24, 2011
joedf pushed a commit that referenced this issue Jul 24, 2019
Fix misaligned button in UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants