[Script] Offline Docs: Go To Definition

Post your working scripts, libraries and tools for AHK v1.1 and older
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

[Script] Offline Docs: Go To Definition

17 May 2018, 12:32

a dumb way of implementing definition lookup without ruining your clipboard.
rebind hotkeys as you see fit.
adjust the delays accordingly

Code: Select all

; AHK_L 1.1.28.02+
#NoEnv
#WinActivateForce
#SingleInstance Force
#MaxThreadsPerHotkey 2
#Warn ClassOverwrite
SendMode Input
SetBatchLines -1
SetTitleMatchMode 2
SetWorkingDir %A_ScriptDir%

x::goToDefinition()
z::ExitApp

goToDefinition()
{
	clipSaved := Clipboard
	Send ^c
	Sleep 100

	if (WinExist("AutoHotkey ahk_exe hh.exe"))
		activateHelpPasteFast(100)
	else
		runHelpPasteSlow(100, 500)

	Clipboard := clipSaved
}

activateHelpPasteFast(delay)
{
	WinActivate
	Sleep delay
	Send !s
	Sleep delay
	Send ^a
	Sleep delay
	Send ^v
	Sleep delay
	Send {Enter}
}

runHelpPasteSlow(delay, delayBeforePaste)
{
	Run, % Format("*RunAs hh.exe {}\..\AutoHotkey.chm", A_AhkPath) ; delete *RunAs , if u have UAC running
	Sleep delay
	Send !s
	Sleep delay
	Send ^a
	Sleep delayBeforePaste
	Send ^v
	Sleep delay
	Send {Enter}
}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Script] Offline Docs: Go To Definition

18 May 2018, 14:43

Cool idea, I like it very much, I will put it in my misc script :thumbup:.
Comments, I'd recommend clipboard := "" before send ^c and clipwait instead of sleep after. Also, I'd put a winwait ... after run, and then call activateHelpPasteFast after the winwait. You could use setkeydelay and setwindelay to avoid all the sleep delay lines, and send all in one line, doesn't really matter though. Finally, I need to send !ss, not !s, it is possible this differs due to language settings.

Thanks for sharing, cheers :wave:.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 195 guests