Link to home
Create AccountLog in
Avatar of juvilux jet
juvilux jet

asked on

How to use this AutoHotKey code.

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

ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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.