Reload Script at end of function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bolony21
Posts: 2
Joined: 06 Jan 2022, 16:20

Reload Script at end of function

Post by bolony21 » 08 Dec 2022, 10:47

Hi,

I have some code which uses a toggle. It uses the same key to turn on the toggle and turn off. The toggle works fine.

At the top of my ahk file I have this code to manually reload the script which does cancel any on-going toggles:

Code: Select all

Numpad0::
Reload
Exitapp
I then have another piece of code which logs me out of the program I am using the script on.

Code: Select all

		var =
		(
		/exit
		)
		;--- Function will paste any text that is the variable called var
		SendInput {enter}
		Send_Using_Paste(var)
		SendInput {enter}
		Send !{Numpad0}
You can see at the bottom here I am trying to integrate a reload of my script to the exit command, yet when I re-login to the program my toggles are still active when I do it this way.

Can someone point out the error please?

Thanks.

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Reload Script at end of function

Post by mikeyww » 08 Dec 2022, 11:02

Welcome to this AutoHotkey forum!

There is no need to send a key to call a subroutine. You can use :arrow: Gosub instead.

A hotkey with a modifier is a different hotkey than a hotkey without a modifier.

bolony21
Posts: 2
Joined: 06 Jan 2022, 16:20

Re: Reload Script at end of function

Post by bolony21 » 08 Dec 2022, 11:09

mikeyww wrote:
08 Dec 2022, 11:02
Welcome to this AutoHotkey forum!

There is no need to send a key to call a subroutine. You can use :arrow: Gosub instead.

A hotkey with a modifier is a different hotkey than a hotkey without a modifier.
Hi Mike,

Unless I am mistaken I am not using reload in a subroutine though? It is just tied to Numpad0.

I am trying to reload the script at the end of my /exit command to cancel any on-going toggles I may have running.

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Reload Script at end of function

Post by mikeyww » 08 Dec 2022, 13:34

I think I am not following what is in the script or what the real problem is. It seems like a Reload command should work? I also do not know what "integrate a reload of my script to the exit" really means. "re-login to the program"? I don't understand that. I don't know what the function in the script does, and don't know how the script is organized overall. You referred to a problem about a toggle without showing anything about it. You said that the toggle works, and then that it doesn't work.

Post Reply

Return to “Ask for Help (v1)”