So a variable's value and an object property value are two different things. This is something new to me. Thanks jethrow.The third param of Loop-parse needs to be a variable, not an object value.
Why use AutoHotkey_L? Ask Questions Here...
On a related note:
Allowing InputVar to be an expression as per Laszlo's suggestion would make your code work. It should not break any existing scripts, so could be implemented before or after v2.InputVars: Possibly get rid of the concept of an InputVar by allowing percent signs around such variables:
Loop, Parse, InputVar Loop, Parse, %InputVar%(However, obvious arrays such as Array%i% should still be recognized.) Although this would break some existing scripts and reduce flexibility, it might be worth it because Input Variables have been cited as a source of confusion by me and others because they deviate in counterintuitive, seemingly haphazard ways from the practice of enclosing vars in percent signs.
Laszlo: InputVars: E.g. in <Loop, Parse, InputVar> it was more logical to allow any expression in place of InputVar. A variable is still valid, but we could have literal strings in quotes, too. <Loop, Parse, %InputVar%> would mean a 2-level dereference, which is rarely used.
Source: AutoHotkey v2
This makes it clear. Thanks.Obj["list"] is an expression
I get "Error: Call to nonexistent function" with ObjGet(). Is it an internal hidden function of some sort that users don't have to use or know about? I could not find relavant information that helps me understand what it is.It might help to think of it in terms of a function-call (which incidentally is how the expression parser represents it): ObjGet(Obj, "list").
AHK_L Change Log[/url]":3nolkj5e]a.b.c[d] is equivalent to ObjGet(a.b,"c",d) and x.y[z]:=v is equivalent to ObjSet(x,"y",z,v)
Default Base
When a non-object value is used with object syntax or passed to ObjGet, ObjSet or ObjCall, the default base object is invoked.
Sounds great. I look forward to it.Allowing InputVar to be an expression as per Laszlo's suggestion would make your code work. It should not break any existing scripts, so could be implemented before or after v2.
I said "think", not "execute".I get "Error: Call to nonexistent function" with ObjGet().
Yes, but that's beside the point. It is evaluated like a function-call. It may even ultimately result in a function-call, depending on the object.Is it an internal hidden function of some sort that users don't have to use or know about?
If you understand what a function-call is, that should be sufficient.I could not find relavant information that helps me understand what it is.
If you understand what a function-call is, that should be sufficient.
list := "a,b,c,d,e" Loop, Parse, SubStr(list, 5), `, out .= A_LoopField "`n" msgbox % outIs the part in this case SubStr(list, 5) a function call or is the term more specific to objects?
Oh, I got it. Thank you. (I'm terrible at terminologies.)It's a function call... :?
Now let's say I just want to change second line from this:This is first line.
This is second line.
Thie is third line.
... etc. up to 50000 lines.
to that:This is second line.
and leave other lines as they are.This is 2. line.
Currently, i would use this method which is slow and inefficient;
FileRead, FileText, C:\Some file.txt Loop, parse, FileText, `n, `r { if A_Index = 2 New_FileText .= "This is 2. line.`n" ; modified line else New_FileText .= A_loopField "`n" ; leave as is } FileDelete, C:\Some file.txt FileAppend, %New_FileText%, C:\Some file.txt, UTF-8Is there some better method to do that job in AHK_L? Like;
> use that File Object (file := FileOpen(Filename, Flags [, Encoding])),
> move file pointer to second line (File.Seek),
> delete just that line (what command???),
> write new line(File.Write(String)), and
> save & close file (File.Close()) (without modifying other lines.)
Or something else? Please help. Method above is really slow and inefficient.
If my file is
and all I want to do is to modify just one little part:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
... etc.
It's silly to rewrite whole giant file just because of one little modification.xYxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
... etc.
I hope there is a way just to change that little part on hard disk, and leave other as is.
str := [color=#666666]"This is 2. line."[/color] File := [color=#107095]FileOpen[/color]([color=#666666]"File.txt"[/color], [color=#666666]"rw`n"[/color]) File.ReadLine() pos := File.pos [color=#107095]Loop[/color], % [color=#107095]StrLen[/color](File.ReadLine()) - [color=#107095]StrLen[/color](str) - 1 pad .= [color=brown]A_Space[/color] File.pos := pos File.WriteLine(str . pad) File.Close()
str := [color=#666666]"what if new text length is > text being replaced?"[/color] File := [color=#107095]FileOpen[/color]([color=#666666]"File.txt"[/color], [color=#666666]"rw`n"[/color]) File.ReadLine() pos := File.pos File.ReadLine() data := File.Read() File.pos := pos File.WriteLine(str) File.Write(data) File.Close()
Using Winsock2.ahk for sending email. It was working. Upgraded to Autohotkey_L and it's not working. Seems the strings being passed in are getting mangled. It's likely the DLLCall in __WinINet_InternetCrackURL
Anyone have a solution?
Thanks