AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mising "A_decade" and maybe "A_century"
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Thu Oct 21, 2004 8:37 am    Post subject: mising "A_decade" and maybe "A_century" Reply with quote

FYI and maybe suggestion if this is from interrest for more users too.


Just playing around with creating folders with current year and mont,
iam missing the build in variables

A_decade / %A_YD%
to get '04' from '2004'


and BTW maybe
A_century / %A_YC%
to get '20' from '2004'
too
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”


Last edited by Stefan on Sun Oct 24, 2004 12:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Oct 21, 2004 12:42 pm    Post subject: Reply with quote

I'm not ruling this out, but for now I'd like to avoid adding variables for rarely used things when there's a way to derive them from existing variables. In this case:

StringLeft, Century, A_YYYY, 2
StringRight, Decade, A_YYYY, 2

Thanks.

Edit: Fixed sample commands above.


Last edited by Chris on Fri Oct 22, 2004 4:26 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Fri Oct 22, 2004 3:50 pm    Post subject: Reply with quote

Not so nifty for a short script like

Send, {F7}
Send, Download_%A_mon%%A_century%

but your obove suggestion works, thanks very much for your help.

(I had smtg in mind like that "Trim" thing, but i have no experience with this Embarassed (till now, i hope?) )

---------------------

Now i wanna use this
    StringTrimLeft, Century, A_YYYY, 2
    StringTrimRight, Decade, A_YYYY, 2

(and maybe other 'global' settings)

for all *.AHK scripts
and wanna write this in a "Main_Script.ahk".
(I tryed "The Auto-execute Section" of Autohotkey.ini)


Could this work ?
Can anyone pls give me an hint for what to search in the help for that issue ???

Thanks
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Oct 22, 2004 4:30 pm    Post subject: Reply with quote

Quote:
I had smtg in mind like that "Trim" thing, but i have no experience with this
Oops, I messed it up it should be this:

StringLeft, Century, A_YYYY, 2
StringRight, Decade, A_YYYY, 2

Quote:
Now i wanna use this ... for all *.AHK scripts
If you put the lines above into a separate file, you can then do this at the top of every script:

#Include C:\My Scripts\Decade.ahk
Back to top
View user's profile Send private message Send e-mail
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Fri Oct 22, 2004 4:59 pm    Post subject: Reply with quote

Chris wrote:
Quote:
I had smtg in mind like that "Trim" thing, but i have no experience with this

Oops, I messed it up it should be this:

StringLeft, Century, A_YYYY, 2
StringRight, Decade, A_YYYY, 2


??? i see those 'StringTrimLeft' things works too ??
Anyway thanks, i will read the help about this fearures.

Quote:


Quote:
Now i wanna use this ... for all *.AHK scripts

If you put the lines above into a separate file, you can then do this at the top of every script:

#Include C:\My Scripts\Decade.ahk


Thanks, just found '#include ' somewhere in the forum.

May i slightly suggest an thing like "Autohotkey_Install_folder\default.ahk"
for all such 'global' settings
who should work for all scripts on this pc
without 'always' including this '#Include' option.

Not for my current issue, but for making life easier?
Make this sense or didn´t need that anyone?

No answer really necessary , just FYI.
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Oct 22, 2004 5:49 pm    Post subject: Reply with quote

Quote:
May i slightly suggest an thing like "Autohotkey_Install_folder\default.ahk"
for all such 'global' settings
who should work for all scripts on this pc
without 'always' including this '#Include' option.
That sounds like a good feature, I'll add it to the to-do list.
Back to top
View user's profile Send private message Send e-mail
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Fri Oct 22, 2004 8:37 pm    Post subject: Reply with quote

Chris wrote:
Quote:
May i slightly suggest an thing like "Autohotkey_Install_folder\default.ahk"
for all such 'global' settings
who should work for all scripts on this pc
without 'always' including this '#Include' option.
That sounds like a good feature, I'll add it to the to-do list.


May i vary my suggest of default.ahk ?

During driving home, i have a second thoughts:

default.ahk is good,
but i suggest to use the 'AutoHotKey.ini' ( this INI is always include ?)
to include such default.ahk(s) like this:

the 'AutoHotKey.ini' could contain
#defaultinclude, default.ahk
#defaultinclude, date_stuff.ahk
#defaultinclude, D:\Scripting\AHK\Own\Stefan.ahk


"#defaultinclude" means include this described *.ahk scripts
for all in the current AHK.exe context running scripts.

Like #include does for current single script.

For default.ahk i suggest
to include it in the download archive
and fill it with such useful scripts we talk here about.

Or maybe make a new download section
for several such default.ahk´s.
The user can download (or upload) them for the task they need.
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Oct 22, 2004 10:23 pm    Post subject: Reply with quote

Thanks; I don't think I want to have any special meaning assigned to the AutoHotkey.ini file, since it is just a script whose name happens to end in .ini. But do note that the default include file could include other files. In other words, even though only one default include will be possible, you can have any number of #Include statements inside that file.

Also, I'm thinking it might be better to have the default include file in %A_ScriptDir%. This makes things more flexible because you could then have separate folders each with their own default include file. However, it also prevents subfolders from easily using the same default include file, so in that respect it is worse. Some more consideration of these issues will be needed before implementation.

Thanks for your suggestions.
Back to top
View user's profile Send private message Send e-mail
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Sat Oct 23, 2004 7:40 am    Post subject: Reply with quote

it sounds as though you want a search path: read the one in the same folder; if it's not there, use the master copy.

but then you have the problem of turning it off!


jack
This is a REPEATABLE error situation
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Oct 23, 2004 11:57 am    Post subject: Reply with quote

Yes, very good point. But maybe it's better just to keep it simple: If the script's own folder has a "#include_default.ahk" file in it, it gets included. Otherwise it doesn't.

As for turning it off, if no "master file" is supported, maybe there doesn't need to be a way. Any script that doesn't need the file included can be put into a sub-folder instead.

Another option is to store the configuration settings in a new/standard ini file somewhere, or in the registry. This would allow options such as "none (default)", "master only", "master and working directory", "working directory only", etc.

I don't currently consider this a super-high priority. But if you or anyone else has a craving for it in the near-term, please let me know.
Back to top
View user's profile Send private message Send e-mail
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Sun Oct 24, 2004 8:33 am    Post subject: Reply with quote

not me. i don't need this one.

jack
eleven dimensions ought to be enough for anybody
Back to top
View user's profile Send private message
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Sun Oct 24, 2004 11:30 am    Post subject: Reply with quote

Chris wrote:
Yes, very good point. But maybe it's better just to keep it simple: If the script's own folder has a "#include_default.ahk" file in it, it gets included. Otherwise it doesn't.

As for turning it off, if no "master file" is supported, maybe there doesn't need to be a way. Any script that doesn't need the file included can be put into a sub-folder instead.


Yes. that´s simple.
C\Progam files\Autohotkey\default_master.ahk (default_Master.ahk for all scripts, if this is wanted)

C\Progam files\Autohotkey\folder for Scripts who include current default.ahk\default_one.ahk (and default_Master.ahk, if present)

C\Progam files\Autohotkey\folder for Scripts who include another default.ahk\default-own_two.ahk (and default_Master.ahk, if present)

C\Progam files\Autohotkey\folder for Scripts\ (scripts without including default.ahk because there is non, but default_Master.ahk, if present)

User who don´t need such default.ahk´s don´t have to use them.

It would be fine if the name syntax could be defaultsomething.ahk for better difference.

(So the default_Master.ahk is only the current default.ahk in main folder.)

I suggest to auto include all default_xxx.ahk´s in current folder.


Quote:

Another option is to store the configuration settings in a new/standard ini file somewhere,

And i think the autohotkey.ini is the standard.ini ?




Quote:
or in the registry.

I don´t like the registry, i simple wanna copy the hole AHK folder from one PC to another. And pls think about USB-Stick users.



Quote:
I don't currently consider this a super-high priority.

Yes, of course, thanks.
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Oct 24, 2004 12:01 pm    Post subject: Reply with quote

Stefan wrote:
I suggest to auto include all default_xxx.ahk´s in current folder.
I think that's a little too much, both for performance reasons (every time a script starts up it would have to do a wildcard search) and for ambiguity reasons (too many file names would then be "reserved"). But I will think about more it when the time comes.

Quote:
Quote:

Another option is to store the configuration settings in a new/standard ini file somewhere,

And i think the autohotkey.ini is the standard.ini ?
Not really, it's just the default script. For performance reasons, it's probably best not to use that; some other name would probably be used.

Overall, I'm a little bit more reluctant about this idea because of the added performance overhead of having every script check for the existence of a default file, especially if more than one is allowed. Another disadvantage is that there is doubt about where to include the file: top of the script or bottom (due to the auto-execute section). To be flexible, both a top-include and a bottom-include would probably have to be provided.

Anyway, thanks for suggesting the file-naming scheme as an alternative to the registry (you're right about the registry not being a good thing for portability and other reasons).
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Fri Nov 19, 2004 8:19 pm    Post subject: Reply with quote

Stefan wrote:
May i slightly suggest an thing like "Autohotkey_Install_folder\default.ahk"
for all such 'global' settings
who should work for all scripts on this pc
without 'always' including this '#Include' option.

...yes, I've wanted this too, since AutoHotkey.ini was only used when the .exe was run directly, I figured this global file could be named that, but I also figured you wouldn't want to re-purpose the .ini, so maybe Autoexec.ahk (or .ini)...or use AutoHotkey.ahk to do what AutoHotkey.ini does now & re-purpose AutoHotkey.ini to do the global thing. I have definitely wanted this, things that affect all scripts. You might as well re-purpose AutoHotkey.ini cuz I'm sure no one uses it for its current purpose (if they do they can rename it to .ahk & add the icon to their start menu) & you need an ahk program GUI to control settings. & .ini just screams "Settings!" AutoHotkey.ahk sounds like something that might run by default when the .exe is run.

Chris wrote:
Also, I'm thinking it might be better to have the default include file in %A_ScriptDir%.

...no, the global default should be in the ahk dir, another default could be in the script dir tho, currently my testing script is in the ahk dir, but I wouldn't want to be limited to leaving it there. I like the name Autoexec.ahk (or .ini) for the global one & Autoexec.ahk for the script dir one, default.ahk just has a bad ring to it, kinda like the M$ default.htm or .asp. If you look for both the global & the script dir one, make a check to see they're not the same dir or you'll end up execing the same script twice.

Chris wrote:
However, it also prevents subfolders from easily using the same default include file, so in that respect it is worse. Some more consideration of these issues will be needed before implementation.

...well, here's one option, it sounds excessive to me to, but it's an option...use the Apache .htaccess method, run the global Autoexec.ahk (or .ini), then look in the script dir for an Autoexec.ahk, then one dir up, then one dir up, all the way. This way you have the "server config" global file & the ".htaccess" per-directory files. If you have global ahk program settings somewhere (registry? do you?)...you could have options to limit the craziness this might cause, like an option..."Look a maximum of 5 dirs above script dir" (5 being configurable) & "Never look in root of drive" (if someone wants a global default, they can put it in the ahk program dir instead of c:\ {which would also be limited to scripts on C}, but have an option, in case someone wants to put it there). You could even use Autoexec.ini to be the settings file that determines what is looked for & run. Then people could set it to use Autoexec.ahk in the program dir for the global default & Autoexec.ahk in the script dir...one, the other, neither, both...even configure a different name for those who WANT it called default.ahk (why?)? You could also include an Autoexec.ini in the script dir, that can override loading the global default, this might eliminate the craziness...

C:\Program Files\AutoHotkey <--- here you set the sanity limit at 5
C:\Documents and Settings\User\My Documents\AHK Scripts <--- here you could have an Autoexec.ini that says "no higher"
    Dir1
      Sub1
        SubSub1 <--- here you could have an Autoexec.ini that says "only global default",
        ___________so that none of the previous dirs are even checked

      Sub2
      Sub3

    Dir2
    Dir3
...the original idea was for an Autoexec.ini to control settings & an Autoexec.ahk to be the program that gets run, but this would require looking for 2 files in each dir, so maybe some # directives at the top of the Autoexec.ahk (or .ini) could control the searching...

Code:
#AutoInclude NoHigher
#AutoInclude Global
#AutoInclude -Global
#AutoInclude Global,ScriptDir
#AutoInclude Global,ScriptDir,Sanity5
#AutoInclude Global,ScriptDir,Sanity2-5
#AutoInclude Global,ScriptDir,Sanity5,NoRoot
#AutoInclude Global,ScriptDir,C:\This real dir
#AutoInclude Global,ScriptDir,.\This dir relative to current dir
#AutoInclude Global,ScriptDir,<This dir relative to ahk dir>
#AutoInclude Add,C:\This real dir
#AutoInclude Add,C:\Dir1,C:\Dir2
#AutoInclude Add,C:\Dir1,Global,Add,C:\Dir2
#AutoInclude +C:\This real dir
#AutoInclude +,C:\Dir1,C:\Dir2
#AutoInclude Sub,C:\This real dir
#AutoInclude -C:\This real dir
#AutoInclude -,C:\Dir1,C:\Dir2

...all of these being exclusive, you only include one #AutoInclude directive, but put all the options you want in it, separated by commas. Perhaps call it #Autoexec & not #AutoInclude? Sanity5 being what controls how many dirs above the script dir it will look in max, maybe call it Limit instead of Sanity, 5 being how many. Sanity2-5 is a min/max version, 2 is how many dirs to skip before it starts looking in the next 5 up...in the SubSub1 dir it would make it not look in Sub1 or Dir1, but would start looking in AHK Scripts & would keep on for 5 more max, but if the AHK Scripts dir says no higher, it would stop, if not it would never stop, because there aren't more than 5 dirs from AHK Scripts to root...basically it would be for deeply nested dirs, where it would be faster to not look in a few levels of dirs until it got out to where the file really is. If you wanted a min & no max, you could use Sanity2- Each directive resets the value so "#AutoInclude Global" means "only global", but "#AutoInclude Add,C:\This real dir" just adds that dir to the list...but non-directory options don't clear the search list, like NoHigher & NoRoot, they turn that option on, but leave the default/current search list alone. "-Global" means "remove Global from the list, leaving all other defaults" For ".\This dir relative to current dir" I'm not sure if current dir should mean script dir or the real working/current dir...?...or if by the time the script is running, they are the same thing? "<This dir relative to ahk dir>" is in the style of C "#include <windows.h>" that includes a file from a base dir, in this case the ahk dir, in C's case the header dir. Add would work until a non-directory is encountered in the list, so you only include the keyword once for each set of dirs to add. "+," is a synonym for Add. Sub is the opposite of Add (perhaps called Remove instead of Sub). "-," is a synonym for Sub (or Remove). The "-," (minus comma) version would start a list, like Add, but the "-" version, as used in "-Global" would only remove that item (not start a list), ditto for "+," & just "+". The last Add example is just to show someone being difficult, they could put Global anywhere but in the middle & not need the Add keyword twice, but it could/would control the search order, so it could be useful...search Dir1, then Global, then Dir2...hrm, using Add with Global is redundant, Global is default & you are Add'ing instead of resetting...so Global is already included...perhaps this could still be used to control order...?...or maybe when using the Add keyword, other options have no point...?...no, the NoHigher option would have a point even with Add, so a better example (of doing it a difficult way) is...

Code:
#AutoInclude Add,C:\Dir1,NoHigher,Add,C:\Dir2

...I left it this way to show the thought process & to leave the part about it controlling the search order.
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Fri Nov 19, 2004 9:32 pm    Post subject: Reply with quote

Whoa, whoa, whoa. I just saw this thread now, and I for one don't like this idea. Maybe making AutoHotkey.ini into a global settings file (not a script) wouldn't be so bad, but going any further than that is just bloat in my opinion. It's trivial to simply make your own default.ahk and then put #Include default.ahk in the scripts you want affected. That's one line of code, 21 characters. Taking the step to have to include something to not include this default script would deter more people than it would help, I think.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group