Search found 4326 matches

by teadrinker
16 Apr 2024, 18:12
Forum: Ask for Help (v2)
Topic: function calling itself to countdown
Replies: 3
Views: 57

Re: function calling itself to countdown

In addition to @boiler's answer, AHK v2 syntax allows you to simplify this function:

Code: Select all

MsgBox rundown(2)

rundown(a) => --a ? rundown(a) : a
or

Code: Select all

MsgBox rundown(2)

rundown(a) => (MsgBox(a), --a ? rundown(a) : a)
by teadrinker
14 Apr 2024, 20:24
Forum: Ask for Help (v2)
Topic: Get sc key code always for English keyboard
Replies: 3
Views: 68

Re: Get sc key code always for English keyboard

@ntepa
Wouldn't it be easier to list all the keys you need? ;)
by teadrinker
14 Apr 2024, 16:29
Forum: Ask for Help (v2)
Topic: Get sc key code always for English keyboard
Replies: 3
Views: 68

Re: Get sc key code always for English keyboard

Code: Select all

key := "/"
if key = "/" {
    scKey := "sc35"
}
MsgBox scKey
by teadrinker
14 Apr 2024, 16:27
Forum: Ask for Help (v1)
Topic: Lock mouse movement to only allow horizontal movement (vertical too if you want)
Replies: 25
Views: 3623

Re: Lock mouse movement to only allow horizontal movement (vertical too if you want)

Try this: #Requires AutoHotkey v1 ~LShift:: ~LCtrl:: BlockInput, MouseMove ToolTip mouse movement restricted. ClipCursor(A_ThisHotkey) BlockInput, MouseMoveOff KeyWait, % SubStr(A_ThisHotkey, 2) ClipCursor() ToolTip Return ClipCursor(hk := "") { if !hk DllCall("ClipCursor", "Ptr", 0) else { CoordMod...
by teadrinker
13 Apr 2024, 16:32
Forum: Ask for Help (v1)
Topic: Lock mouse movement to only allow horizontal movement (vertical too if you want)
Replies: 25
Views: 3623

Re: Lock mouse movement to only allow horizontal movement (vertical too if you want)

Fixed: #Requires AutoHotkey v1 ~LShift:: ~LCtrl:: ToolTip mouse movement restricted. ClipCursor(A_ThisHotkey) KeyWait, % SubStr(A_ThisHotkey, 2) ClipCursor() ToolTip Return ClipCursor(hk := "") { if !hk DllCall("ClipCursor", "Ptr", 0) else { CoordMode, Mouse MouseGetPos, X, Y VarSetCapacity(RECT, 16...
by teadrinker
12 Apr 2024, 15:16
Forum: Ask for Help (v2)
Topic: Issue with Building an Array Using a Loop Topic is solved
Replies: 10
Views: 267

Re: Issue with Building an Array Using a Loop Topic is solved

@Rohwedder
I think the closest translation would be this:

Code: Select all

#Requires AutoHotkey v2

obj := {}
obj.a := 'a'
obj.%-1% := 'b'
obj.5 := 'c'
for k, v in obj.OwnProps() {
    MsgBox 'key: ' . k . '`nvalue: ' . v
}
by teadrinker
12 Apr 2024, 15:08
Forum: Ask for Help (v1)
Topic: Lock mouse movement to only allow horizontal movement (vertical too if you want)
Replies: 25
Views: 3623

Re: Lock mouse movement to only allow horizontal movement (vertical too if you want)

I tested the script with hotkeys XButton1, XButton2, indeed with these keys the script does not work correctly, I don't know why. Try this one: ~LShift:: ~LCtrl:: ToolTip mouse movement restricted. ClipCursor(A_ThisHotkey) KeyWait, % SubStr(A_ThisHotkey, 2) ClipCursor() ToolTip Return ClipCursor(hk ...
by teadrinker
10 Apr 2024, 17:30
Forum: Ask for Help (v2)
Topic: Issue with Building an Array Using a Loop Topic is solved
Replies: 10
Views: 267

Re: Issue with Building an Array Using a Loop Topic is solved

Yes, in the first version arrays didn't have a "Length" property at all, they had a Length() method that returned the maximum positive numeric key: #Requires AutoHotkey v1 arr := [] arr.a := "a" arr[-1] := "b" arr[5] := "c" MsgBox % "length: " . arr.Length() for k, v in arr { MsgBox % "key: " . k . ...
by teadrinker
10 Apr 2024, 14:27
Forum: Ask for Help (v2)
Topic: Issue with Building an Array Using a Loop Topic is solved
Replies: 10
Views: 267

Re: Issue with Building an Array Using a Loop Topic is solved

I'm not sure exactly what you mean, but yes, arrays are arranged differently in the second version. In the first version there was no difference between obj := [] and obj := {}. See this post.
by teadrinker
09 Apr 2024, 19:21
Forum: Ask for Help (v2)
Topic: Issue with Building an Array Using a Loop Topic is solved
Replies: 10
Views: 267

Re: Issue with Building an Array Using a Loop Topic is solved

Without a loop:

Code: Select all

Aer := ["a", "b", "c", "d", "e", "f","g","h"]
Ier := [((e, _, &v) => e(&v) && v := [v]).Bind(Aer.__Enum(1), &v)*]
MsgBox Ier[2][1]
:)
by teadrinker
06 Apr 2024, 13:39
Forum: Ask for Help (v2)
Topic: Weird problem with getElementsByClassName
Replies: 6
Views: 280

Re: Weird problem with getElementsByClassName

A_Index starts with 1, but HTMLCollection with 0. When you reach the last iteration, the collection index becomes invalid.
by teadrinker
30 Mar 2024, 08:07
Forum: Ask for Help (v2)
Topic: Using ComObject and WinHttp.WinHttpRequest.5.1 Topic is solved
Replies: 4
Views: 185

Re: Using ComObject and WinHttp.WinHttpRequest.5.1 Topic is solved

API wrote:FollowUser
GET
nax wrote: WebRequest.Open("POST", URL)
Must be "GET" here instead of "POST".
by teadrinker
29 Mar 2024, 11:54
Forum: Ask for Help (v2)
Topic: How to obtain the memory address of a variable in AutoHotkey v2?
Replies: 28
Views: 1021

Re: How to obtain the memory address of a variable in AutoHotkey v2?

lexikos wrote: ushortNum >= 0x8000 ? ushortNum - 0x10000 : ushortNum
It turned out that this variant has even better performance. But the one I gave also gives you a better idea of how negative numbers are organized in memory.
by teadrinker
29 Mar 2024, 11:42
Forum: Ask for Help (v2)
Topic: GDI+ Gui Pic Issue Topic is solved
Replies: 7
Views: 225

Re: GDI+ Gui Pic Issue Topic is solved

I too assumed that in a real BITMAP example, it would be more complicated. :)
just me wrote: SS_BITMAP
No, it's not necessary in this case:

Code: Select all

wnd := Gui()
wnd.MarginX := wnd.MarginY := 0
wnd.AddText('w300 h200 BackgroundFF8100')
wnd.AddPicture('yp wp hp Background057D9F')
wnd.Show()
by teadrinker
27 Mar 2024, 17:27
Forum: Ask for Help (v2)
Topic: GDI+ Gui Pic Issue Topic is solved
Replies: 7
Views: 225

Re: GDI+ Gui Pic Issue Topic is solved

It could be like this: #Requires AutoHotkey v2 wnd := Gui('Resize') wnd.MarginX := wnd.MarginY := 0 wnd.AddPicture(, 'HBITMAP: ' . CreateBitmap(300, 300, 0xFFFFAA00)) wnd.Show() CreateBitmap(w, h, colorARGB) { #DllLoad Gdiplus static PixelFormat32bppARGB := 0x26200A NumPut('Int', 1, GdiplusStartupIn...
by teadrinker
26 Mar 2024, 13:18
Forum: Ask for Help (v2)
Topic: How to obtain the memory address of a variable in AutoHotkey v2?
Replies: 28
Views: 1021

Re: How to obtain the memory address of a variable in AutoHotkey v2?

Guys, maybe I don't understand something obvious, but there is a classical way to convert an unsigned number into a signed one: check the high bit, if it is equal to one, then invert all bits, add one and change the sign. ushortNum := 64759 shortNum := ushortNum >> 15 ? -((ushortNum ^ 0xFFFF) + 1) :...

Go to advanced search