Search found 12 matches

by boat_58
11 Apr 2024, 22:04
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

Thank you. It works great.

I appreciate all the help
by boat_58
11 Apr 2024, 12:52
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

Thank you @boiler for showing how to bind a parameter to a Func Object. (It's included in the AHK documentation, but I never knew how to use it until I could see an actual example, which boiler provided.) @boat_58 I've improved the script by changing ID_of_this_instance from a Global variable to a ...
by boat_58
11 Apr 2024, 11:19
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

Reload wasn't working for us previously, because our SetTimer delay period was too short (only 20 ms). If multiple instances of the script are started simultaneously, they may fail to detect each other or may all target the same previous instance. This would result in multiple instances of the scri...
by boat_58
10 Apr 2024, 15:15
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

boiler wrote:
10 Apr 2024, 14:18
Try putting #SingleInstance Force or #SingleInstance Ignore instead.
They did not work. It still creates multiple instances. I have tried different test scrips and its the same thing.
by boat_58
10 Apr 2024, 13:25
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

It may be because you have #SingleInstance Off at the top of your script. Try removing that. I used the below script to test. I removed the SingleInstance from the top and it was still showing multiple instances of the script based on how many times it re-ran while i had the button pushed down. Whe...
by boat_58
10 Apr 2024, 12:13
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

boiler wrote:
10 Apr 2024, 07:55

Code: Select all

CheckIfKeyIsHeldDown(key)
{
	If not GetKeyState(key)		;if you let go of the key, then:
		Reload
}
Is the "Reload" suppose to generate multiple instances of the script when it is restarted from holding the key down long?
image.png
image.png (5.06 KiB) Viewed 275 times
by boat_58
10 Apr 2024, 07:49
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

I'm not sure, but why are you running a second instance of the sript and killing another instead of just using Reload ? That was the code that was suggested by an earlier user trying to help. Can you show me how using "Reload" instead would look like with the below code that i have for testing? I a...
by boat_58
09 Apr 2024, 12:41
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

Note that the function CheckIfKeyIsHeldDown also has Numpad8 hardcoded to it, so it would need to be changed there as well. It would be better if it automatically checked the hotkey (assuming it’s not a key combination) by binding it as a parameter like this: SetTimer CheckIfKeyIsHeldDown.Bind(A_Th...
by boat_58
09 Apr 2024, 09:46
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

My suggestion is using SetTimer and GetKeyState. Here's an example. Save this code in ahk file extension and type the path to the ahk file in the "Path_to_this_ahk_file" variable. When you hold down Numpad8 key, it'll show a Tooltip with a number and count up to 5 while Numpad8 is held down. It sto...
by boat_58
09 Apr 2024, 09:32
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

@boat_58 — The path to the file needs to include the script file itself, not just the folder in which it resides. Thank you. I forgot to add the .ahk extension. It is now working as intended. Instead of using Numpad8, how can i make it so it uses mouse button 4 or 5? I have tried Xbutton[1-5] just ...
by boat_58
09 Apr 2024, 07:42
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Re: Key Hold to Run script question

My suggestion is using SetTimer and GetKeyState. Here's an example. Save this code in ahk file extension and type the path to the ahk file in the "Path_to_this_ahk_file" variable. When you hold down Numpad8 key, it'll show a Tooltip with a number and count up to 5 while Numpad8 is held down. It sto...
by boat_58
08 Apr 2024, 21:36
Forum: Ask for Help (v2)
Topic: Key Hold to Run script question
Replies: 23
Views: 445

Key Hold to Run script question

I want to create a script that only runs when i hold down a key or the mouse button and it stops when i let go. Is there a way to create such a script? Basically when i run the script, nothing happens until i hold down the specified key and when i let go, the script stops. then when i push the key a...

Go to advanced search