#include file cannot be opened

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
expert_vision
Posts: 21
Joined: 13 Jan 2014, 10:47

#include file cannot be opened

16 Dec 2014, 01:35

I have a problem that makes absolutely no sense.

I keep my ahk scripts on OneDrive and everything works perfect on PC, but once I sync to my laptop I can't compile, getting error "#include file cannot be opened".
Ok, so I thought there must be something wrong with OneDrive folder, and I moved the script on Desktop, but I get the same error.
So I made a simple test script to see if it compiles, which it does, and then step by step I brought the non-compiling script to the same structure as the test script, and I still get the error.
I even brought the script back on the PC and I still get the error.

All systems have AHK_L 1.1.16.05.

I've attached the scripts below, where "New folder" is the test script, which compiles, and "New folder1" is the script from OneDrive folder edited to the same structure as the test script.

Both scripts are identical, why does one compile and the other doesn't ?
Attachments
Desktop.zip
(2.45 KiB) Downloaded 128 times
TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: #include file cannot be opened

16 Dec 2014, 17:03

I've had a similar problem. I keep my scripts in a Dropbox folder and if I compile a script which has #include, sometimes the specified file is not included. I have surmised that there can be some interaction between the compiler and Dropbox that makes the included file not available at times.

Repeating the compile usually works.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: #include file cannot be opened

17 Dec 2014, 02:35

Thank you for providing sample files. In fact, the files are identical, but the folders are not. ;)

The problem in this case is that Ahk2Exe uses FileExist incorrectly, and fails to recognize the lib in #include lib as a directory if the directory has other attributes, like the Archive attribute.

Code: Select all

if FileExist(IncludeFile) = "D"
should be

Code: Select all

if InStr(FileExist(IncludeFile), "D")
To work around the bug, remove the Archive attribute from the folder.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: macromint, peter_ahk, Rauvagol, Spawnova, wineguy and 289 guests