AutoHotkey Community

It is currently May 26th, 2012, 9:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 173 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 12  Next
Author Message
 Post subject:
PostPosted: June 9th, 2008, 2:56 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
New version released. The download includes LowLevel.ahk, code.ahk and LowLevel.chm, which documents both scripts in addition to a number of AutoHotkey structures.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2008, 4:13 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Lexikos wrote:
New version released.
It looks fantastic! (I need a couple of days to comprehend all these.) It finally opened the door for the popup calculator to support genuine functions, with true parameters and local variables.

Have you considered making an AHK version, which natively supports dynamic code generation?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2008, 8:21 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Laszlo wrote:
Have you considered making an AHK version, which natively supports dynamic code generation?
Yes. It seems more worthwhile than writing an AutoHotkey parser around code.ahk, since all of the parsing and syntax-checking (most of which I would not bother to rewrite) is already done.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2008, 6:26 pm 
When attempting to incorporate LowLevel.ahk either via #include or as a AutoHotKey Lib ... I get the following error ...

Line Text: `sA_CaretX
Error: The leftmost character above is illegal in an expression.

.. when attempting to call any included function (like .. __int() or LowLevel_init()).

I'm using AutoHotKey Version 1.0.47.06.

I have never used this before, so I'm likely doing something stupid. Any help would be appreciated


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2008, 10:19 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Look for the following:
Code:
    ( Join`s
A_AhkPath A_AhkVersion A_AppData A_AppDataCommon A_AutoTrim A_BatchLines
A_CaretX A_CaretY A_ComputerName A_ControlDelay A_Cursor A_DD A_DDD A_DDDD
...
`s is a special escape code recognised only by continuation sections, meaning a space character. Have you by chance used the #EscapeChar directive? If not, I can't explain why that would happen, but I can suggest you try changing `s to `%A_Space% or `, (comma).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2008, 10:28 pm 
I was using #EscapeChar ... removed and all is well.

Thank You


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 5:28 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
numput, numget

by using the bit mechanizm in AHK:

is it possible to set and then also get
a bit value=0 or bit=1
in specific location in a var ?

means
I set bit=1 as binary (no val=1 as asci) set in offset=20001234 (bit location very large)
in varcode myvar, let say

and then I want to retrieve (get) the bit value from above offset

can it be done ?

any help will be appreciated

rgds
ell


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 6:16 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
You could use the Windows bitmap functions exported by ntdll.dll. See an example here.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 6:02 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Sorry to resurrect this topic.

I want to call a dynamic function with a dynamic number of parameters. I can't figure out a way to do this with the new built-in dynamic function calling. It seems you still need to know how many parameters to pass before calling it.

I'd like to dynamically call a full function with parameters and all.

Is there a way to do this with the built-in dynamic function feature, or should I revert to using the LowLevel.ahk library to run it as an __expr() ?

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 8:35 pm 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
bmcclure wrote:
Sorry to resurrect this topic.

Don't be; these are extremely useful functions that I use constantly!

Take a look at AutoHotkey_L (Lexikos' custom build)

Improvements to Dynamic Function Calls
Quote:
When calling a function dynamically, any number of parameters may be passed. This allows functions to accept only the parameters they require, similar to message-monitoring functions. For example:


If you don't plan on using that build- than LowLevel is the way to go.

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 9:31 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Hey, thanks a lot! The improvement to dynamic function calls looks perfect for my needs this time around. It would be nice if that was built into AHK, however, so that my users wouldn't need to have a custom build to run my code from source.

Hmmm... hard to decide which to use :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 10:46 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Code.ahk (in LowLevel.zip) can be used to generate a dynamic expression, such as a function call where the number of parameters are decided at run-time. All functions are documented in LowLevel.chm.
Code:
LowLevel_init()
; Initialize a code generator.
cg := code_gen()

var = 1

; Begin an expression line.
code_line(cg, ACT_EXPRESSION:=3)
; Begin a text/expression arg (expression lines have only one).
code_arg(cg, 0, true)
; Append a function deref/call to the expression.
code_arg_deref(cg, "MyFunc", __findFunc("MyFunc"), true)
; Append the open parenthesis (for valid function-call syntax).
code_arg_write(cg, "(")
; Append a var deref.
code_arg_deref(cg, "var", __getVar(var), false)
; Append the rest of the expression.
code_arg_write(cg, ",2)")
; Finalize the code. Not really necessary in this case, except to use code_run.
ch := code_finalize(cg)
; Call the function.
code_run(ch)
; Delete the code and code generator.
code_delete(ch)
code_gen_delete(cg)

MyFunc(a, b) {
    ListLines
    MsgBox %a%, %b%
}
The code need only be deleted and recreated when the number of parameters changes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2008, 3:47 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Couldn't a function be dynamically called with __expr(), or does it have to be constructed with calls to the code_ functions?

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2008, 8:33 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Which method is best depends on the usage.
  • If the number of parameters or called function is different each time, __expr seems to be the most efficient.
  • If not, a one-time cost of generating code is acceptable as executing the code is much faster. (Once the code is generated, it performs identically to code placed directly in the script.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2008, 6:30 pm 
Offline

Joined: October 30th, 2008, 12:03 pm
Posts: 33
What can you do with it in general. How is ll meant?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 173 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 12  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Klark92, Stigg, Yahoo [Bot] and 18 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