using LoginPI.Engine.ScriptBase; public class epicHyperspace : ScriptBase { private void Execute() { /* -Disclaimer: This workload is provided as-is and might need further configuration and customization to work successfully in each unique environment. For further Professional Services-based customization please consult with the Login VSI Support and Services team. Please refer to the Help Center section "Application Customization" for further self-help information regarding workload crafting and implementation. -Run the workload against the "target" using Script Editor to ensure it will work before uploading it and testing with it -If needed, configure the Set global variables section of this workload -Go through the workload to understand what it's doing. Comment out any unneeded app tests (code blocks) or add on any needed functional testing -This workload will: --Start Epic Hyperspace --Connect to a specified department's database --Lookup a specified patient --Open the patient record in the query's results --Opening and interacting with various tabs within the patient record --Logout of the Epic Hyperspace application -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: true -Notes: -Please update the "DATABASE CONNECTION" string instances herein with the Database Connection to be typed, and subsequently connected to -Please update the "DEPARTMENT INFORMATION" string instances herein with name of the "Department"/instance to connect to -Please update the "PLEASE CHANGE EPIC TITLE WELCOME WINDOW" string instances herein with name of the Epic Hyperspace title window -Please update the "REPLACE WITH SEARCH-ABLE CUSTOMER NAME" string instances herein with name of search-able customer record */ // Ensuring Epic Hyperspace isn't running at the runtime of this script, to ensure a clean slate ShellExecute("cmd /c taskkill /f /im epi*", waitForProcessEnd: true, timeout: 30); // Opening Epic and making sure it start START(mainWindowTitle: "Connection Status", timeout: 15, continueOnError: false); Wait(seconds: 4); // Interacting with Connection Status window MainWindow.FindControlWithXPath(xPath: "Edit:ThunderRT6TextBox", timeout: 3, continueOnError: false); var ConnectionSearchBox = MainWindow.FindControlWithXPath(xPath: "Edit:ThunderRT6TextBox"); ConnectionSearchBox.Focus(); ConnectionSearchBox.Click(); Wait(seconds: 1); // Typing into Connection search box and typing enter ConnectionSearchBox.Type("DATABASE CONNECTION", cpm: 1000); Wait(seconds: 1); ConnectionSearchBox.Type("{ENTER}"); // Waiting for and interacting with the Department Selection flow; pressing enter StartTimer(name: "EpicLanding"); FindWindow(title: "Hyperspace - Production", timeout: 15, continueOnError: false); var HyperspaceDepartmentChooseWindow = FindWindow(title: "Hyperspace - Production"); HyperspaceDepartmentChooseWindow.FindControlWithXPath(xPath: "Pane:MDIClient/Win32 Window:ThunderRT6FormDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6PictureBoxDC/Pane:ThunderRT6UserControlDC[2]/Pane:ThunderRT6Frame/Edit:ThunderRT6TextBox", timeout: 15, continueOnError: true); var HyperspaceDepartmentTextbox = HyperspaceDepartmentChooseWindow.FindControlWithXPath(xPath: "Pane:MDIClient/Win32 Window:ThunderRT6FormDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6PictureBoxDC/Pane:ThunderRT6UserControlDC[2]/Pane:ThunderRT6Frame/Edit:ThunderRT6TextBox", continueOnError: true); if (HyperspaceDepartmentTextbox != null) { HyperspaceDepartmentTextbox.Type("DEPARTMENT INFORMATION", cpm: 9999); HyperspaceDepartmentTextbox.Type("{ENTER}"); } else { Wait(seconds: 0.1); } // Ensuring the Hyperspace landing page loads FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var HyperspaceLanding = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); HyperspaceLanding.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControlDC[1]", timeout: 15, continueOnError: false); StopTimer(name: "EpicLanding"); Wait(seconds: 4); // Conditionally handle the Welcome page (Welcome modal dialog) FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: true); var WelcomeDialog = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); if (WelcomeDialog != null) { Wait(seconds: 1); } else { WelcomeDialog.Focus(); Wait(seconds: 2); KeyDown(KeyCode.ALT); Type("v"); KeyUp(KeyCode.ALT); Wait(seconds: 2); ShellExecute("cmd /c taskkill /f /im iexp*", waitForProcessEnd: true); } // Making sure the Epic button is present on landing page var EpicButton = HyperspaceLanding.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControlDC[1]"); HyperspaceLanding.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControlDC[3]/Pane:ReBarWindow32/ToolBar:ToolbarWindow32[1]/MenuItem", timeout: 15, continueOnError: false); // Clicking on patient lookup button; ensuring the window is running and present afterward var PatientLookupButton = HyperspaceLanding.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControlDC[3]/Pane:ReBarWindow32/ToolBar:ToolbarWindow32[1]/MenuItem"); PatientLookupButton.Click(); Wait(seconds: 4); FindWindow(title: "Patient Lookup", timeout: 15, continueOnError: false); var PatientLookupWindow = FindWindow(title: "Patient Lookup"); PatientLookupWindow.Focus(); PatientLookupWindow.FindControlWithXPath(xPath: "Pane:ThunderRT6Frame/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6Frame/Edit:ThunderRT6TextBox", timeout: 15, continueOnError: false); // Looking for the name MRN input field within the patient lookup window var NameMRNField = PatientLookupWindow.FindControlWithXPath(xPath: "Pane:ThunderRT6Frame/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6Frame/Edit:ThunderRT6TextBox"); NameMRNField.Click(); Wait(seconds: 1); // Typing the search-able customer name to the Name MRN input field and starting a query -- looking for the subsequent patient select string (result of the query) NameMRNField.Type("REPLACE WITH SEARCH-ABLE CUSTOMER NAME", cpm: 1000); Wait(seconds: 1); Type("{enter}"); StartTimer(name: "PatientQuery"); FindWindow(title: "Patient Select", timeout: 15, continueOnError: false); var PatientSelectWindow = FindWindow(title: "Patient Select"); PatientSelectWindow.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC[1]", timeout: 15, continueOnError: false); StopTimer(name: "PatientQuery"); Wait(seconds: 4); PatientSelectWindow.Focus(); // Opening a patient out of the query results; making sure the patient loads PatientSelectWindow.FindControlWithXPath(xPath: "Pane:ThunderRT6UserControlDC[6]/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6Frame/Pane:ThunderRT6Frame/Pane:Shell Embedding").Focus(); Wait(seconds: 5); Type("{ENTER}"); StartTimer(name: "OpeningPatientRecord"); FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var PatientLoadedWindow = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); PatientLoadedWindow.FindControl(className: "TabItem", title: "Notes", timeout: 15, continueOnError: true); StopTimer(name: "OpeningPatientRecord"); Wait(seconds: 4); // Opening Notes tab, making sure it opens, and utilizing custom timers wrapped around its loading var NotesTab = PatientLoadedWindow.FindControl(className: "TabItem", title: "Notes"); NotesTab.Click(); StartTimer(name: "NotesPaneLoaded"); FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var NotesLoadedWindow = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); NotesLoadedWindow.FindControl(className: "Button", title: "Me", timeout: 15, continueOnError: false); StopTimer(name: "NotesPaneLoaded"); Wait(seconds: 4); // Opening Meds tab, making sure it opens, and utilizing custom timers wrapped around its loading NotesLoadedWindow.FindControl(className: "TabItem", title: "Meds", timeout: 15, continueOnError: false); var MedsTabButton = NotesLoadedWindow.FindControl(className: "TabItem", title: "Meds"); MedsTabButton.Click(); StartTimer(name: "MedsPaneLoaded"); FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var MedsLoadedWindow = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); MedsLoadedWindow.FindControl(className: "Button", title: "Current Meds Only", timeout: 15, continueOnError: false); StopTimer(name: "MedsPaneLoaded"); Wait(seconds: 4); // Opening Encounters tab, making sure it opens, and utilizing custom timers wrapped around its loading MedsLoadedWindow.FindControl(className: "TabItem", title: "Encounters", timeout: 15, continueOnError: false); var EncountersTabButton = MedsLoadedWindow.FindControl(className: "TabItem", title: "Encounters"); EncountersTabButton.Click(); StartTimer(name: "EncountersPaneLoaded"); FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var EncountersLoadedWindow = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); EncountersLoadedWindow.FindControl(className: "Button", title: "Hide Admin/Future", timeout: 15, continueOnError: false); StopTimer(name: "EncountersPaneLoaded"); Wait(seconds: 4); // Entering into an item that's in the Encounters Recent Visits results. If nothing loads then logging some error and stopping script Type("{ENTER}"); StartTimer(name: "OpeningRecentVisitItem"); FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW", timeout: 15, continueOnError: false); var RecentVisitsItemPaneLoaded = FindWindow(title: "PLEASE CHANGE EPIC TITLE WELCOME WINDOW"); RecentVisitsItemPaneLoaded.FindControlWithXPath(xPath: "Pane:MDIClient/Win32 Window:ThunderRT6FormDC/Pane:ThunderRT6Frame/Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControl/Pane:ThunderRT6UserControl/Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[1]/Pane:ThunderRT6UserControlDC/Pane:ThunderRT6UserControlDC[3]/Pane:ReBarWindow32/ToolBar:ToolbarWindow32", timeout: 15, continueOnError: true); if (RecentVisitsItemPaneLoaded != null) { Wait(seconds: 0.0001); } else { ABORT(error: "Check that there are open-able items or objects in the Encounters pane"); } StopTimer(name: "OpeningRecentVisitItem"); // Attempting graceful logout, but still completing app if it doesn't Wait(seconds: 4); KeyDown(KeyCode.CTRL); KeyDown(KeyCode.ALT); Type("l"); KeyUp(KeyCode.CTRL); KeyUp(KeyCode.ALT); Wait(seconds: 4); STOP(); } }