Search found 338 matches

by pneumatic
20 Jan 2022, 18:18
Forum: Ask for Help (v1)
Topic: Sorting strings containing numbers Topic is solved
Replies: 3
Views: 421

Re: Sorting strings containing numbers Topic is solved

Hmm this solution by @jeeswg seems to work: Sort, List, F SortStrCmpLogical SortStrCmpLogical(vTextA, vTextB, vOffset) ;for use with AHK's Sort command { local vRet := DllCall("shlwapi\StrCmpLogicalW", "WStr",vTextA, "WStr",vTextB) return vRet ? vRet : -vOffset } I'll need to test it some more but i...
by pneumatic
20 Jan 2022, 17:53
Forum: Ask for Help (v1)
Topic: Sorting strings containing numbers Topic is solved
Replies: 3
Views: 421

Sorting strings containing numbers Topic is solved

Regarding the Sort function, it considers the string "10" to come before "9" or "9 ". This can be problematic when sorting strings containing numbers, eg. List := "Folder 8" . "`nFolder 9" . "`nFolder 10" . "`nFolder 11" Sort , List MsgBox , % List Result: Folder 10 Folder 11 Folder 8 Folder 9 In Wi...
by pneumatic
18 Jan 2022, 10:23
Forum: Ask for Help (v1)
Topic: Send key without triggering custom hotkey Topic is solved
Replies: 11
Views: 2342

Re: Send key without triggering custom hotkey Topic is solved

Thanks, look like I must have screwed something up elsewhere, as creating a new .ahk file with just the following code works fine and sends the Browser_Back to Windows on release and does NOT trigger the Browser_Back:: again -- sorry for wasting all your time. Browser_Back:: ToolTip , Browser_Back p...
by pneumatic
18 Jan 2022, 10:16
Forum: Ask for Help (v1)
Topic: Send key without triggering custom hotkey Topic is solved
Replies: 11
Views: 2342

Re: Send key without triggering custom hotkey Topic is solved

a down/up hotkey pair is always implemented with hook hotkeys by default, so ahk-sending the downkey from the upsubroutine wont trigger the downsubroutine if u observe other behaviors, either that isnt ur script or something else is at play Ok, I found the cause of my confusion: I was using a Sound...
by pneumatic
18 Jan 2022, 09:50
Forum: Ask for Help (v1)
Topic: Send key without triggering custom hotkey Topic is solved
Replies: 11
Views: 2342

Re: Send key without triggering custom hotkey Topic is solved

I am confused about your goal. Perhaps a step-by-step example would help. You want to press the key but not trigger the hotkey with the key's name? I do not understand. I would like to Send {Browser_Back} without triggering my custom defined Browser_Back:: hotkey routine. I may not necessarily use ...
by pneumatic
18 Jan 2022, 09:26
Forum: Ask for Help (v1)
Topic: Send key without triggering custom hotkey Topic is solved
Replies: 11
Views: 2342

Re: Send key without triggering custom hotkey Topic is solved

Thanks, but I'm not sure how that would be useful. The Browser_Back key is a physical button on the keyboard, and I'll be using it as a custom modifier to enable touchpad scrolling in all applications, not just web browsing. I may even end up using a different key to Browser_Back, such as Escape or ...
by pneumatic
18 Jan 2022, 09:06
Forum: Ask for Help (v1)
Topic: Send key without triggering custom hotkey Topic is solved
Replies: 11
Views: 2342

Send key without triggering custom hotkey Topic is solved

Hello, I am trying to Send {Browser_Back} without it triggering my custom Browser_Back:: hotkey -- is it possible? I've tried the $ prefix , different Send modes and #InstallKeybdHook , without success. My script looks like this: Browser_Back:: ;do conditonal stuff return Browser_Back Up:: ; do cond...
by pneumatic
11 May 2021, 21:34
Forum: Ask for Help (v1)
Topic: Multiple comparison operators in one parentheses Topic is solved
Replies: 2
Views: 310

Multiple comparison operators in one parentheses Topic is solved

AHK v1 accepts this code: var := 0 if (0 < var < 100) msgbox var is between 0 and 100 else msgbox var is NOT between 0 and 100 The (0 < var < 100) is not being evaluated as I was expecting (I've tried adding % and removing brackets). What does ahk interpret (0 < var < 100) as exactly? I've looked in...
by pneumatic
08 May 2021, 07:54
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

teadrinker wrote:
08 May 2021, 05:45
You need to increase pHaystack and decrease hstkSize. I'd do it before calling the function.
Thanks.

I'm a bit surprised though; I didn't know we could mess with pointer addresses like that -- could there be some side effects on 32/64-bit due to A_PtrSize?
by pneumatic
08 May 2021, 02:50
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

teadrinker Just to note that your newer versions seems to contain more pre-code leading up to the msvcrt\memchr and msvcrt\memcmp , which may negate the performance gain when searching for many needles in a haystack (I'm searching for around 1000 of them :) ) edit: after comparing msvcrt vs mcode p...
by pneumatic
06 May 2021, 21:26
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

A slight inconvenience with the msvcrt solution is that after finding a needle, it doesn't seem to advance the search offset by the length of the needle, so you can get overlapping duplicates for needles which require manual removal afterwards. eg. haystack: 01 04 0A 01 04 0A 01 04 FF FF needle: 01 ...
by pneumatic
06 May 2021, 21:12
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

The mcode solution seems to be unusually slow when searching for needles containing 0's -- slower than the msvcrt solution. I suspect it's due to teadrinker's optimisation of searching for the largest byte first, which doesn't seem to be implementable with the mcode, since you can't vary the size of...
by pneumatic
06 May 2021, 09:55
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

There's challenge: to compile a 64-bit version of the mcode for even more performance:
https://autohotkey.com/board/topic/23627-machine-code-binary-buffer-searching-regardless-of-null/#entry152824
by pneumatic
06 May 2021, 09:23
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

jNizM wrote:
06 May 2021, 09:19
After 99.8% of all Windows 10 are on 64-bit, I haven't used 32-bit AutoHotkey for years.
And I don't see any reason why you should use 32-bit since Window 10. 🤷‍♂️
For compatibility with mcode.
by pneumatic
06 May 2021, 09:07
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

teadrinker wrote:
06 May 2021, 09:00
@pneumatic
Can you test this, please
It only works if I put either Cdecl or Cdecl Ptr as final parameter on both memchr and memcmp in SearchInBuff (in your example it's only present on memchr).
by pneumatic
06 May 2021, 08:57
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

teadrinker wrote:
06 May 2021, 08:30
Perhaps, "Cdecl" must be added to all msvcrt functions:
That solves the issue for me.
by pneumatic
06 May 2021, 07:58
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

I've noticed on AutohotkeyU32, teadrinker's solution throws a runtime error on the msvcrt DllCalls, but ErrorLevel is 0 in the catch block, and the function still seems to work fine. So if you are putting the DllCalls in a try block then it will fail. AutohotkeyU64 doesn't have this issue. Also Auto...
by pneumatic
06 May 2021, 07:32
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

Well as it turns out, I actually need more speed that only the mcode solution can provide. The mcode seems to be around 10x faster -- it's fricken fast! The problem is that I also need to search the binary file for a pattern that matches some logical rules to do with their sum and what bytes are aro...
by pneumatic
06 May 2021, 01:52
Forum: Ask for Help (v1)
Topic: Search optimisation Topic is solved
Replies: 42
Views: 3811

Re: Search optimisation Topic is solved

[deleted] Reason for deletion: I couldn't understand teadrinker's code and was asking for help, then realised I miscalculated maxByte which is actually the index of the largest byte in the needle, then it all made sense. I presume also that searching for maxByte speeds up the search if it correspond...

Go to advanced search