Search found 4335 matches
- 18 Mar 2024, 20:48
- Forum: Ask for Help (v2)
- Topic: syntax for map Topic is solved
- Replies: 10
- Views: 332
Re: syntax for map Topic is solved
#Requires AutoHotkey v2.0 url := "https://ahkstorage.blob.core.windows.net/ran/ran.txt" http := ComObject("WinHttp.WinHttpRequest.5.1") http.Open("GET", url, true) http.Send() http.WaitForResponse() mapObj := Map(StrSplit(http.ResponseText, ",", " '")*) m := Menu() submenu := Menu() for item in map...
- 18 Mar 2024, 13:10
- Forum: Ask for Help (v2)
- Topic: syntax for map Topic is solved
- Replies: 10
- Views: 332
Re: syntax for map Topic is solved
If you define the toString() method for Map , it can be displayed in MsgBox : #Requires AutoHotkey v2.0 Map.Prototype.DefineProp('toString', { Call: (m, indent := ' ') => ( res := ['{'], e := m.__Enum(2), [( (*) => e(&k, &v) && ( res[1] .= (res[1] = '{' ? '' : ',') . '`n' . indent (IsObject(k) ? Typ...
- 18 Mar 2024, 12:03
- Forum: Ask for Help (v2)
- Topic: syntax for map Topic is solved
- Replies: 10
- Views: 332
Re: syntax for map Topic is solved
@flyingDman
Code: Select all
str := 'value1,(answer1),value2,(answer2),value3,(answer3),value4,(answer4),value5,(answer5)'
mapvar := Map(StrSplit(str, ',')*)
; testing:
for x,y in mapvar
msgbox x "--->" y
- 18 Mar 2024, 11:31
- Forum: Ask for Help (v2)
- Topic: syntax for map Topic is solved
- Replies: 10
- Views: 332
Re: syntax for map Topic is solved
Unclear what should be displayed in the message box.
- 16 Mar 2024, 10:46
- Forum: Ask for Help (v2)
- Topic: how to display unicode chars returned from DllCall
- Replies: 6
- Views: 129
Re: how to display unicode chars returned from DllCall
Try output := StrGet(DllCall("libs\functions.dll\displayHello", "Ptr"), "UTF-8")
- 16 Mar 2024, 10:20
- Forum: Ask for Help (v2)
- Topic: how to display unicode chars returned from DllCall
- Replies: 6
- Views: 129
Re: how to display unicode chars returned from DllCall
Try replacing Astr with Str:
Code: Select all
output := DllCall("libs\functions.dll\displayHello", "Str")
- 16 Mar 2024, 03:16
- Forum: Ask for Help (v2)
- Topic: How to sort a dictionary Topic is solved
- Replies: 6
- Views: 243
Re: How to sort a dictionary Topic is solved
Another way:
Code: Select all
#Requires AutoHotkey v2
MapObj := Map("apple", "5", "orange", "1", "peach", "7")
for item in MapObj {
str .= item . '`t'
}
str := Sort(Trim(str), 'D`t', (a, b, *) => MapObj[a] > MapObj[b] ? -1 : 1)
arr := StrSplit(str, '`t')
MsgBox arr[1] . '`n' . arr[2] . '`n' . arr[3]
- 11 Mar 2024, 12:55
- Forum: Ask for Help (v2)
- Topic: how to use class RemoteBuffer? Topic is solved
- Replies: 6
- Views: 252
Re: how to use class RemoteBuffer? Topic is solved
No, I wanted to know what this code is supposed to do. Also, the code you posted is not the AHK v1 code.
- 10 Mar 2024, 19:33
- Forum: Ask for Help (v2)
- Topic: how to use class RemoteBuffer? Topic is solved
- Replies: 6
- Views: 252
Re: how to use class RemoteBuffer? Topic is solved
What exactly do you want to do?
- 08 Mar 2024, 07:21
- Forum: Ask for Help (v2)
- Topic: How to make such Gui Edit Topic is solved
- Replies: 13
- Views: 516
Re: How to make such Gui Edit Topic is solved
Sometimes, excess is better than deficiency, especially when it comes to learning... maybe? In my opinion, detailed decoding of constants is important only if you write code in C/C++. In case of AHK there is not much sense in it, specifying EM_SETCUEBANNER := 0x1501 is quite enough. Overloading the...
- 08 Mar 2024, 05:41
- Forum: Ask for Help (v2)
- Topic: How to make such Gui Edit Topic is solved
- Replies: 13
- Views: 516
Re: How to make such Gui Edit Topic is solved
It's longer.
- 08 Mar 2024, 04:00
- Forum: Ask for Help (v2)
- Topic: How to make such Gui Edit Topic is solved
- Replies: 13
- Views: 516
Re: How to make such Gui Edit Topic is solved
DllCall is unnecessary.
Code: Select all
#Requires AutoHotkey v2
EM_SETCUEBANNER := 0x1501
wnd := Gui()
editObj := wnd.AddEdit('w300')
SendMessage EM_SETCUEBANNER, true, StrPtr('Write your text here'), editObj
wnd.Show()
- 07 Mar 2024, 10:07
- Forum: Ask for Help (v2)
- Topic: Reset tooltip by extending existing timer Topic is solved
- Replies: 2
- Views: 76
Re: Reset tooltip by extending existing timer Topic is solved
It could go like this: #Requires AutoHotkey v2.0 F1:: ShowTip(1, 'some text',, 0, 0) F2:: ShowTip(2, 'another text',, 0, 50) ShowTip(id, text := '', timeout := 1000, x?, y?) { static timers := Map() if timers.Has(id) { SetTimer timers.Delete(id), 0 } ToolTip text, x ?? unset, y ?? unset, id if text ...
- 06 Mar 2024, 14:14
- Forum: Ask for Help (v2)
- Topic: How to ISOLATE single and double keypresses?
- Replies: 13
- Views: 296
Re: How to ISOLATE single and double keypresses?
Or like this:
Code: Select all
F3:: {
short := KeyWait(ThisHotkey, 'T.3')
switch {
case short && WinActive('ahk_exe notepad.exe') : MsgBox 'Short 1'
case short : MsgBox 'Short 2'
default : MsgBox 'Long'
}
}
- 02 Mar 2024, 07:41
- Forum: Ask for Help (v2)
- Topic: Static methods in base class not accesssible in derived class via "this".
- Replies: 11
- Views: 353
- 02 Mar 2024, 04:38
- Forum: Ask for Help (v2)
- Topic: Static methods in base class not accesssible in derived class via "this".
- Replies: 11
- Views: 353
Re: Static methods in base class not accesssible in derived class via "this".
I can't get why not just call the static method directly through the class name where it is defined.
- 01 Mar 2024, 12:51
- Forum: Ask for Help (v2)
- Topic: Make Firefox tab active
- Replies: 3
- Views: 202
Re: Make Firefox tab active
Glad to help!
- 01 Mar 2024, 12:50
- Forum: Ask for Help (v2)
- Topic: Static methods in base class not accesssible in derived class via "this".
- Replies: 11
- Views: 353
Re: Static methods in base class not accesssible in derived class via "this".
Code: Select all
x := Child()
class Base
{
static someMethod()
{
MsgBox("Hello")
}
}
class Child extends Base
{
__New()
{
Child.someMethod()
}
}
- 28 Feb 2024, 22:25
- Forum: Ask for Help (v2)
- Topic: Make Firefox tab active
- Replies: 3
- Views: 202
Re: Make Firefox tab active
Try this: #Requires AutoHotkey v2 F3:: { static OBJID_CLIENT := 0xFFFFFFFC, ROLE_SYSTEM_PAGETABLIST := 0x3C, ROLE_SYSTEM_PAGETAB := 0x25 if !hWndFF := WinExist('ahk_class MozillaWindowClass ahk_exe firefox.exe') { throw Error('Firefox window not found') } WinActivate if !accFF := AccObjectFromWindow...
- 27 Feb 2024, 19:25
- Forum: Ask for Help (v2)
- Topic: How to ISOLATE single and double keypresses?
- Replies: 13
- Views: 296
Re: How to ISOLATE single and double keypresses?
Or like this:
Code: Select all
#Requires AutoHotkey v2
Numpad0:: {
KeyWait(key := RegExReplace(A_ThisHotkey, '.*?(\w+)$', '$1'))
if KeyWait(key, 'DT.3')
MsgBox 'Double press', ' ', 'T.6'
else
MsgBox 'Single press', ' ', 'T.6'
}