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 

mark older commands as deprecated

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  

Deprecate some commands?
Yes
86%
 86%  [ 13 ]
No
13%
 13%  [ 2 ]
Total Votes : 15

Author Message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 25, 2008 2:44 am    Post subject: mark older commands as deprecated Reply with quote

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
View user's profile Send private message Visit poster's website
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Fri Jul 25, 2008 3:10 am    Post subject: Reply with quote

Agreed.

Although I use IfWinExist and IfWinActive.... Rolling Eyes

For "If var is type" I use:

Code:
IfIs(ByRef var, type) {
   If var is %type%
      Return, true
}
Back to top
View user's profile Send private message AIM Address
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 25, 2008 3:49 am    Post subject: Reply with quote

you could replace with If WinExist() and If WinActive()
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Fri Jul 25, 2008 3:56 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Fri Jul 25, 2008 8:26 am    Post subject: Reply with quote

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 Razz (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
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Fri Jul 25, 2008 8:38 am    Post subject: Reply with quote

[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
View user's profile Send private message AIM Address
polyethene



Joined: 11 Aug 2004
Posts: 5248
Location: UK

PostPosted: Fri Jul 25, 2008 9:44 am    Post subject: Reply with quote

Krogdor wrote:
Found it somewhere on the forum (I think? o_O )
Seem familiar... hmm Razz

[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.
_________________
GitHubScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 25, 2008 4:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Fri Jul 25, 2008 4:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 25, 2008 4:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Fri Jul 25, 2008 6:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 25, 2008 6:11 pm    Post subject: Reply with quote

how about an outputVar in the options field?
Code:

Msgbox, 4 vOutputVar, Title, Text, Timeout

_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Fri Jul 25, 2008 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Fri Jul 25, 2008 7:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Azerty



Joined: 19 Dec 2006
Posts: 72
Location: France

PostPosted: Thu Jul 31, 2008 6:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
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