Search found 89 matches

by byzod
27 Apr 2024, 11:10
Forum: Wish List
Topic: Add auto-hide timeout for Tooltip
Replies: 4
Views: 811

Re: Add auto-hide timeout for Tooltip

Code: Select all

TimedToolTip(content, life:=0, x?, y?, whichToolTip:=1){
	life := life < 0 ? 0 : life
	ToolTip(content, x?, y?, whichToolTip)
	SetTimer(()=>ToolTip("", , , whichToolTip), -life)
}
by byzod
26 Apr 2024, 04:21
Forum: Scripts and Functions (v2)
Topic: ExtractFolder - Move contents of a folder out
Replies: 0
Views: 328

ExtractFolder - Move contents of a folder out

How to use: 1. Run the script as admin to add an option for folder context menu 2. Right click on a folder and choose Extract #Requires Autohotkey v2.0 #SingleInstance Off SetWorkingDir A_ScriptDir ; Ensures a consistent starting directory. #NoTrayIcon ; register without args if(A_Args.length <= 0){...
by byzod
18 Mar 2024, 06:22
Forum: Ask for Help (v2)
Topic: Declare constant variable?
Replies: 3
Views: 191

Re: Declare constant variable?

 I didn't intend to confuse somebody, sorry. I just wanted to convey that when using constants from C++ in AHK, it's sometimes important to examine how the constants are actually defined in C++. This is because there may be cases where conversion is necessary due to different variable types. To avo...
by byzod
12 Mar 2024, 05:08
Forum: Ask for Help (v2)
Topic: Declare constant variable?
Replies: 3
Views: 191

Declare constant variable?

I searched but with no luck, found this post mentioned #define but seems ahk can't recognize it Sample code: static ID_SAMPLES_COUNT_MAX := 2 IdList := [1,2,3] if(IdList.Length > ID_SAMPLES_COUNT_MAX) { IdList.pop() } result: Error: Unexpected declaration. Text: static ID_SAMPLES_COUNT_MAX := 2 Line...
by byzod
19 Jan 2024, 04:59
Forum: Scripts and Functions (v2)
Topic: Pin: Highlight an area on screen
Replies: 0
Views: 785

Pin: Highlight an area on screen

Sample code: p1 := Pin(400, 500, 600, 700, 0, "cD0A0FF b57 flash400") Pin(500, 600, 700, 800, 3000, "fLAsH100") sleep 2000 p1.destroy() exitapp How it looks: An1.gif TODO: (when I got the mood :think: ) error handling table driven options parser set blink counts instead of pin life do not expose gui...
by byzod
18 Dec 2023, 04:22
Forum: Ask for Help (v2)
Topic: Why .call() is needed for function member of an object?
Replies: 11
Views: 1089

Re: Why .call() is needed for function member of an object?

That is closer, but not technically accurate Good, then I'm satisfied for now. Will check it later when I got the time If Fun is a function, you can always call it by Fun(args) That is true for AutoHotkey; if it is a function or any other object with a Call method, you can call it by Fun(args) . Bu...
by byzod
17 Dec 2023, 00:31
Forum: Ask for Help (v2)
Topic: Why .call() is needed for function member of an object?
Replies: 11
Views: 1089

Re: Why .call() is needed for function member of an object?

Is ahk treat "function object member" and "method" differently? No. There is no such thing as a "function object member". There are properties, and a property containing a function can be used as a method, or it can return the function itself. A method call will obviously call the function as a met...
by byzod
16 Dec 2023, 07:34
Forum: Ask for Help (v2)
Topic: Why .call() is needed for function member of an object?
Replies: 11
Views: 1089

Re: Why .call() is needed for function member of an object?

It may help to realize that A() is not calling the function directly with no parameters; it is calling the A.Call method, with A as a parameter, the same as A.Call() . If A is a function, its implementation of the Call method executes the function body, without assigning A itself to a parameter. Bu...
by byzod
11 Dec 2023, 06:55
Forum: Ask for Help (v2)
Topic: Why .call() is needed for function member of an object?
Replies: 11
Views: 1089

Re: Why .call() is needed for function member of an object?

Handler.fn(3) calls the "fn" method of Handler, whereas Handler.fn.call(3) calls the "call" method of the value returned by Handler.fn . If you want a more succinct way to call a function which is returned by a property, you can use (Handler.fn)(3) . I still don't get it, as the doc said , Where Fn...
by byzod
02 Dec 2023, 22:19
Forum: Ask for Help (v2)
Topic: How to allow other script use a hotkey that hooked by this script?
Replies: 9
Views: 679

Re: How to allow other script use a hotkey that hooked by this script?

mikeyww wrote:
02 Dec 2023, 06:57
You have it!

Braces below #HotIf are not needed and should be removed, as directives do not use bounding braces.

Code: Select all

#Requires AutoHotkey v2.0

#HotIf WinActive('ahk_class CabinetWClass') && !ProcessExist('MacroRecorder2.exe')
F1:: {
 ; Suspend
 MsgBox 123
}
#HotIf
It's needed
An1.gif
An1.gif (45.74 KiB) Viewed 409 times
by byzod
01 Dec 2023, 23:29
Forum: Ask for Help (v2)
Topic: How to allow other script use a hotkey that hooked by this script?
Replies: 9
Views: 679

Re: How to allow other script use a hotkey that hooked by this script?

I do not recommend running two different AutoHotkey scripts with the same hotkey. You might get unexpected or unpredictable results. You can design your second script to handle whatever you need to do when the hotkey is triggered, according to the active window. A script can check for the presence ...
by byzod
01 Dec 2023, 02:29
Forum: Ask for Help (v2)
Topic: Why .call() is needed for function member of an object?
Replies: 11
Views: 1089

Why .call() is needed for function member of an object?

Code:

Code: Select all

#Requires Autohotkey v2.0+

Fun1 := arg=>msgbox(arg)
FunArr := [Fun1]
Handler := {fn: Fun1}

Fun1(1) 			; 1 / 1
FunArr.Get(1)(2) 	; 2 / 2
Handler.fn.call(3)	; 3 / 3
Handler.fn(3)		; 3 / Error: Too many parameters passed to function.


Expected result / Actual result are in the comment
by byzod
01 Dec 2023, 02:26
Forum: Ask for Help (v2)
Topic: How to allow other script use a hotkey that hooked by this script?
Replies: 9
Views: 679

Re: How to allow other script use a hotkey that hooked by this script?

You can skip the first script and just run the second one. 1. the first one is part of my main script which takes me months converting it to v2, so dump it back to v1 is the last option for me 2. Since it's a macro recorder, I call it from the first script only when needed but prevent F1 for explor...
by byzod
30 Nov 2023, 11:34
Forum: Ask for Help (v2)
Topic: How to allow other script use a hotkey that hooked by this script?
Replies: 9
Views: 679

Re: How to allow other script use a hotkey that hooked by this script?

Figure out what you want to happen in Explorer, and then adjust your first script accordingly. Better yet, just combine the scripts to simplify your approach. 1. How to adjust it? That's exact my question... 2. How to combine v1 and v2 script? The v1 script is long and complicated as you can see, c...
by byzod
30 Nov 2023, 09:54
Forum: Ask for Help (v2)
Topic: How to allow other script use a hotkey that hooked by this script?
Replies: 9
Views: 679

How to allow other script use a hotkey that hooked by this script?

I have a v2 script A which blocks annoying F1 help of windows explorer ; prevent explorer F1 #HotIf WinActive("ahk_exe explorer.exe") { F1:: { ; Suspend } } #HotIf I have another v1 script B which runs as compiled exe that use F1 as one of its function (specifically, it's a macro recorder that has n...
by byzod
19 Nov 2023, 06:07
Forum: Ask for Help (v2)
Topic: Selecting a file in Windows Explorer is slow Topic is solved
Replies: 5
Views: 481

Re: Selecting a file in Windows Explorer is slow Topic is solved

It might be unrelated but I have the slow startup issue with xnview, find the solution after 7 years: add xnview.exe to exception of windows defender

How fast do your ahk runs the first time? If it's slow, you might want to try add autohotkey.exe to exception of your antivirus software
by byzod
17 Nov 2023, 23:22
Forum: Bug Reports
Topic: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)
Replies: 24
Views: 3473

Re: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)

lexikos wrote:
17 Nov 2023, 21:47
Like I said, it is registered by the v1 installer.

Windows does not automatically register a DropHandler.
Ohh that's it, I installed v1 and upgrade to v2, that's why
by byzod
17 Nov 2023, 05:38
Forum: Bug Reports
Topic: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)
Replies: 24
Views: 3473

Re: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)

AutoHotkey v2 does not even register a DropHandler, so drag-drop onto an .ahk file is not possible unless you have registered it yourself or installed v1. {60254CA5-953B-11CF-8C96-00AA00B8708C} gives long paths including spaces, but does not support Unicode. That's really weird, I didn't remember d...
by byzod
13 Nov 2023, 03:44
Forum: Bug Reports
Topic: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)
Replies: 24
Views: 3473

Re: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)

The args of SendTo method is the actually problem I want to solve btw. What do you get when you use this script as a SendTo target: #Requires AutoHotkey v2.0 CmdLine := DllCall("GetCommandLineW", "Str") MsgBox(CmdLine) The result: "C:\App\Something\AutoHotkey\v2\AutoHotkey64.exe" "K:\Down\#Pool\Tes...
by byzod
12 Nov 2023, 23:09
Forum: Bug Reports
Topic: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)
Replies: 24
Views: 3473

Re: A_Args can't handle windows file arguments with spaces (drag&drop, sendto, etc, 8.3 shortname disabled)

I try to test on my work pc and it failed, even I install ahk (for the current user since I can't get admin privilege on work pc): Drag files over .ahk file is not working, drop test.ahk to sendto folder add no new entry shows up in right click > send to That's weird, I think I didn't do anything sp...

Go to advanced search