initial commit, GP tools split into individual includes
This commit is contained in:
23
includes/ChromeController.ahk
Normal file
23
includes/ChromeController.ahk
Normal file
@@ -0,0 +1,23 @@
|
||||
;; Relies on chrome.ahk library, get it from https://github.com/G33kDude/Chrome.ahk, put it in a Chrome subfolder
|
||||
#Include includes\Chrome.ahk
|
||||
|
||||
|
||||
|
||||
;; A function to get the patient demographics of the currently loaded patient in AskMyGP in Chrome
|
||||
;; Supply patient_name and patient_nhs empty variables when called - these will be populated
|
||||
;; Chrome must be running in debug mode, do this by adding ' --remote-debugging-port=9222' to the shortcut
|
||||
;; You must restart chrome completely (kill task or restart pc) to relaunch it in debug
|
||||
GetPatientDetails(ByRef patient_name, ByRef patient_nhs) {
|
||||
|
||||
page := Chrome.GetPageByURL("https://nhs.askmygp.uk", "startswith")
|
||||
;; this happens if we cannot find the tab
|
||||
if !IsObject(page) {
|
||||
MsgBox, Couldn't attach to AskMyGP Tab
|
||||
ExitApp, 1
|
||||
}
|
||||
|
||||
patient_name_parts := StrSplit(page.Evaluate("document.querySelector('.patient-banner').children[0].children[0].textContent").value, ",", , 2)
|
||||
patient_name := patient_name_parts[2] " " patient_name_parts[1]
|
||||
patient_nhs := SubStr(page.Evaluate("document.querySelector('.patient-banner').children[0].children[3].textContent").value, 16)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user