| View previous topic :: View next topic |
| Deprecate some commands? |
| Yes |
|
86% |
[ 13 ] |
| No |
|
13% |
[ 2 ] |
|
| Total Votes : 15 |
|
| Author |
Message |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Jul 25, 2008 2:44 am Post subject: mark older commands as deprecated |
|
|
I think it would help reduce confusion to mark a bunch of commands as deprecated in the manual. Many exist only to support auto0it 2 scripts. most are better written in some expression format.
if others agree or disagree with particular commands, or want to add to the list, please reply/vote
Commands (strong desire to deprecate, IMHO):
- EnvSub
- EnvAdd
- EnvMult
- EnvDiv
- SetEnv (keep EnvSet, EnvGet and EnvUpdate)
- IfInString
- IfExist
- IfLess,
- IfGreater
and similar
Commands (lesser desire to deprecate, IMHO):
- IfWinExist
- IfWinActive
and similar
Commands I would like to deprecate, but have no useful Expression equivalent (in fact it would be nice to see some functions for these):
- If var is type
- IfMsgBox
Comments appreciated _________________
(Common Answers) |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Fri Jul 25, 2008 3:10 am Post subject: |
|
|
Agreed.
Although I use IfWinExist and IfWinActive....
For "If var is type" I use:
| Code: | IfIs(ByRef var, type) {
If var is %type%
Return, true
} |
|
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Jul 25, 2008 3:49 am Post subject: |
|
|
you could replace with If WinExist() and If WinActive() _________________
(Common Answers) |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Fri Jul 25, 2008 3:56 am Post subject: |
|
|
| Yeah I know, and I do that in some places... But for whatever reason I use IfWinExist and IfWinActive. I hate all the other If___ commands >.> Especially IfMsgBox... which is why I almost never use AHK message boxes anymore when I need input. There's some MsgBox() script around this forum somewhere that's very customizable and returns the answer, so it works great for me—although it doesn't look quite as nice =\ |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
Posted: Fri Jul 25, 2008 8:26 am Post subject: |
|
|
I agree, though I am of the opinion that the term 'deprecated' be acompanied by its definition.
I occasionally use some of those commands... though typically only for readability considerations.
I think that msgbox should use the errorlevel to mark user selections so that it shares more of the conventions used by other user input commands.
'If var is type' and 'If _ between _ and _' can be replaced with some easy functions | Code: | Is_Int(var)
{
return !InStr(var, ".") && (var+0 != "")
}
Is_Num(var)
{
return var+0 != ""
}
Is_Hex(var)
{
return InStr(var, "0x") && (var+0 != "")
}
Is_Float(var)
{
return InStr(var, ".") && (var+0 != "")
}
Is_Digit(var)
{
Loop, parse, var
If !InStr("1234567890", A_Loopfield)
return 0
return 1
}
Is_XDigit(var)
{
Loop, parse, var
If !InStr("1234567890abcdef", A_Loopfield)
return 0
return 1
}
Is_Alpha(var)
{
Loop, parse, var
If !InStr("qwertyuiopasdfghjklzxcvbnm", A_LoopField)
return 0
return 1
}
Is_Lower(var)
{
Loop, parse, var
If !InStr("qwertyuiopasdfghjklzxcvbnm", A_LoopField, 1)
return 0
return 1
}
Is_Upper(var)
{
Loop, parse, var
If !InStr("QWERTYUIOPASDFGHJKLZXCVBNM", A_LoopField, 1)
return 0
return 1
}
Is_Alnum(var)
{
Loop, parse, var
If !InStr("1234567890qwertyuiopasdfghjklzxcvbnm", A_LoopField)
return 0
return 1
}
Between_In( low, var, high ) ; inclusive
{
If (low > high)
return high <= var && var <= low
return low <= var && var <= high
}
Between_Ex( low, var, high ) ; exclusive
{
If (low > high)
return high < var && var < low
return low < var && var < high
}
Between_EL( low, var, high ) ; between high and low or equal to low
{ ; for example, Between_EL( 0, var, 1 ) would be false if var = 1
If (low > high)
return high <= var && var < high
return low <= var && var < high
} |
untested (and I think krogdor's way is more elegant) _________________ Ternary (a ? b : c) guide TSV Table Manipulation Library
Post code inside [code][/code] tags! |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Fri Jul 25, 2008 8:38 am Post subject: |
|
|
| [VxE] wrote: | | (and I think krogdor's way is more elegant) |
Not quite my way... Found it somewhere on the forum (I think? o_O ) |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Fri Jul 25, 2008 9:44 am Post subject: |
|
|
| Krogdor wrote: | | Found it somewhere on the forum (I think? o_O ) | Seem familiar... hmm
| [VxE] wrote: | | 'If var is type' and 'If _ between _ and _' can be replaced with some easy functions | Those Ifs are important; I'm not obsessed with expressions/OTB because traditional syntax is fast and simple. _________________ GitHub • Scripts • IronAHK • Contact by email not private message. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Jul 25, 2008 4:06 pm Post subject: |
|
|
I didn't nominate If __ between for that reason. A few of them are useful and readable. It things like EnvMult and IfGreater that bug me.
Agree that definition or link to a new help page called deprecated with definition and such would be required. It took me a while to understand what deprecated meant until I put it in terms of electronic components, where the closest term is "End of Life", where the components are available, but not recommended for new designs because you never know when the parts will run out. _________________
(Common Answers) |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Jul 25, 2008 4:30 pm Post subject: |
|
|
i actually use IfMsgBox quite a bit _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Jul 25, 2008 4:32 pm Post subject: |
|
|
I do too. I would rather see MsgBox affect Errorlevel, as suggested by [VxE], so that you can use if (errorlevel) instead of IfMsgBox. _________________
(Common Answers) |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Jul 25, 2008 6:03 pm Post subject: |
|
|
i dispise that process as it actually conviludes the functionality
for instance i sometimesuse an expression in msgbox
what if the error elvel is set by said expresion
no i think there needs to be some return value for msgbox that is separate _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Fri Jul 25, 2008 6:11 pm Post subject: |
|
|
how about an outputVar in the options field?
| Code: |
Msgbox, 4 vOutputVar, Title, Text, Timeout
|
_________________
(Common Answers) |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Jul 25, 2008 7:13 pm Post subject: |
|
|
then i agree with it in that scenerio _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Jul 25, 2008 7:15 pm Post subject: |
|
|
as far as the if var is type
wow i think the oposite that needs to be expanded heavily
but this would required datatypes better defined in ahk _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Azerty
Joined: 19 Dec 2006 Posts: 72 Location: France
|
Posted: Thu Jul 31, 2008 6:20 am Post subject: |
|
|
| OK to mark older commands as deprecated, but each time one is marked as such, it would be fine to give a suggested (fully compatible) replacement, because these deprecated are still present in existing scripts |
|
| Back to top |
|
 |
|