Search found 106 matches

by Sam_
28 Mar 2018, 15:24
Forum: Ask For Help
Topic: bind method to object that calls it
Replies: 0
Views: 147

bind method to object that calls it

For example, the .Length() method operates on whatever object "calls" it (although call might not be the correct term here). This is true for any arbitrary object or array, be it Obj.Length() or this.Object[3,"foo","bar"].Length() . How do I bind a custom method/function in such a way that it behave...
by Sam_
08 Nov 2017, 22:44
Forum: Ask For Help
Topic: LoadPicture() from variable Topic is solved
Replies: 10
Views: 1768

Re: LoadPicture() from variable Topic is solved

You need to specify the calling convention, DllCall( "ntdll\RtlUlongByteSwap",UInt, DllCall( "GetSysColor", Int,15 ) <<8 , "cdecl" ) . See dllcall It seems RtlUlongByteSwap from ntdll in the above DllCall does not play nicely with x64 AHK. I have implemented a workaround to manually swap the bytes ...
by Sam_
29 Oct 2017, 19:09
Forum: Ask For Help
Topic: LoadPicture() from variable Topic is solved
Replies: 10
Views: 1768

Re: LoadPicture() from variable Topic is solved

Helgef wrote:You need to specify the calling convention, DllCall( "ntdll\RtlUlongByteSwap",UInt, DllCall( "GetSysColor", Int,15 ) <<8 , "cdecl"). See dllcall
That is what I did. I meant my comment as an observation not a question.
by Sam_
27 Oct 2017, 13:42
Forum: Ask For Help
Topic: LoadPicture() from variable Topic is solved
Replies: 10
Views: 1768

Re: LoadPicture() from variable Topic is solved

This script loads a file into the memory, and then creates an hBitmap based on binary data from a variable. It uses a function by SKAN, which is linked to at the bottom. q:: ;data to hBitmap RegRead, vPath, HKEY_CURRENT_USER\Control Panel\Desktop, Wallpaper ;============================== ;from fil...
by Sam_
26 Oct 2017, 18:12
Forum: Ask For Help
Topic: LoadPicture() from variable Topic is solved
Replies: 10
Views: 1768

LoadPicture() from variable Topic is solved

I'm looking for a way to accomplish something roughly equivalent to LoadPicture (), but instead of loading a bitmap from disk, I want to load one already read into a variable (via FileRead, .RawRead(), or equivalent). I have searched around the forum and read a dozen or so MSDN docs, but haven't bee...
by Sam_
19 Oct 2017, 17:35
Forum: Ask For Help
Topic: count total instances of running script Topic is solved
Replies: 2
Views: 282

Re: count total instances of running script Topic is solved

Ah yes, that is exactly what I was looking for. Thank you, @Exaskryz!

This does the trick nicely:

Code: Select all

DetectHiddenWindows, On
SetTitleMatchMode, 2
WinGet, ThreadCount, list, part_of_title ahk_class AutoHotkey
MsgBox % ThreadCount
by Sam_
18 Oct 2017, 13:39
Forum: Ask For Help
Topic: count total instances of running script Topic is solved
Replies: 2
Views: 282

count total instances of running script Topic is solved

When multiple instances of a script are running (via the #SingleInstance, Off directive), how can a script count how many instances are currently running?
by Sam_
15 Jul 2017, 11:16
Forum: Ask For Help
Topic: combinations and permutations (and anagrams)
Replies: 18
Views: 2710

Re: combinations and permutations (and anagrams)

My favorite Permutation function to date is Lexicographical next permutation in O(1) time.
by Sam_
15 Jul 2017, 10:54
Forum: Ask For Help
Topic: Current Date as a Directory name Topic is solved
Replies: 5
Views: 511

Re: Current Date as a Directory name Topic is solved

Sounds like you are using an older version of AHK. You need at least v1.1.20 for SetTimer to use a function instead of a label (which is what I have done).
by Sam_
13 Jul 2017, 13:31
Forum: Ask For Help
Topic: Current Date as a Directory name Topic is solved
Replies: 5
Views: 511

Re: Current Date as a Directory name Topic is solved

Use at your own risk! #Persistent SetTimer, UpdateFolder, 300000 ; Check ~ every 5 min Return UpdateFolder(){ FormatTime, Today, , ! MM-dd-yy ; Format today's date in the format you specified Loop, C:\*, 2, 0 ; Loop through the folders on the top level of the C drive { SplitPath, A_LoopFileLongPath,...
by Sam_
12 Jul 2017, 12:54
Forum: Ask For Help
Topic: Force ES_PASSWORD style on Edit control
Replies: 3
Views: 394

Re: Force ES_PASSWORD style on Edit control

If notepad is complicating the issue, here is an example with AHK. Using GuiControl works as expected: M := 10 Gui, Margin, %M%, %M% Gui, Font, s16 Gui, Add, Edit, Password vEdit1 w200, Hello world Gui, Add, Checkbox, -Checked vCheckbox1 gShow wp, Show password Gui, Show ControlGet, ControlHwnd, Hwn...
by Sam_
12 Jul 2017, 12:33
Forum: Ask For Help
Topic: Force ES_PASSWORD style on Edit control
Replies: 3
Views: 394

Re: Force ES_PASSWORD style on Edit control

This style is valid only for single-line edit controls. Edit Control Styles That possibility had occurred to me, but running Control, Style, -0x4, , ahk_id %ControlHwnd% ; Turn off ES_MULTILINE style first doesn't help either. I've even tried playing around with Window Detective , but still can't g...
by Sam_
11 Jul 2017, 22:22
Forum: Ask For Help
Topic: Force ES_PASSWORD style on Edit control
Replies: 3
Views: 394

Force ES_PASSWORD style on Edit control

I'm having trouble forcing an edit control to use the ES_PASSWORD (0x20) style. As a simple test I open a blank notepad window, type a few lines of gibberish, and run ControlGet, ControlHwnd, Hwnd, , Edit1, Untitled - Notepad Control, Style, +0x20, , ahk_id %ControlHwnd% But the control's contents a...
by Sam_
30 Jan 2017, 14:31
Forum: Ask For Help
Topic: How to free memory allocated by external DLL
Replies: 3
Views: 512

Re: How to free memory allocated by external DLL

From your link, it uses malloc , so look at the import table of libzopfli.dll (assuming your copy of libzopfli.dll is not statically linked to a CRT) and then DllCall free from the same DLL it gets its malloc from. That was the clue I needed, thanks! I had tried free before but it wasn't found in t...
by Sam_
28 Jan 2017, 14:27
Forum: Ask For Help
Topic: How to free memory allocated by external DLL
Replies: 3
Views: 512

How to free memory allocated by external DLL

I make a DllCall to an external 3rd-party DLL ( zopfli ), and one of the parameters calls for a pointer to a pointer to a block of memory. For reference, the function I am calling is ZopfliZlibCompress which is defined as: /* Compresses according to the zlib specification and append the compressed r...
by Sam_
03 Jan 2017, 13:14
Forum: Ask For Help
Topic: Determine if Array Contains Array
Replies: 1
Views: 272

Determine if Array Contains Array

I am trying to make a function that efficiently determines whether one array is contained within another, while making as few assumptions about each array as possible. For now I am only assuming that both arrays contain 1) keys that are integers (negative and zero key values are acceptable) and 2) v...
by Sam_
30 Nov 2016, 10:42
Forum: Tutorials
Topic: How to optimize the speed of a script as much as possible.
Replies: 93
Views: 66166

Re: How to optimize the speed of a script as much as possible.

@V for Vendetta, @FanaticGuru After further testing, I have arrived at the same conclusion as you. I set the following script up and let it run for a few hours last night Process, Priority, , H SetBatchLines, -1 #MaxMem 1024 Var:="" While 0<1 { VarSetCapacity(Var, 80000000, 0) QPC(1) Loop, 10000000 ...
by Sam_
29 Nov 2016, 12:08
Forum: Tutorials
Topic: How to optimize the speed of a script as much as possible.
Replies: 93
Views: 66166

Re: How to optimize the speed of a script as much as possible.

@V for Vendetta, Here are my results: Direct value assignment: Var:="" QPC(1) Loop, 1000000000 Var=1 toc1:=QPC(0) QPC(1) Loop, 1000000000 Var:=1 toc2:=QPC(0) MsgBox % toc1 "`n" toc2 Result: --------------------------- benchmarks.ahk --------------------------- Var=1 21.113292 ; <- faster Var:=1 56.6...

Go to advanced search