AutoHotkey Community

It is currently May 27th, 2012, 10:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: November 23rd, 2004, 12:46 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2004, 1:18 pm 
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 :D
Uncommented :roll:
Still motivated :P

@ Stefan
Geht doch :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2004, 1:26 pm 
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. :cry:

In such a case you've to use EnvVars or the Clipboard to pass the outcome to the inital script. :oops:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2004, 6:24 pm 
@ Stefan
Added "non Chris certificated" AHK variable: A_Decade :wink:
to unofficial default.ahk 8)

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 :!: :? :( :cry:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2007, 10:12 pm 
Offline

Joined: October 6th, 2007, 2:28 am
Posts: 49
Location: Philadelphia
One way to do a "default" include is to change your template to have an include in it.


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

All times are UTC [ DST ]


Who is online

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