AutoHotkey Community

It is currently May 27th, 2012, 4:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 741 posts ]  Go to page Previous  1 ... 20, 21, 22, 23, 24, 25, 26 ... 50  Next
Author Message
 Post subject:
PostPosted: May 20th, 2011, 3:02 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
Lexikos wrote:
The new behaviour is more logical.
Are you sure?
I would intentionally think of the return and what is following it as belonging together:
Code:
return Function(), Cleanup()
instead of the new behaviour:
Code:
return Cleanup(), Function()


Regards
maul.esel

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2011, 4:21 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
An obscure request: I suggest the RegEx multiline option should automatically trigger the `a option as well, so as to match all types of newlines. It seems this is the far more common case, as opposed to intentionally matching one type of newline but not another. Maybe it makes sense for RegEx to match all types of newlines by default, with or without the multiline option. Again, it seems the need to match only Windows or Unix files, but exclude the other, is rare.

Edit2: I guess there was already a poll several years ago: RegEx: Should the default become "any newline type".
More context: Nesting Loops.

Edit: Towards the bottom of the Regular Expressions (RegEx) - Quick Reference page, in the description of the \R option, the link to the `a option incorrectly points to the RegExMatch page. It should point further up on the same Quick Reference page.


Last edited by jaco0646 on November 26th, 2011, 7:23 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2011, 9:10 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
I partially agree with jaco0646. I would not recommend the `a-option, because it matches vertical tabs and some other "obscure" characters too.
AutoHotkey Documentation wrote:
In v1.0.46.06+, `a recognizes any type of newline, namely `r, `n, `r`n, `v/VT/vertical tab/chr(0xB), `f/FF/formfeed/chr(0xC), and NEL/next-line/chr(0x85).

It should recognize `n, `r and `r`n only, with the (*ANYCRLF)-option.
AutoHotkey Documentation wrote:
In v1.0.47.05+, newlines can be restricted to only CR, LF, and CRLF by instead specifying (*ANYCRLF) in uppercase at the beginning of the pattern (after the options); e.g. im)(*ANYCRLF)^abc$

Practically I don`t see any problem with that change. For the opposite effect, if anytime needed, the `r or `n options can turn this off.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject: multiline quoted strings
PostPosted: June 15th, 2011, 11:02 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
the only thing holding me back from attempting a switch to v2 is I don't want to type quotes twice on every line to make a multiline string.
:?

Edit:
Multiline strings are still possible in v2: http://www.autohotkey.com/forum/viewtop ... ht=#459871


Last edited by tinku99 on July 20th, 2011, 8:03 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2011, 12:19 am 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
v2 difference in the following example. Not sure whether it's a bug or a v2 limitation:

Code:
Loop 2
   MsgBox % test()

test() {
   static a := 1 ? ("a", b := "b") : ""
   return b
}

In v1 L, the code will assign the b variable as static. In v2, the b variable is created once (during static initialization) as local. I'm pretty sure it's a bug as it doesn't make much sense to assign local variables only 1 time during static initialization.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 17th, 2011, 11:05 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
fn.(named_args*) doesn't work for named keys/params, when fn is either a function name or a function object.

My test script: It should display msgboxes with numbers 1-8, but the first and seventh are broken.
Code:
name := "myfn"

Func(name).({ foo: "bar1", test: "testing1" } *) ;doesn't call
Func(name).("testing2", "bar2")

myfn({ foo: "bar3", test: "testing3" } *)
myfn("testing4", "bar4")


%name%({ foo: "bar5", test: "testing5" } *)
%name%("testing6", "bar6")

name.({ foo: "bar7", test: "testing7" } *) ;doesn't call
name.("testing8", "bar8")

myfn(test, foo) {
    msgbox % test "`n" foo
}

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2011, 1:10 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Solar wrote:
v2 difference in the following example.
What difference? You haven't declared the variable "b" static and the function isn't assume-static, so the variable isn't static. This is true for v1.1 and v2.
infogulch wrote:
fn.(named_args*) doesn't work for named keys/params,
Named parameters are supported only for direct (static or dynamic) calls to user-defined functions, not object invocation or calls to built-in functions. If "fn" contains a function name, fn.() works via the default base object mechanism and therefore has the same limitations as any other object invocation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2011, 4:43 pm 
Lexikos wrote:
Named parameters [don't support] object invocation
Wow, that really really sucks.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2011, 1:38 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
That was me, btw.

Maybe a better way to put it is: object invocation does not support named parameters

It should also probably be put in the docs.

I'm curious why not?

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2011, 12:58 am 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
re: double derefs

how would i do this in AHK_L v1.1 or v2 without the double deref?

Code:
class myclass {
   var key1 := "hello"
   var key2 := "world"
}


   MouseGetPos,,, win
   %win% := new myclass()

   msgbox, % "win=" . win . "`n"
            . win . ".key1=" . %win%.key1

return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2011, 3:47 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
guest3456 wrote:
how would i do this in AHK_L v1.1 or v2 without the double deref?

Use an associative-array.
titles = {}
titles[win] = new myclass()

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2011, 4:10 am 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
cool, thanks. hard for me to get my head around the whole objects thing, and then objects in objects, etc


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 6:08 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Lexikos wrote:
Since EnvAdd and EnvSub have been removed, the date math functionality was moved to DateAdd() and DateDiff(). These are more or less equivalent to the old EnvAdd and EnvSub commands (or DateTime += Time, TimeUnits and DateTime1 -= DateTime2, TimeUnits), except that the result is returned (not assigned to the first parameter), and all parameters are required.
What are the paramaters of the new date functions?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 6:26 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Code:
DateAdd(Var, Value [, TimeUnits])
Code:
MsgBox % A_Now "!=" DateAdd(A_Now,1,"M") ;add 1 minute

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 8:37 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
In that case DateDiff is broken :(
Code:
var1:=DateAdd(A_Now,-1,"D") ;as expected
var2:=DateDiff(A_Now,1,"D") ;var2 is blank
MsgBox "%var1"`n"%var2"


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 741 posts ]  Go to page Previous  1 ... 20, 21, 22, 23, 24, 25, 26 ... 50  Next

All times are UTC [ DST ]


Who is online

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