Search found 3704 matches

by Helgef
Yesterday, 00:07
Forum: AutoHotkey v2 Help
Topic: [a103] - SendMessage [BUG] Topic is solved
Replies: 1
Views: 96

Re: [a103] - SendMessage [BUG] Topic is solved

Changed function calls to throw if too many parameters are passed. Added fn(a,*) as a means to permit but not store surplus parameters. OnMessage(0x2000, ()=>(MsgBox("ASD"))) :arrow: OnMessage(0x2000, (*)=>(MsgBox("ASD"))) Cheers. Edit: The error points on the sendmessage line, which is misleading,...
by Helgef
14 Jun 2019, 08:25
Forum: AutoHotkey v2 Help
Topic: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved
Replies: 9
Views: 240

Re: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved

To be nit picky, although I assume you got it, you do not really access the registers directly, AHK just passes the contents of those registers to your callback function's parameters. &argN always gives the address of the (AHK) variable's content.

Cheers.
by Helgef
13 Jun 2019, 16:56
Forum: AutoHotkey v2 Help
Topic: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved
Replies: 9
Views: 240

Re: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved

Hi. Good job on the research :thumbsup:. I modify my example an put in comments, ; do not use this code timesTwo := CallbackCreate(n => ( n := numget(&n, 'double'), ; 'double', 2.5 is passed in the float register, but callbacks doesn't see this, however, since dllcall blindly supports variadic funct...
by Helgef
13 Jun 2019, 06:36
Forum: AutoHotkey v2 Help
Topic: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved
Replies: 9
Views: 240

Re: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved

i dont understand why i keep getting the same wrong answer(see comment) regardless of what number i pass in. About x64: When the callback returns it puts your number in the integer return register, rax. But dllcall will return, to you, what ever happens to be in the float return register, xmm0. For...
by Helgef
13 Jun 2019, 04:43
Forum: Ask For Help
Topic: ErrorLevel overwritten? Topic is solved
Replies: 9
Views: 319

Re: ErrorLevel overwritten? Topic is solved

- You're unlikely to need to use InputBox in a callback function, so A_InputBoxResult would be a good solution. Most threads do not use inputbox at all, so having a_inputbox saved and restored for every thread would be a complete waste, it would make the slow callback slower, and still wouldn't mak...
by Helgef
13 Jun 2019, 04:31
Forum: AutoHotkey v2 Help
Topic: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved
Replies: 9
Views: 240

Re: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved

you can use float* instead, eg, timesTwo := CallbackCreate(FloatStruct => ( f := NumGet(FloatStruct, 0, "Float"), NumPut(f * 2, FloatStruct, 0, "Float") - 4 )) msgbox DllCall(timesTwo, 'float*', 2.5, 'float*') The problem isn't passing floats, dllcall does that just fine, but rather that callbackcre...
by Helgef
13 Jun 2019, 04:04
Forum: AutoHotkey v2 Help
Topic: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved
Replies: 9
Views: 240

Re: [a103] DllCall/CallbackCreate wrong floating point values Topic is solved

callbackcreate do not generally support floats / doubles, only integers.
by Helgef
13 Jun 2019, 04:03
Forum: Forum Issues
Topic: v2 help subforum
Replies: 6
Views: 166

Re: v2 help subforum

I agree it could use some more sub-forums to organize things.

Cheers.
by Helgef
12 Jun 2019, 04:15
Forum: Ask For Help
Topic: ErrorLevel overwritten? Topic is solved
Replies: 9
Views: 319

Re: ErrorLevel overwritten? Topic is solved

it's not clear when you *can* safely use RegisterCallback with the 'F' option. I.e. for any script beyond 10 lines, it's likely to make your script unsafe. That tells me you still do not understand what it does. The answer is, you can use it when you have control of which thread the callback runs i...
by Helgef
12 Jun 2019, 03:42
Forum: Bug Reports
Topic: [a103] fat arrow - no expr and global var ref.
Replies: 2
Views: 204

Re: [a103] fat arrow - no expr and global var ref.

yes, I only realised my mistake after I got the debug error, it wasn't a typo though, I had extrapolated my thought of f() => expr being equivalent to f(){ ; global if not nested return expr } into thinking expr was optional for f()=> , beacuse it is for f(){return} . If possible, I think it would b...
by Helgef
11 Jun 2019, 03:41
Forum: Ask For Help
Topic: ErrorLevel overwritten? Topic is solved
Replies: 9
Views: 319

Re: ErrorLevel overwritten? Topic is solved

- Could another function be changing it? E.g. a windows event hook callback function.
Yes, as :arrow: I have told you before, don't use the "Fast" option for registercallback if you don't know what it does.

Cheers.
by Helgef
10 Jun 2019, 06:40
Forum: Ask For Help
Topic: [a103] weird __Item property gets inserted in simple array Topic is solved
Replies: 4
Views: 133

Re: [a103] weird __Item property gets inserted in simple array Topic is solved

It should say Unknown property I guess. In, A[] := 'Dummy', 'Dummy' isn't a property. I don't think this will even be allowed for the Array type.

Edit, after you've done A[] := 'Dummy', A[4] is equivalent to A['dummy', 4], hence the message.
by Helgef
10 Jun 2019, 05:44
Forum: Ask For Help
Topic: [a103] weird __Item property gets inserted in simple array Topic is solved
Replies: 4
Views: 133

Re: [a103] weird __Item property gets inserted in simple array Topic is solved

Disregarding the __item property, ++A[] should throw unless A[] is numeric. I guess this is a left-over from v1, I've submitted a fix :arrow: #139.

Cheers.
by Helgef
09 Jun 2019, 10:35
Forum: Wish List
Topic: VarIsInit/VarExist or static for global variables
Replies: 5
Views: 467

Re: VarExist or static for global variables

[edit:]a quote to clarify, Any non-dynamic reference to a variable creates that variable the moment the script launches [end edit] In AutoHotkey, variables are created simply by using them You probably want to ask for a isVarInitialised function. An actual varExist function would take a string as i...
by Helgef
09 Jun 2019, 08:26
Forum: Ask For Help
Topic: put-the-selected-text-in-smart-quotes
Replies: 5
Views: 107

Re: put-the-selected-text-in-smart-quotes

Note that saved := () ; clear saved is not valid syntax, to clear a variable, use var := "" (var = is also valid, but is not recommended.)

You can try using SendInput instead of Send to improve speed.

Cheers.
by Helgef
09 Jun 2019, 05:36
Forum: Bug Reports
Topic: [a103] fat arrow - no expr and global var ref.
Replies: 2
Views: 204

[a103] fat arrow - no expr and global var ref.

Issue 1, in debug build:

Code: Select all

(a=>) ; DEBUG: ParseAndAddLine() called incorrectly.
Issue 2,

Code: Select all

a:=0
a()=>a
msgbox a() ; blank
by assigning b:=a()=>a the problem is circumvented.

Cheers.
by Helgef
09 Jun 2019, 01:12
Forum: Ask For Help
Topic: Random generate numbers helppp
Replies: 8
Views: 192

Re: Random generate numbers helppp

Are you familiar with the :arrow: auto exec section? Example,

Code: Select all

a := 1
b::
    Msgbox % a ; shows 1
return
c := 1
d::
    Msgbox % c ; blank because the line c := 1is never reached. 
return

by Helgef
08 Jun 2019, 07:49
Forum: Scripts and Functions
Topic: MCode4GCC -- C/C++ to MCode Generator
Replies: 83
Views: 15023

Re: MCode4GCC -- C/C++ to MCode Generator

or a function needs to be complex enough for MCode to be faster than regular AHK code? Simply put, yes. The overhead of the dllcall outweighs any possible benefits for your example. Often, when you can replace a script loop with a compiled loop, then you can get speed benefits. Any questions not re...

Go to advanced search