Files
GP-Tools-AHK/includes/QuickSearch.ahk

58 lines
2.2 KiB
AutoHotkey

;; Quicksearch / Quicklinks
;; Shortcuts:
;; - 'can': NICE Cancer by site
;; Search:
;; - 'bnf <drug>': Searches BNF for <drug>
;; - 'bnfc <drug>': Search BNFc for <drug>
;;
;; TODO: Add other shortcut URLs, add support for third word and URL escaping
#include libraries\hashTable.ahk
^\::
InputBox, vQuery, BNF Search, , , 200, 100
vQuery := Trim(vQuery)
url_shortcuts := new hashTable
url_shortcuts["can"] := "https://www.nice.org.uk/guidance/ng12/chapter/Recommendations-organised-by-site-of-cancer"
url_shortcuts["hrt"] := "https://d2931px9t312xa.cloudfront.net/menopausedoctor/files/information/229/Easy`%20HRT`%20prescribing`%20guide.pdf"
url_shortcuts["htn"] := "https://www.england.nhs.uk/london/wp-content/uploads/sites/8/2019/11/NICE-NG136-Visual-Summary.pdf"
url_shortcuts["abx"] := "https://gmmmg.nhs.uk/wp-content/uploads/2022/06/GM-Antimicrobial-guidelines-Apr-2022-v11.0-FINAL.pdf"
url_shortcuts["bsc"] := "https://upload.wikimedia.org/wikipedia/commons/a/a7/BristolStoolChart_%28cropped%29.png"
url_shortcuts["rag"] := "https://gmmmg.nhs.uk/rag-category/adult/"
url_shortcuts["amgp"] := "https://nhs.askmygp.uk/"
url_shortcuts["copd"] := "https://gmmmg.nhs.uk/wp-content/uploads/2021/11/COPD-Treatment-Guideline-Sept-2021-V7.pdf"
url_shortcuts["asthma"] := "https://gmmmg.nhs.uk/wp-content/uploads/2022/04/GM-asthma-guideline-2022-V8-for-web.pdf"
url_shortcuts["diab"] := "https://www.nice.org.uk/guidance/ng28/resources/visual-summary-full-version-choosing-medicines-for-firstline-and-further-treatment-pdf-10956472093"
url_shortcuts["tmj"] := "https://www.ouh.nhs.uk/patient-guide/leaflets/files/12128Ptmj.pdf"
; url_shortcuts[""] := ""
if (url_shortcuts.hasKey(vQuery)) {
path := url_shortcuts[vQuery]
Run, chrome.exe %path%
;; Searches
} else {
vBNF := "https://www.medicinescomplete.com/#/search/bnf/"
vBNFC := "https://www.medicinescomplete.com/#/search/bnfc/"
search_split := StrSplit(vQuery, A_Space, 2)
search_type := search_split[1]
search_query := search_split[2]
search_url := ""
if ( search_type = "bnf" ) {
search_url := vBNF
} else if ( search_type = "bnfc" ) {
search_url := vBNFC
}
if ( search_url = "" ) {
MsgBox Not sure what search type: %search_type%
} else {
Run, chrome.exe %search_url%%search_query%
}
}
return