Dual monitor configuration is challenging.
Sometimes, from the DCS, we want to open web pages, for example, to work with Syncade, or any other web application, for example. However, it kind of stinks to do dual monitor configuration with DeltaV.
Wouldn't it be helpful to click a link on one computer, and have it open a browser on another computer?
Well. We can. With python.
install required packages.
`pip install flask selenium`
next, create the program to 'catch' the web address which we will open, and run the bowser.
```
from flask import Flask, request, jsonify
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
# Initialize Flask and WebDriver
app = Flask(__name__)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
@app.route('/open_tab', methods=['POST'])
def open_tab():
data = request.get_json()
if 'url' not in data:
return jsonify({'error': 'No URL fragment provided'}), 400
# Construct the URL
url_fragment = data['url_fragment']
target_url = f"https://{url}" # Customize the base URL as needed
# Open a new tab and navigate to the target URL
driver.execute_script(f"window.open('{target_url}', '_blank');")
return jsonify({'status': 'Tab opened', 'url': target_url}), 200
if __name__ == '__main__':
app.run(port=5000)
```
Now, rather than opening a web page from within DeltaV on the first station, we make a request to the endpoint, and the tap opens on the endpoint system.
This example is with chrome. Edge works too.
This vastly simplifies configuration of thin clients to work with the DCS.