How to use this AutoHotKey code.

juvilux jet
juvilux jet used Ask the Experts™
on
Hello Experts, How could i use this Auto Hotkey code (ahk)
closehandle("_circleDock_")

closehandle(name){
	pid := 0
	handle := getHandle(pid,name)
	if (handle = "") {
		return ; handle not found
	}
	command := "C:\Users\Astryd\Risorse\_CircleDocks\handle.exe -p " . pid . " -c " . handle . " -y"
	Run, %comspec% /c %command%,, Hide
	}    
}

getHandle(ByRef pid,name) {
	command := "C:\Users\Astryd\Risorse\_CircleDocks\handle.exe -a " . name
	stdout := runStdout(command)
	needle := "No matching" ;when Handle found nothing return in standard output "No matching handles found."
	IfInString, stdout, %needle%
		{
		return ""
		}	
	handle := RegExReplace(stdout, "s).*(...): \\Sessions\\1\\BaseNamedObjects\\_CircleDock_.*", "$1")
	pid := RegExReplace(stdout, "s).*pid: (\d*).*", "$1")
	Return handle
}

; Run a command and return standard output
runStdout(command) {
    shell := comobjcreate("wscript.shell")
    exec := (shell.exec(comspec " /c " command))
    stdout := exec.stdout.readall()   
    Return stdout
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
How could i use this Auto Hotkey code (ahk)
The first step in using it is to download AutoHotkey to at least one computer. This EE article explains how to do that:
AutoHotkey - Getting Started

If you install AutoHotkey via its standard installer, it will own the AHK file extension. So you would take the code that you posted and put it in a plain text file with whatever text editor you prefer, even the built-in Notepad, and call it whatever you want, but make sure the file extension is AHK (not TXT). Then a double-click on the file in Windows/File Explorer, or whatever file manager you use, will run the AutoHotkey script. If you want to use it on a computer without AutoHotkey installed, compile it into a stand-alone EXE file with the AutoHotkey compiler that's on the computer where you installed AutoHotkey. The EXE file will run on systems without AutoHotkey installed. My article cited above also discusses how to use the compiler. Regards, Joe
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
The question is how to use the posted AutoHotkey code. The selected comment explains exactly how to do that, including reference to an article published at Experts Exchange.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial