Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Standard Library (stdlib): Simple file-system approach


  • Please log in to reply
63 replies to this topic

Poll: Should each stdlib function name begin with an underscore? (8 member(s) have cast votes)

Should each stdlib function name begin with an underscore?

  1. Yes, to reduce competition with user function names and indicate at-a-glance that the function is external. (1 votes [12.50%])

    Percentage of vote: 12.50%

  2. No, it's better not to "penalize" stdlib functions in this way. (7 votes [87.50%])

    Percentage of vote: 87.50%

  3. Other (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote
corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Updated Ahkx_Include with most of the features discussed for fun (Download here)

Install in the same directory where AutoHotkey is installed
[*:yl237ump]This version doesn't modify ahk or ahkx source files. It creates a temporary file in the script's directory (name of the script file + script extension + .tmp) then deletes the temp file (try not to blink... ;) )
[*:yl237ump]Either use the .ahkx extension or right-click on a .ahk file and click Run script using Ahkx
[*:yl237ump]Optionally specify ; #UserLib \*None to ignore UserLib functions
[*:yl237ump]Standard Library files stored in the /Program Files/AutoHotkey/Include Folder
[*:yl237ump]UserLib files stored in the /MyDocuments/AutoHotkey/UserLib/ folder (not created by default)
[*:yl237ump]UserLib directory is searched first
[*:yl237ump]A couple of .ahk and .ahkx scripts are included in the zip file for testing
[*:yl237ump]This version will search for a file of the same name (+ .ahk) of the missing function. It does not currently search for groups. For example: it will not currently Include MyModule.ahk if the MyModule_Test1 function is not found. note: Although this version tested ok on my system and should not modify any existing scripts, use at your own risk...

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for that. In case it matters for your work, I'm leaning toward something like the following because it seems more flexible without being too complicated:
#lib  ; No libraries, so no searching.

#lib path1 > path2 [> path3...]  ; explicitly named directories.

#lib ?path1  ; Use leading question mark to enable recursive search in that folder.

#lib *std  ; Search stdlib only.

#lib ?*user > *std  ; This is the default so would never need to be specified.

#lib *std > ?*user  ; reverse the default order: search std before user.


corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Thanks Chris. The #lib syntax looks like it will provide a lot of flexibility. I'll look into adding the functionality to Ahkx_Include. I'm wondering if it would be more fun for me to attempt adding the functionality to AutoHotkey itself for fun though. You may have noticed if you installed the last version I posted that the file ahkcmod.exe is a modified version of AutoHotkey. Nothing significant so far though. Just a few small modifications (/AHKX switch to tell AutoHotkey to look for the .tmp file and automatically #Include it if found then delete the file, and modified reload to call ahkx.exe using /AHKX if in /AHKX mode). I'm just slowly digging through to see what makes things tick :) . I can provide a download for the modified source if you'd like (if you'd like to yawn...).

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

I'm wondering if it would be more fun for me to attempt adding the functionality to AutoHotkey itself for fun though.

Although I haven't settled on that as the final syntax, feel free to do so.

I can provide a download for the modified source if you'd like (if you'd like to yawn...).

Not necessary unless its something that should be considered for the public release.

Thanks.