I found a solution to my problem even though it is probably not the easiest. On my Mac I made the following Python file and placed in on the machine running Portal Touch. (If you haven't done this before, ask ChatGPT for instructions on setting up Python on a Mac.) Then create an "Run Apple Script" action on Portal Touch. It won't let me upload the files themselves, but below is the scripts for the NEXT service item and the PREVIOUS service item. So far, they seem to be working fine. It took several fixes, but ChatGPT helped me create these files.
-------NEXT SERVICE ITEM-----------------------------------------------------------
"""
Instructions:
- Update this file with the correct IP address of OpenLP (found in the "Remote" section of the preferences).
- Install this file in /Users/USERNAME/Documents/TouchPortalScripts/next_service_item.py (make sure the file ends in .py and that nothing has been added.)
- Install a "Run Apple Script Action:
- Use this Script: do shell script "/usr/bin/python3 '/Users/USERNAME/Documents/TouchPortalScripts/next_service_item.py'"
"""
import requests
import json
import urllib.parse
OPENLP_IP = "192.168.86.25" # replace with your OpenLP machine IP
PORT = "4316"
r = requests.get(f"http://{OPENLP_IP}:{PORT}/api/v2/service/items")
items = r.json()
print("Retrieved items:", json.dumps(items, indent=2)) # Pretty print for clarity
current_index = next((i for i, item in enumerate(items) if item.get("selected")), None)
print("Current index:", current_index)
if current_index is not None and current_index + 1 < len(items):
next_index = current_index + 1
print("Next index:", next_index)
data = {"request": {"id": next_index}}
encoded = urllib.parse.quote(json.dumps(data))
url = f"http://{OPENLP_IP}:{PORT}/api/service/set?data={encoded}"
print("Calling URL:", url)
response = requests.get(url)
print("Response:", response.status_code)
else:
print("Nothing advanced: either no item selected or already at end of list.")
-------PREVIOUS SERVICE ITEM-----------------------------------------------------------
"""
Instructions:
- Update this file with the correct IP address of OpenLP (found in the "Remote" section of the preferences).
- Install this file in /Users/USERNAME/Documents/TouchPortalScripts/next_service_item.py (make sure the file ends in .py and that nothing has been added.)
- Install a "Run Apple Script Action:
- Use this Script: do shell script "/usr/bin/python3 '/Users/USERNAME/Documents/TouchPortalScripts/next_service_item.py'"
"""
import requests
import json
import urllib.parse
OPENLP_IP = "192.168.86.25" # replace with your OpenLP machine IP
PORT = "4316"
r = requests.get(f"http://{OPENLP_IP}:{PORT}/api/v2/service/items")
items = r.json()
print("Retrieved items:", json.dumps(items, indent=2)) # Pretty print for clarity
current_index = next((i for i, item in enumerate(items) if item.get("selected")), None)
print("Current index:", current_index)
if current_index is not None and current_index > 0:
previous_index = current_index - 1
print("previous index:", previous_index)
data = {"request": {"id": previous_index}}
encoded = urllib.parse.quote(json.dumps(data))
url = f"http://{OPENLP_IP}:{PORT}/api/service/set?data={encoded}"
print("Calling URL:", url)
response = requests.get(url)
print("Response:", response.status_code)
else:
print("No previous item found or already at beginning.")
I hope that helps someone out there.