Jump to content

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

Small Extension to #Include


  • Please log in to reply
43 replies to this topic
polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
It would be really useful if #Include could use variable references. However due to its prepossessing nature it seems unlikely...
Therefore I propose an extension to #Include that allows direct references to files within a folder in the AutoHotkey installation directory. This could expand in future to the library of includes that was discussed before.

Example:#Include *internal extrastuff.ahk
; (includes C:\Program Files\AutoHotkey\Extras\Includes\extrastuff.ahk)*internal is an example parameter.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004
I'd prefer...
#Include ...which would use a new IncludeDir setting in the registry...defaulting to %A_InstallDir%\Includes...but I'd change it later...cuz I install to...C:\Program Files\AutoHotkey\1.x.xx.xx...so my include dir would default to being off the versioned dir, but I'd want it at C:\Program Files\AutoHotkey\Includes...I like keeping old versions. It might be good to support "user includes" & "program includes"...search both, if a file is in both, include the users version. A_InstallDir & A_IncludeDir would be good variables to have...(I thought A_InstallDir already existed?)...
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

(I thought A_InstallDir already existed?)...

That's A_AhkPath I think...

Sorry, but I prefer Titan's syntax, consistent with AutoHotkey syntax, than your, cryptic (why two symbols, around the path?) and ripped arbitrarily from another language...

Plus Titan's is more flexible for what you propose: base dir, for stuff like ExtractInteger, InsertInteger or GetChildHWND, if they never go hardcoded in AHK, and user dir, for personal includes.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004

That's A_AhkPath I think...

...that gets either...1) the directory & exe name of the program running the script...or...2) the value from InstallDir in the registry...it's inconsistent (from the help anyway, I haven't tested it)...I want the direct value from the reg, with no exe name...it's different...

Sorry, but I prefer Titan's syntax, consistent with AutoHotkey syntax...

...how is that consistent with AHK syntax?...why is mine not?

...(why two symbols, around the path?)

...I don't know, ask Mr. C...he created the 2 symbol method...I just like it...plus it would look dumb with just one or the other...

...and ripped arbitrarily from another language...

...you don't need to do it differently just to be "different"...use what works/looks better...mine looks better than an asterisk & some word...

Plus Titan's is more flexible for what you propose...

...I don't like the *...I'd like my <> method & variables...that would solve it...
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

...how is that consistent with AHK syntax?...why is mine not?

Becuase #Include already has the *i parameter, therefore something similar would tie in better.

...you don't need to do it differently just to be "different"...use what works/looks better...mine looks better than an asterisk & some word...

Exactly, we don't want to do it differently - we would like to stick to the object model that Chris already created. Like you said, it's better to have something work rahter than feng shui with the code.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004

It would be really useful if #Include could use variable references. However due to its prepossessing nature it seems unlikely...
Therefore I propose an extension to #Include that allows direct references to files within a folder in the AutoHotkey installation directory. This could expand in future to the library of includes that was discussed before.


How about changing the #Include action to "if no path specified, check the working directory, if not exist, check AutoHotkey\Includes folder"?
"Anything worth doing is worth doing slowly." - Mae West
Posted Image

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004

How about changing the #Include action to...

...that would be good...but I'd still like the C style method to force it to load from the includes dir...
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

How about changing the #Include action to "if no path specified, check the working directory, if not exist, check AutoHotkey\Includes folder"?

There is a flaw with that.. what if 'example.ahk' exists in the working directory and the AutoHotkey includes folder - one will unconditionally take the place of the other. Therefore, for clarity and consistency, a parameter would be better.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004

I'd still like the C style method to force it to load from the includes dir...


I think it would be strange to use the C style since no other AutoHotkey command uses this. It would probably be more in keeping with the existing syntax to use a different command, eg: #IncludeLocal.

How about changing the #Include action to "if no path specified, check the working directory, if not exist, check AutoHotkey\Includes folder"?

There is a flaw with that.. what if 'example.ahk' exists in the working directory and the AutoHotkey includes folder - one will unconditionally take the place of the other. Therefore, for clarity and consistency, a parameter would be better.


I don't really see a flaw with it, if the file exists in the script's working directory it would take priority. :)
"Anything worth doing is worth doing slowly." - Mae West
Posted Image

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

I don't really see a flaw with it, if the file exists in the script's working directory it would take priority. :)

... and that very priority issue is what could cause a lot of problems. Suppose I give someone a script with an include to a file in the working directory which happens to have the same name as another script in the AHK Includes folder. They might not have the same include locally and so their AHK will use the file within the Includes folder and thus the script would be broken for him/her.

A distinctive parameter would ensure that no loopholes/flaws like this happen.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004
Titan, I agree that a distinctive parameter would ensure more certain results, though I prefer the idea of a dedicated command. It is interesting that #Include is the only directive that uses the *parameter syntax.
"Anything worth doing is worth doing slowly." - Mae West
Posted Image

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

It is interesting that #Include is the only directive that uses the *parameter syntax.

There had to be a deviation sooner or later.

A dedicated command will only complicate things. A parameter will tie in with #Include and #IncludeAgain perfectly.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for the syntax ideas.

The standard library is one of those things that gets deferred often because it's a big job: suitable functions must be found, edited into shape, tested, and documented. Volunteers would be welcome. :)

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Hows about forgetting the include library for now and concentrating on the #Include extension whereby direct references to files within a certain directory can be done?

--

The IntelliSense.ahk has always been with the installer (\AutoHotkey\Extras\Scripts\) - this could be the special directory.

Selecting scripts is going to be a horrible process (think of all the let down script writers). I think that people should put forward their scripts to you, Chris, so you can personally choose. This way there is no discrimination and everyone will be happy with your choice (hopefully).

The installer would dramatically increase in size if it contains a library of scripts. Were you planning to create two flavours of the installer or a seperate addon (or zip) to contain the library? Also, if this happens, where does the showcase stand?

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


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

...the #Include extension whereby direct references to files within a certain directory can be done?

Other than the standard library, what would you use this for in the near term?

Selecting scripts is going to be a horrible process (think of all the let down script writers). I think that people should put forward their scripts to you, Chris, so you can personally choose.
...where does the showcase stand?

I should have been more clear: the standard library won't contain scripts per se. Generally, it will contain utility functions. For example, there might be a Encryption.ahk file that contains a variety of encryption methods. Also, there could be an XML.ahk to contain functions you might write to handle XML files.

Were you planning to create two flavours of the installer or a seperate addon (or zip) to contain the library?

Unless it gets enormous (which seems unlikely anytime in the next year or two), it will be included in both the ZIP and the Installer versions of AHK (the installer would probably offer you a choice whether to install that part). Since text is highly compressible (especially with the new NSIS compression method), the size of the installer wouldn't increase much.