AutoHotkey Community

It is currently May 27th, 2012, 12:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: June 16th, 2005, 1:46 pm 
Offline

Joined: June 2nd, 2005, 8:25 am
Posts: 48
Location: Moscow
Chris wrote:
For example:
#Include %A_ScriptDir%\My Include.ahk

It looks rather unnaturally. Why don't you would to make this feature in the form of a #Directive, e. g.
#InspectScriptDir On|Off
?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 2:14 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
It would be more complicated to implement that because both ahk2exe and the main program would have to be altered to search two paths: the working directory and then the script directory. Also, adding new directives is avoided unless there's a large benefit because it complicates the code and clutters the documentation with a new command/page.

However, your idea might be possible with something like the following to switch the working directory used by #Include:
#Include %A_ScriptDir% ; Switches to a new working directory for include files.

This is probably the best of both worlds. Thanks for the idea; I'll try to include it in the next release.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 4:46 pm 
Offline

Joined: June 2nd, 2005, 8:25 am
Posts: 48
Location: Moscow
Great! Nice! Beautiful!
I'm happy!
Thank you Chris!
A further evolution may be in allowing multiple "#Include DirName" to specify all the directories where including files could be found:
Code:
#Include %A_ScriptDir%
#Include %A_ScriptDir%\IncludeFiles
#Include %A_MyDocuments%\AutoHotkey\Library
...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 7:19 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Having multiple default-include directories might happen someday, but it tends to complicate things a lot.

Concerning the original topic: Upon review, I think you were right that #Include should have been designed to read from A_ScriptDir rather than A_WorkingDir (if for no other reason than to make the behavior consistent with ahk2exe). However, it seems best not to change it at this late a stage because: 1) It would probably break existing scripts; some of these breakages would be justifiable but others might be due to reliance on identically-named but different-content include files depending on working dir. 2) It preserves the flexibility of having includes vary (perhaps via the *i ignore option, or just in general) depending on startup/working directory.

This behavior difference between AutoHotkey.exe and ahk2exe.exe has now been documented.

I've included the following changes in today's update:

Improved #Include to be able to set a new working directory for subsequent uses of #Include and FileInstall. In addition, #Include is now able to resolve %A_ScriptDir%.

Improved FileInstall to always get the file from A_ScriptDir vs. A_WorkingDir when no absolute path is specified.

Thanks for your help.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group