Hello,
I have external python Qt application which is opening photoshop and then running script.
Is there anyway for me to open Photoshop and then run function from uxp plugin?
Python script:
def open_photoshop_and_run_script():
script_path = os.path.join(tools_path, "/Photoshop/2024/Script/Presets/Scripts/Custom_script.jsx")
print(script_path)
try:
photoshop_path = ""
if os.name == 'posix': # macOS
photoshop_path = "/Applications/Adobe Photoshop 2024/Adobe Photoshop 2024.app"
elif os.name == 'nt': # Windows
photoshop_path = r'C:\Program Files\Adobe\Adobe Photoshop 2024\Photoshop.exe'
# Close Photoshop if it's already running
close_photoshop()
# Wait for a moment to ensure Photoshop is fully closed
time.sleep(2)
# Open Photoshop and run the specified script
if os.name == 'posix': # macOS
os.system(f'open -a "{photoshop_path}" --args --jsx "{script_path}"')
elif os.name == 'nt': # Windows
os.system(f'start "" "{photoshop_path}" --jsx "{script_path}"')
except FileNotFoundError:
print("Error: Photoshop application not found.")
except PermissionError:
print("Error: Permission issue while trying to open Photoshop.")
except Exception as e:
print(f"Error: {e}")