AutoHotkey Community

It is currently May 25th, 2012, 8:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

What should be the names of the standard- and user-library directories? (Regardless of the name, they are SEPARATE directories in two different locations.)
Poll ended at June 17th, 2007, 11:52 am
\Library 11%  11%  [ 2 ]
\Lib 42%  42%  [ 8 ]
\Include 16%  16%  [ 3 ]
\Includes 0%  0%  [ 0 ]
\Functions 0%  0%  [ 0 ]
Different names even though they're in different locations 32%  32%  [ 6 ]
Other 0%  0%  [ 0 ]
Total votes : 19
Author Message
 Post subject:
PostPosted: June 17th, 2007, 5:51 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
If you run scripts from a USB stick, you might want to check if there is a newer version of AHK installed (with its standard library) on the host, than the one in your stick, but you might want to use your own UserLib in stick, so you seem to be better off specifying explicit include paths or files in the scripts run from the USB stick. The registry telling the non-default include directory locations still does not look too bad.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 6:25 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Laszlo wrote:
If you run scripts from a USB stick, you might want to check if there is a newer version of AHK installed (with its standard library) on the host, than the one in your stick, but you might want to use your own UserLib in stick, so you seem to be better off specifying explicit include paths or files in the scripts run from the USB stick. The registry telling the non-default include directory locations still does not look too bad.
If you run from a USB stick you only have to unzip AutoHotkey to the drive. Having to modify the .exe is inconvenient. If I wanted to modify the .exe I would change the paths manually in C++ and compile my own version to use. The registry entry still doesn't make sense for the reasons that I mentioned and will still produce a delay at the beginning of every script since accessing the registry still involves reading from a separate file (although likely faster than from an ini file). Do you have something against using #Include <c:\YourPathHere> ? This would obviously be the fastest method (other than modifying the .exe itself) as it would be an option that would be built into AutoHotkey and an option that could be changed on a per script basis. This would also be handy for using/testing different directories for Include paths as you had mentioned.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 8:22 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
corrupt wrote:
a Library is a place of reference commonly used to locate documentation on a particular subject or a place to find other literature. The content in this directory would not be for that purpose and would be active content as opposed to reference material. The only similarity it has to a library really is that something is "looked up" but even that isn't 100% accurate since the files aren't being searched.
Hmm, but Library seems to be a very common word for the purpose, e.g. DLL (Dynamic Link Library), VCL (Visual Component Library), STL (Standard Template Library)

This is what I found on Wikipedia
Quote:
In computer science, a library is a collection of subprograms used to develop software. Libraries contain "helper" code and data, which provide services to independent programs. This allows code and data to be shared and changed in a modular fashion. Some executables are both standalone programs and libraries, but most libraries are not executables. Executables and libraries make references known as links to each other through the process known as linking

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 8:43 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Good point but that definition is mostly known by programmers and the usage here doesn't fully comply.
Quote:
Some executables are both standalone programs and libraries, but most libraries are not executables. Executables and libraries make references known as links to each other through the process known as linking
The data in the .ahk files would mainly be executable and would not really be linked. In AutoHotkey, the code in the .ahk files would just be dumped in at the end of the script as if it was part of the regular script as regular AutoHotkey code. There's no other magic involved in the process. That's one of the reasons that it might be better to use Include so that users realize that that is all that is happening when the code gets auto-included.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 9:04 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
First of all, let me clarify that the standard library will be discovered in the folder of the AutoHotkey.exe that was just launched, which isn't necessarily the one where AutoHotkey was installed. This seems to be justified due to portability.

Titan wrote:
It shouldn't be so difficult to create a post-install macro to hack the exe, just decompress and binary search & replace. Don't forget that you can modify AutoHotkeySC.bin for compiled scripts so it won't be a new concept for many users. Registry is not an option because it breaks portability and INI is simply too slow.
I think altering the EXE is too non-traditional to be seriously considered. The auto-included .ahk file (config/settings), while it might add a 50ms delay to startup when uncached, is probably the lesser evil. In fact, there might be no delay at all if the settings file doesn't exist, which for most people it won't.

corrupt wrote:
The name Include is already an established name for the action that will be performed. It seems to fit quite well. To have something auto-included in a script then give the file the same name as the function and place it in the Include folder. This has the advantage of simplifying the documentation (possibly just adding a few lines to #Include in the help file) and clearly describing what is taking place.
That is a good point; but it appears that choice is a small minority unless others have changed their minds.

Laszlo wrote:
Another alternative was to first search the directory of the script for its includes, maybe followed by %A_ScriptDir%\include.
At first glance, I think the benefit/cost is poor due to its added complexity and rarity of use.

Laszlo wrote:
Maybe the registry? If keys StdLib/UserLib are not set, use some standard locations, otherwise use the specified directories. Other behaviors of AHK can be controlled via registry entries, too, to be temporarily overridden by command line parameters.
Currently, I don't like the idea of having both command-line parameters and registry entries. For one thing it's complicated, both in code and documentation. For another, the registry is somewhat icky for things like this because it reduces the portability of AutoHotkey.exe; furthermore, a lot of people simply don't like it when software relies heavily on the registry.

In summary, I think there are only 3 approaches: registry, environment variables, and config/settings file. The first two seem undesirable, mostly due to lack of portability, but also because they may require a high-privileged user to make the changes. The latter (config file) -- while also clearly undesirable (and a bit slower during launch) -- seems like the lesser evil. Another advantage of having a config file is that it can be a generic .ahk script that is auto-included at the top of every script. It could contain any commands or directives, most notably a directive like #userlib C:\My Custom Lib Location.

The config file would be discovered in the same folder as the AutoHotkey.exe that was just launched, which isn't necessarily the one where AutoHotkey was installed. However, this config-file feature won't be in the next release, so there will be more time to discuss it.

Tuncay wrote:
I agree with corrupt. This could be done with an INI settings file, found in AutoHotkey folder. So, any script run with that AutoHotkey.exe you want, would access to YOUR configuration file.
Yes. The key concept is that the config file would always be in the same directory as the AutoHotkey.exe that is being launched. There would be no dependency on the registry or on having run the AutoHotkey installer.

corrupt wrote:
The problem seems to be with the User directory. A simple solution could be something like:
Code:
#Include <%A_ScriptDir%\Include>

where the path between the <> characters gets designated as the User directory to use. This could be convenient to ignore files in the User directory too:
Code:
#Include <>  ; ignore User directory
Instead of overloading #Include, I prefer some kind of new directive. Perhaps #lib stdlib > userlib > C:\OtherDir > ..., which would set the search order. To change the user lib, it could be #userlib C:\My Includes

Thus, the directive #lib stdlib could be used to force only the stdlib to be used for lookups (i.e. omit userlib). This would allow publicly-posted scripts to avoid any chance of interference from a userlib.

Those who voted for "Lib" in the poll: if you feel strongly about lib vs. library, please state the reasons. Otherwise I'll probably go with Library or Include under the assumption that most everyone can live with it.

Thanks.


Last edited by Chris on June 17th, 2007, 10:31 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 9:27 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Chris wrote:
Instead of overloading #Include, I prefer some kind of new directive. Perhaps #lib stdlib > userlib > C:\OtherDir > ..., which would set the search order. To change the user lib, it could be #userlib C:\My Includes

Thus, the directive #lib stdlib could be used to force only the stdlib to be used for lookups (i.e. omit userlib). This would allow publicly-posted scripts to avoid any chance of interference from a userlib.
That sounds good to me. I was actually going to suggest a new directive but suggested #Include <> instead since I had remembered that you had suggested similar syntax recently (as I mentioned).


Last edited by corrupt on June 18th, 2007, 1:40 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 10:05 pm 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
Well the only reason for the userlib as i see it is to keep the sdlib and 3rd-party libs seperated. I wonder if it would be possible to add subfolders to the stdlib folder. This way keeping sdlib and 3rd-party libs seperated would be easy and it would enable us to create modules that would be distributed as folder which one would just need to copy to the stdlib folder.

Edit: Dang :x i forgot about the adminrights problems on Vista.


Last edited by foom on June 17th, 2007, 10:19 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 10:08 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
corrupt wrote:
I was actually going to suggest a new directive but suggested #Include <> instead since I had remembered that you had suggested similar syntax recently (as I mentioned).
Oops :oops: , it looks like I was mistaken with the last syntax that was suggested for this purpose.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 10:18 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
foom wrote:
Well the only reason for the userlib as i see it is to keep the sdlib and 3rd-party libs seperated. I wonder if it would be possible to add subfolders to the stdlib folder. This way keeping sdlib and 3rd-party libs seperated would be easy and it would enable us to create modules that would be distributed as folder which one would just need to copy to the stdlib folder.
One of the reasons for the separate location is that in Windows Vista a user does not have write privileges in the Program Files directory by default. Since this is the most common installation directory, this would prevent most users from being able to add or modify files in that location.

Another purpose for the User directory is to be able to override an existing "Standard" function with a modified version. This can be handy if you prefer to customize a function but don't want to lose your changes when a new version of AutoHotkey is released that might contain an updated version of the function that you had customized. Although it hasn't been discussed in detail yet, it sounds fair to say that anything in the standard directory might be updated when a new version of AutoHotkey is released (or at least a new version of the standard functions if Chris decides to release the standard functions separately).


Last edited by corrupt on June 17th, 2007, 10:22 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 10:20 pm 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
Yeah i just realised the Vista problem. It could be so convenient but then there is Vista. :evil:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 10:47 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
It is not only a Vista problem. I use a normal user account, not an admin account for my daily use. Thus I do not have write permissions for the A_Programfiles folder.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 10:46 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I like "Library" and I like "Include". But since the majority want "Lib" (and there doesn't appear to be any vote fraud), and since the user library is something of a power-user feature, we'll go with Lib as the default name. In a future version, the names and locations will be customizable.

Edit: Here's the vote as of the time of this post:
Code:
\Library      10%  [ 2 ]
\Lib          42%  [ 8 ]
\Include      15%  [ 3 ]
\Includes      0%  [ 0 ]
\Functions     0%  [ 0 ]
Different names even though they're in different locations      31%  [ 6 ]


Last edited by Chris on June 18th, 2007, 10:57 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 10:49 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
That's fair :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 10:50 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I've updated the following file in case anyone wishes to try it out prior to release (in a day or two): http://www.autohotkey.com/misc/AutoHotk ... llback.exe

The directories are:
UserLib: %A_MyDocuments%\AutoHotkey\Lib
StdLib: (path of AutoHotkey.exe)\Lib


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 11:05 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Chris wrote:
The directories are:
UserLib: %A_MyDocuments%\AutoHotkey\Lib
StdLib: (path of AutoHotkey.exe)\Lib


Will there be any built-in variables for these paths ? :roll:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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