 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Nov 23, 2004 12:46 pm Post subject: |
|
|
| jack wrote: | if you decide to implement something, please can you make it an installation-wide default that the include file is off? further, can you also add some option so that a script can say 'do not use any system include file'?
i can forsee problems when i give a script to somebody else who uses an automatically-included file that breaks something in my script. | That's another important disadvantage I didn't realize until now. Thanks. Overall, I'm leaning toward not adding this feature because the small benefits it delivers don't seem worth the costs in confusion and compatibility issues, and the fact that the registry or an INI file would have to be used to determine whether the feature is enabled or disabled.
| BoBo wrote: | | Thx for sharing that. Unfortunately the Errorlevel delivers only a single value ... That's why I've used two variables in my above sample. | I missed that, thanks for clarifying.
| Stefan wrote: | but i donīt want to always insert
StringLeft, Century, A_YYYY, 2 | That's a good example. You probably know that you could just remember to include something like the following at the top of every script:
#Include D.ahk
... which will set up the default constants you use regularly. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Tue Nov 23, 2004 1:18 pm Post subject: |
|
|
WhateverScript.ahk
| Code: | !F9::
{
RunWait, AutoHotkey.exe /r /f /ErrorStdOut Default.ahk A_Century,,Hide
A_Century = %Errorlevel%
MsgBox, Current month:`t%A_Mon%`nCurrent century:`t%A_Century%
Return
} |
Default.ahk
| Code: | Goto, %1%
A_YWeek:
ExitApp, xxx
A_Century:
StringLeft, Century, A_Year, 2
Century ++
ExitApp, %Century% |
Tested
Uncommented
Still motivated
@ Stefan
Geht doch  |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Tue Nov 23, 2004 1:26 pm Post subject: |
|
|
I wrote:
| Quote: | | Unfortunately the Errorlevel delivers only a single value |
Which won't stop you - if its an integer. To handover a bunch of vars (even alpha numeric ones) like this
abc|def|ghi
or
12|my sister|...
won't work.
In such a case you've to use EnvVars or the Clipboard to pass the outcome to the inital script.  |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Tue Nov 23, 2004 6:24 pm Post subject: |
|
|
@ Stefan
Added "non Chris certificated" AHK variable: A_Decade
to unofficial default.ahk
WhateverScript.ahk
| Quote: | !F9::
{
RunWait, AutoHotkey.exe /r /ErrorStdOut Default.ahk A_Century,,Hide
A_Century = %Errorlevel%
RunWait, AutoHotkey.exe /r /ErrorStdOut Default.ahk A_Decade,,Hide
A_Decade = %Errorlevel%
MsgBox, Current month:`t%A_Mon%`nCurrent century:`t%A_Century%`nCurrent decade:`t%A_Decade%
Return
} |
Default.ahk
| Quote: | Goto, %1%
A_Decade:
StringMid, A_Decade, A_Year, 3, 2
A_Decade += 10
A_Decade /= 10
ExitApp, %A_Decade%
A_Century:
StringLeft, A_Century, A_Year, 2
A_Century ++
ExitApp, %A_Century% |
Still uncommented  |
|
| Back to top |
|
 |
williamsharkey
Joined: 06 Oct 2007 Posts: 52 Location: Philadelphia
|
Posted: Mon Dec 17, 2007 10:12 pm Post subject: |
|
|
| One way to do a "default" include is to change your template to have an include in it. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|