 |
AutoHotkey Community Let's help each other out
|
AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression ...
Goto page Previous 1, 2, 3 ... 53, 54, 55 ... 68, 69, 70 Next
|
| View previous topic :: View next topic |
| Author |
Message |
Mystiq
Joined: 08 Jan 2007 Posts: 83
|
Posted: Sun Sep 05, 2010 1:21 pm Post subject: |
|
|
Thanks for the update  |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Sep 06, 2010 8:23 am Post subject: |
|
|
Thx for static update. Its finally like it should be. _________________
 |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 580
|
Posted: Mon Sep 06, 2010 2:32 pm Post subject: |
|
|
Awesome updates! |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Sep 06, 2010 3:15 pm Post subject: |
|
|
So, I can have N autorun sections:
| Code: | AutoRunSection1()
{
static _ := AutoRunSection1()
msgbox %A_ThisFunc%
}
AutoRunSection2()
{
static _ := AutoRunSection2()
msgbox %A_ThisFunc%
}
...
AutoRunSectionN()
{
static _ := %A_ThisFunc%() ;this doesn't work.
msgbox %A_ThisFunc%
}
|
Perhaps this could be added as extra keyword, for instance "autorun". This way the purpose is much more clear.
| Code: | AutoRunSection1()
{
autorun
msgbox %A_ThisFunc%
} |
_________________
 |
|
| Back to top |
|
 |
RUBn
Joined: 21 May 2007 Posts: 33
|
Posted: Mon Sep 06, 2010 6:32 pm Post subject: Memory |
|
|
- [Great work!!
- Any plans in the future to lower the footprint? It takes about double of memory for the standard script compared to Autohotkey. It's not the most important thing, but I was wondering if this is the result of it being fresh and that it might get a footprint improvement update or not..
|
|
| Back to top |
|
 |
Mystiq
Joined: 08 Jan 2007 Posts: 83
|
Posted: Mon Sep 06, 2010 9:33 pm Post subject: |
|
|
Wondering why the following two ways of setting value do not work the same?
| Code: |
obj := Object()
obj.test.var := "does not work"
obj["test", "var"] := "works"
|
This was a bit of a "trap" for me because you can get the value using the "dot syntax" but not set it. The later method apparently works because it creates the "sub-objects" as necessary while the first one does not. Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second?
If i'm sounding confused, it is because i am.  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Mon Sep 06, 2010 9:48 pm Post subject: |
|
|
| majkinetor wrote: | | static _ := %A_ThisFunc%() ;this doesn't work. | The function isn't running when the static initializer is evaluated. Static initializers are simply prepended to the auto-execute section (after variable references are resolved).
| Quote: | | Perhaps this could be added as extra keyword, for instance "autorun". | Auto-execution isn't the main reason for static initializers, but since it works, I'd rather not add any new syntax.
| RUBn wrote: | | Any plans in the future to lower the footprint? | No.
| Quote: | | It takes about double of memory for the standard script compared to Autohotkey. | I don't know what you call a "standard" script. For AHKControl, I see about 100KB higher Working Set size and roughly the same Private Working Set. I couldn't test my other "resident" scripts since they rely on AutoHotkey_L features. For a mostly empty script #including CLR.ahk and COM.ahk, the increase is 1MB / 600KB on the Unicode build and 300KB / 300KB on the ANSI build. Strings in the Unicode build necessarily take up twice as much memory; that's the cost of Unicode support. Also, it's my understanding that the Working Set is shared with other processes.
Note that whichever build you use, memory usage is slightly lower if you decompress AutoHotkey.exe (upx.exe -d AutoHotkey.exe), except for the x64 build, which can't be (easily) decompressed.
| Quote: | | It's not the most important thing, but I was wondering if this is the result of it being fresh and that it might get a footprint improvement update or not.. | AutoHotkey_L is still mostly AutoHotkey, so there isn't much room for improvement. If I see any opportunities, I'll take them (within reason).
| Mystiq wrote: | | Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second? | Maybe, but it's not feasible. Would it be more "newbie" friendly for neither one to do anything automatic? My reasoning was that x[y,z] looks like multi-dimensional array syntax, so should act like it. See Arrays of Arrays.
| Code: | ;pseudo-code
obj.test.var := "abc"
; resolves to two separate actions:
temp := _objget(obj, "test")
_objset(temp, "var", "abc")
obj["test", "var"] := "abc"
; resolves to one action:
_objset(obj, "test", "var", "abc")
obj.test["var"] := "abc"
; is the same as the one above
|
|
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Wed Sep 08, 2010 1:06 pm Post subject: two issues |
|
|
1.
| Code: | FOLDER = %A_ScriptDir%\DATA
If (FOLDER <> "%A_ScriptDir%\DATA") And (VAR = "")
MsgBox BUG ? |
2.
Any compiled script (from the last 3 versions): TR/Dropper.Gen
(I know this is the AntiVir problem, but even so... |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Sep 08, 2010 1:22 pm Post subject: |
|
|
OOPS!!
The correct one
| Code: | FOLDER = %A_ScriptDir%\DATA
If (FOLDER <> A_ScriptDir . "\DATA") And (VAR = "")
MsgBox BUG ? |
|
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Wed Sep 08, 2010 1:24 pm Post subject: |
|
|
| Thank you ! |
|
| Back to top |
|
 |
Mystiq
Joined: 08 Jan 2007 Posts: 83
|
Posted: Wed Sep 08, 2010 8:15 pm Post subject: |
|
|
| Lexikos wrote: |
| Mystiq wrote: | | Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second? | Maybe, but it's not feasible. Would it be more "newbie" friendly for neither one to do anything automatic? My reasoning was that x[y,z] looks like multi-dimensional array syntax, so should act like it. See Arrays of Arrays.
| Code: | ;pseudo-code
obj.test.var := "abc"
; resolves to two separate actions:
temp := _objget(obj, "test")
_objset(temp, "var", "abc")
obj["test", "var"] := "abc"
; resolves to one action:
_objset(obj, "test", "var", "abc")
obj.test["var"] := "abc"
; is the same as the one above
|
|
Being automatic seems better as it is more obvious i think.
Is there other language(s) that have similar implementation of objects as you have done for AHK_L? If this is a dumb question, don't hesitate to say so.
Thanks! |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Wed Sep 08, 2010 8:23 pm Post subject: |
|
|
AHK_L object model is inspired by Lua programming language (see tables and metatables). AHK_L Get is equivalent to Lua's index, Set equals to newindex and Call is in Lua named the same. AHK_L adopted only those basic metatable operators while Lua has many of them, for instance math operators that give object meaning in usual mathematical context.
I already proposed that AHKL should follow Lua completely in this manner, however, Lexikos doesn't seem interested for now. Altho I don't agree I can understand his choice due to the big difference between those langugages - Lua is general purpose scripting language while AHKL is domain specific one and its accent is not on the language sophistication but on automation and easy to use features. Also, AHKL must maintain AHK legacy for script compatibility and vanilla AHK is pretty much one of the worst languages around. _________________

Last edited by majkinetor on Thu Sep 09, 2010 9:39 am; edited 14 times in total |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Wed Sep 08, 2010 9:31 pm Post subject: Re: two issues |
|
|
| Quote: | | (I know this is the AntiVir problem, but even so... | What do you expect me to do about it? |
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Thu Sep 09, 2010 6:05 pm Post subject: |
|
|
| Quote: | | Quote: | | (I know this is the AntiVir problem, but even so... |
What do you expect me to do about it? |
To let me hope that maybe that wouldn't be the case in a futur version of AutoHotkey_L (like before the last three versions); otherwise it doesn't make much sense for me to only script for myself! |
|
| Back to top |
|
 |
rousni
Joined: 23 Mar 2006 Posts: 126
|
Posted: Sun Sep 12, 2010 11:32 am Post subject: File Object and Inserting text |
|
|
File Object doesn't provide an immediate interface for inserting/deleting text in a file, so I did the following:
| Code: | file := FileOpen("filename.txt", "rw")
File.Seek(540)
string := "< inserted text >" . File.Read()
File.Seek(540)
File.Write(string) |
It works but the fact that File.Seek(540) must be used twice make me doubt this is optimal (?) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|