How do I merge 2 with 1? i.e. when I highlight a registry entry with left/right click, it can be recognized as such.
Code: Select all
;; Go to anything that is in the currently selected text: URLs, email addresses, Windows paths, or just "Google it" USING WIN+Q
$#Q::
~LButton & RButton:: ; Open in existing Chrome Window
;Tip("Clipping...") ;; include my mouse-tip library for this https://gist.github.com/2400547
clip := CopyToClipboard()
if (!clip) {
return
}
addr := ExtractAddress(clip)
if (!addr)
{
; Google it
;Tip("Searching for [" SubStr(clip, 1, 50) "] ...")
addr := "https://www.google.com/search?q=" . clip
}
else {
; Go to it using system's default methods for the address
;Tip("Going to " Substr(addr, 1, 25) " ...")
}
Run %addr%
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SetTitleMatchMode, 3
;; Go to anything that is in the currently selected text: URLs, email addresses, Windows paths, or just "Google it" USING Hold Left Mouse and Click Right Button
~LButton & MButton:: ; Open in NEW Chrome Window
;Tip("Clipping...")
clip := CopyToClipboard()
if (!clip) {
return
}
addr := ExtractAddress(clip)
if (!addr)
{
; Google it
;Tip("Searching for [" SubStr(clip, 1, 50) "] ...")
addr := "https://www.google.com/search?q=" . clip
}
else {
; Go to it using system's default methods for the address
;Tip("Going to " Substr(addr, 1, 25) " ...")
}
WinGetActiveTitle, TabCurrentlyBrowsing
Run %addr%
while (WinActive(TabCurrentlyBrowsing))
Sleep, 10
while (!WinActive(TabCurrentlyBrowsing))
{
SendInput, ^+{Tab}
Sleep, 50
}
return
; Ctrl Win Q to run Google Images
$^#Q::
Send, ^c
Sleep 50
parameter = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe https://www.google.com.sg/search?q="%clipboard%"&hl=en&gbv=2&tbs=isz:lt,islt:vga&tbm=isch&source=lnt&sa=X&ei=9UXAT-HlDofxrQfcg_XiCQ&ved=0CCwQpwUoBA&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1366&bih=677&cad=h
Run %parameter%
Return
^#x:: ;Google Images for multiple queries in Excel
Xl := ComObjActive("Excel.Application")
For SelectedCell in Xl.Selection
{
Query := StrReplace(SelectedCell.Value, A_Space, "+")
, GoogleImageSearch := "C:\Users\%A_UserName%\AppData\Local\Google\Chrome\Application\chrome.exe "
. "https://www.google.com.sg/search?q=" Query "&hl=en&gbv=2&tbs=isz:lt,islt:vga&"
. "tbm=isch&source=lnt&sa=X&ei=9UXAT-HlDofxrQfcg_XiCQ&ved=0CCwQpwUoBA&"
. "bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1366&bih=677&cad=h"
Run % GoogleImageSearch
}
return
;; utility functions
;; Safely copies-to-clipboard, restoring clipboard's original value after
;; Returns the captured clip text, or "" if unsuccessful after 4 seconds
CopyToClipboard()
{
; Wait for modifier keys to be released before we send ^C
KeyWait LWin
KeyWait Alt
KeyWait Shift
KeyWait Ctrl
; Capture to clipboard, then restore clipboard's value from before capture
ExistingClipboard := ClipboardAll
Clipboard =
SendInput ^{Insert}
ClipWait, 4
NewClipboard := Clipboard
Clipboard := ExistingClipboard
if (ErrorLevel)
{
;MsgBox, The attempt to copy text onto the clipboard failed.
;Tip("The attempt to copy text onto the clipboard failed.")
return ""
}
return NewClipboard
}
;; Extracts an address from anywhere in str.
;; Recognized addresses include URLs, email addresses, domain names, Windows local paths, and Windows UNC paths
ExtractAddress(str)
{
if (RegExMatch(str, "S)((http|https|ftp|mailto:)://[\S]+)", match))
return match1
if (RegExMatch(str, "S)(\w+@[\w.]+\.(com|net|org|gov|cc|edu|info|sg))", match))
return "mailto:" . match1
if (RegExMatch(str, "S)(www\.\S+)", match))
return "http://" . match1
if (RegExMatch(str, "S)(\w+\.(com|net|org|gov|cc|edu|info|sg))", match))
return "http://" . match1
if RegExMatch(str, "S)([a-zA-Z]:[\\/][^/:*?""<>|]+)", match)
return match1
if (RegExMatch(str, "S)(\\\\[\w\-]+\\.+)", match))
return match1
if InStr(str, "%APPDATA%")
Return StrReplace(str, "%APPDATA%", A_AppData)
return ""
}
Code: Select all
; Use Ctrl + Alt + R to navigate to Registry Address RegEdit
;Open Regedit and navigate to RegPath.
;RegPath accepts both HKEY_LOCAL_MACHINE and HKLM formats.
RegJump(RegPath)
{
;Must close Regedit so that next time it opens the target key is selected
WinClose, Registry Editor ahk_class RegEdit_RegEdit
If (SubStr(RegPath, 0) = "\") ;remove trailing "\" if present
RegPath := SubStr(RegPath, 1, -1)
;Extract RootKey part of supplied registry path
Loop, Parse, RegPath, \
{
RootKey := A_LoopField
Break
}
;Now convert RootKey to standard long format
If !InStr(RootKey, "HKEY_") ;If short form, convert to long form
{
If RootKey = HKCR
StringReplace, RegPath, RegPath, %RootKey%, HKEY_CLASSES_ROOT
Else If RootKey = HKCU
StringReplace, RegPath, RegPath, %RootKey%, HKEY_CURRENT_USER
Else If RootKey = HKLM
StringReplace, RegPath, RegPath, %RootKey%, HKEY_LOCAL_MACHINE
Else If RootKey = HKU
StringReplace, RegPath, RegPath, %RootKey%, HKEY_USERS
Else If RootKey = HKCC
StringReplace, RegPath, RegPath, %RootKey%, HKEY_CURRENT_CONFIG
}
;Make target key the last selected key, which is the selected key next time Regedit runs
RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Applets\Regedit, LastKey, %RegPath%
Run, Regedit.exe
}
^#r::
^!r::
SendInput ^c
Sleep 100 ;Wait for copied text to become available
If InStr(Clipboard, "HKEY_")
RegJump( Clipboard ) ;Go to Registry path
Return