Search found 4709 matches

by Helgef
28 Jun 2022, 12:15
Forum: Ask for Help (v2)
Topic: Pointer to object property? Topic is solved
Replies: 8
Views: 1673

Re: Pointer to object property? Topic is solved

Assuming the dllcall only outputs,

Code: Select all

this.hDatabase := buffer(a_ptrsize)
dllcall 'ptr', this.hDatabase
hDatabase := numget(this.hDatabase, 'ptr')
Cheers.
by Helgef
28 Jun 2022, 11:03
Forum: Ask for Help (v2)
Topic: Pointer to object property? Topic is solved
Replies: 8
Views: 1673

Re: Pointer to object property? Topic is solved

This was replaced by (better) :arrow: buffer. Example,

Code: Select all

o := {}
o.p2 := buffer(...)
ptr := o.p2.ptr
Actually retrieving the address ( :arrow: .ptr) is rarely needed, see :arrow: Buffer-like Objects.

Cheers.
by Helgef
26 Jun 2022, 12:32
Forum: Ask for Help (v2)
Topic: 2.0-beta.5 ToolTip optional parameters do not accept null values?
Replies: 10
Views: 1823

Re: 2.0-beta.5 ToolTip optional parameters do not accept null values?

With :arrow: Commit f12398c, you can simply do,

Code: Select all

ToolTipAuto(text, x := unset, y := unset, wich := 1, cool := 0, time := -1000)
{
    if cool
        CoordMode "ToolTip"
    ToolTip text, x?, y?, wich
    SetTimer(() => ToolTip(, , , wich), time)
}
:thumbup:
by Helgef
26 Jun 2022, 06:46
Forum: Ask for Help (v1)
Topic: How to check if all values in an Array are equal? Topic is solved
Replies: 7
Views: 1495

Re: How to check if all values in an Array are equal? Topic is solved

If array values are numeric, min(a*) == max(a*)

Cheers

Edit, alternative, case sensitive,

Code: Select all

same(arr) {
	v1 := arr[1]
	for k, v in arr
		if !(v1==v)
			return false
	return true
}
by Helgef
22 Jun 2022, 02:28
Forum: AutoHotkey Development
Topic: Add a command to turn off TargetError() Topic is solved
Replies: 10
Views: 2481

Re: Add a command to turn off TargetError() Topic is solved

at least there is an "OnError((*) => -1)" as a consolation.
That is a poor solution, at the very least you should filter for targeterrors, eg,

Code: Select all

onerror (e,*) => -(e is targeterror)
Cheers.

Edit, :arrow: example where v2 targeterror would have saved the day ;)
by Helgef
21 Jun 2022, 13:26
Forum: Ask for Help (v2)
Topic: "Missing" vs empty-string variadic parameter?
Replies: 6
Views: 1319

Re: "Missing" vs empty-string variadic parameter?

lexikos wrote: Maybe it would be better for arr[n] to throw when !arr.Has(n), but it might be a bit late to make that change.
I do not think it is too late, :arrow: Array.__item does not define what happens when !arr.Has(n).

I think it would have been helpful :arrow: in this case.

Cheers.
by Helgef
21 Jun 2022, 13:16
Forum: Scripts and Functions (v1)
Topic: [Class] LongHotkeys (a & b & c & ...)
Replies: 14
Views: 6305

Re: [Class] LongHotkeys (a & b & c & ...)

If you are just using two keys, you might want to consider using the usual custom combinations , i.e., a & s:: However, I do not think it is practical to use a & s in any context where you would be typing. I think LongHotkeys can set context, similar to #if . Otherwise you probably should add a modi...
by Helgef
21 Jun 2022, 13:06
Forum: AutoHotkey Development
Topic: Add a command to turn off TargetError() Topic is solved
Replies: 10
Views: 2481

Re: Add a command to turn off TargetError() Topic is solved

It's hard to imagine that I now mainly use my own wrapped WIN commands. Instead if reimplementing the built in functions to avoid targeterror, just wrap the built in functions or perhaps even better, class _try { static __call(fn, p) { try return %fn%(p*) catch targeterror return } } Just call _try...
by Helgef
21 Jun 2022, 12:48
Forum: Ask for Help (v2)
Topic: 2.0-beta.5 ToolTip optional parameters do not accept null values?
Replies: 10
Views: 1823

Re: 2.0-beta.5 ToolTip optional parameters do not accept null values?

The main thing is that they do work properly before beta5 No, it works properly now, X and Y must be integers or omitted. "" isn't an integer, nor is it equivalent to omitting the parameter. ToolTip was changed in b5 to return the tooltip's hwnd , and now also has better error reporting, consistent...
by Helgef
21 Jun 2022, 04:31
Forum: Ask for Help (v2)
Topic: 2.0-beta.5 ToolTip optional parameters do not accept null values?
Replies: 10
Views: 1823

Re: 2.0-beta.5 ToolTip optional parameters do not accept null values?

Passing "" to mean either 0 or being equivalent to omitting the parameter, was never supported (not in beta at least). The X and Y parameters must be integers or omitted. Here is one example on how you can handle this, ToolTipAuto(text, x := unset, y := unset, wich := 1, cool := 0, time := -1000) { ...
by Helgef
21 Jun 2022, 04:21
Forum: Scripts and Functions (v1)
Topic: [Class] LongHotkeys (a & b & c & ...)
Replies: 14
Views: 6305

Re: [Class] LongHotkeys (a & b & c & ...)

Thanks for the feedback, glad if it comes to use. And thanks to gregster for helping out, much appreciated :thumbup:

Cheers.
by Helgef
20 Jun 2022, 14:49
Forum: Ask for Help (v2)
Topic: Custom enumerator type testing
Replies: 4
Views: 817

Re: Custom enumerator type testing

An object with an __enum method, isn't (in general) an enumerator , but such a method should return an enumerator . I do not think it is important to test x is enumerator . But if you want, you can take an instance of Enumerator , and change its call method to your liking, eg, x := [].__enum(1) x.de...
by Helgef
20 Jun 2022, 02:45
Forum: Ask for Help (v2)
Topic: Invalid not operator in expression Topic is solved
Replies: 8
Views: 1449

Re: Invalid not operator in expression Topic is solved

@iseahound
It is an easy rule to remember imo. But disregarding opinions, it is now a matter of backwards compatibility, as, eg

Code: Select all

if x &&
!var && var := 0
	; ...
is perfectly valid.

Cheers.
by Helgef
20 Jun 2022, 02:31
Forum: AutoHotkey Development
Topic: Add a command to turn off TargetError() Topic is solved
Replies: 10
Views: 2481

Re: Add a command to turn off TargetError() Topic is solved

It is appropriate for the example, you want to trigger run if you cannot activate a specific window, i.e, if either controlgethwnd or winactivate throws a targeterror . dllcall will not throw a targeterror , but will kindly, unlike v1, inform you if you make mistakes such as in your example. And I t...
by Helgef
19 Jun 2022, 12:07
Forum: AutoHotkey Development
Topic: Add a command to turn off TargetError() Topic is solved
Replies: 10
Views: 2481

Re: Add a command to turn off TargetError() Topic is solved

in v2, I'd do like this, try { control:=ControlGetHwnd("SysTreeView321", "ahk_class CabinetWClass") hwnd:=DllCall("GetAncestor", "Ptr", control, "Uint", 2, 'ptr') ; use 'ptr' for the return value. WinActivate(hwnd) } catch TargetError { run("explorer.exe") } Which is more robust than the v1 code, as...
by Helgef
18 Jun 2022, 07:19
Forum: Ask for Help (v1)
Topic: Is a match object not an object?
Replies: 6
Views: 853

Re: Is a match object not an object?

read-only is implicit from the fact that only reading operations are documented ;)

Cheers.
by Helgef
16 Jun 2022, 02:41
Forum: Ask for Help (v2)
Topic: What determines the numerical size of a memory address?
Replies: 2
Views: 530

Re: What determines the numerical size of a memory address?

Large numbers shouldn't be an issue on its own. In combination with (an exceptionally) poor implementation, this could cause issues ofc. Your issue is probably not related to large numbers, but there is no way to tell from the information given.

Cheers.
by Helgef
16 Jun 2022, 02:24
Forum: Suggestions on Documentation Improvements
Topic: CallbackCreate holds a reference to "this" preventing __Delete from executing
Replies: 2
Views: 944

Re: CallbackCreate holds a reference to "this" preventing __Delete from executing

I do not agree that this is an issue with the documentation on callbackcreate, it is clear, The callback retains a reference to the function object, and releases it when the script calls CallbackFree. Perhaps the section :arrow: Freeing Objects could have more advanced examples which could easily be...
by Helgef
13 Jun 2022, 11:40
Forum: Ask for Help (v2)
Topic: In the deep bits of UTF-16
Replies: 14
Views: 2001

Re: In the deep bits of UTF-16

So, does the `strPut()` write correctly the string in the buffer? It seems so msgBox strget(Buff, 'utf-16') == strTest ; 1 UTF-16 Encoding: 0xD83D 0xDCDD src Also, see :arrow: Wikipedia: Code points from U+010000 to U+10FFFF ;U' = yyyyyyyyyyxxxxxxxxxx // U - 0x10000 ;W1 = 110110yyyyyyyyyy // 0xD800...

Go to advanced search