Photoshop Elements 15 works but problem with "open with"

Questions about Wine on Linux
Locked
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

I'm using MX Linux 21.2 and was very happy to find that Photoshop Elements 15 seems to work perfectly under Wine 7.0 Stable. However, the only way I can edit a file is to use Open and tediously navigate through many directory levels to the desired file. If I use the file manager (Thunar) to locate the file and then right-click it, I'm given the option to open the file with Photoshop Elements. When I do this, however, Photoshop Elements start up but shows a blank window where an image should appear. At this point I have to once again use the Open command and navigate to the desired image file. The same behavior occurs if I set Photoshop Elements as the default app to open JPG files and then double-click on a JPG file. (That is, Photoshop Elements starts but just displays a blank window.)

The .desktop file for Photoshop Elements contains the following line to execute the program:

env WINEPREFIX="/home/wayneb/.wine" wine C:\\users\\Public\\Desktop\\Adobe\ Photoshop\ Elements\ 15.lnk

Would anyone know what changes might need to be made to this line in order to get "open with" and double-clicking to work?

Many thanks, Wayne
jkfloris
Level 12
Level 12
Posts: 3201
Joined: Thu Aug 14, 2014 10:10 am

Re: Photoshop Elements 15 works but problem with "open with"

Post by jkfloris »

Find which exe file the shortcut refers to. Probably this is something like:

Code: Select all

C:\\Program\ Files\\Adobe\\Adobe Photoshop\ Elements\ 15\\Photoshop.exe
Check if you can open an image directly with Photoshop:

Code: Select all

wine "C:\\Program\ Files\\Adobe\\Adobe Photoshop\ Elements\ 15\\Photoshop.exe" "an_image.jpg"
If it works then you can use %f in the .desktop file. Change the line to something like:

Code: Select all

env WINEPREFIX="/home/wayneb/.wine" wine C:\\Program\ Files\\Adobe\\Adobe Photoshop\ Elements\ 15\\Photoshop.exe %f
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

Thanks for the hints! I was able to run Photoshop Elements from the terminal and specify the file to be edited as an argument. In this example I'm simplifying things by quoting strings instead of escaping blanks with "\". This command correctly starts up Photoshop Elements and shows the "Marker 10.jpg" file ready for editing:

env WINEPREFIX="/home/wayneb/.wine" wine "/home/wayneb/.wine/drive_c/Program Files/Adobe/Photoshop Elements 15/PhotoshopElementsEditor.exe" "z:\home\wayneb\Google Drive\Meanderthal_Hikes\Blue Wall 03.03.2022\images\Marker 10.jpg"

Unfortunately, when I replace the last quoted string with %f or "%f" I get a blank image when I use the "open with" command or double-click on an image file. Can you suggest what I may be doing wrong with my syntax?

Thanks again, Wayne
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

After more testing it really appears that "open with" and double-clicking are not using the desktop launcher that I've been modifying. Is that likely to be the case and, if so, is it possible to pass a filename in those cases? Thanks, Wayne
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

Please forget my last message. It now DOES seem that "open with" is using the desktop launcher for Photoshop Elements. My problem is then the earlier one of getting the right syntax for passing the "open with" filename to Photoshop.... Wayne
jkfloris
Level 12
Level 12
Posts: 3201
Joined: Thu Aug 14, 2014 10:10 am

Re: Photoshop Elements 15 works but problem with "open with"

Post by jkfloris »

Stupid. Totally forgot this way Photoshop gets a Linux path instead of a Windows path.
To convert the Linux path to a Windows path use winepath

Code: Select all

Path=/home/wayneb/.wine/drive_c/Program Files/Adobe/Photoshop Elements 15
Exec=sh -c "wine PhotoshopElementsEditor.exe \\$(winepath -w %f)"
Maybe instead of %f, %u should be used. See viewtopic.php?p=131901#p131901 for an example.
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

Thanks for the suggestion, but I'm still not able to get "open with" to work. Here is my current .desktop file with your suggested settings:

[Desktop Entry]
Name=Adobe Photoshop Elements 15
Exec=sh -c "wine PhotoshopElementsEditor.exe \\$(winepath -w %u)"
Type=Application
StartupNotify=true
Icon=9403_Adobe Photoshop Elements 15.0.0
StartupWMClass=adobe photoshop elements 15.0.exe
Comment=
Path=/home/wayneb/.wine/drive_c/Program Files/Adobe/Photoshop Elements 15
Terminal=false

Double-clicking on the resulting desktop icon starts up Photoshop Elements as does "open with". However, in both cases the window is blank with no image displayed. BTW I also tried %f instead of %u but that made no difference. Is there, perhaps, some way to see exactly what file path is being sent to Photoshop Elements?

Thanks again for all your help, Wayne
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

I just noticed that the 'winepath -w <Linux path>' command generates a large number of error messages when I run in from the terminal. I wonder if there is something wrong with that command under wine 7.0 stable (running under MX Linux 21.2)?
jkfloris
Level 12
Level 12
Posts: 3201
Joined: Thu Aug 14, 2014 10:10 am

Re: Photoshop Elements 15 works but problem with "open with"

Post by jkfloris »

That must be the problem. I expect the following desktop file to work.

Code: Select all

[Desktop Entry]
Name=Adobe Photoshop Elements 15
Path=/home/wayneb/.wine/drive_c/Program Files/Adobe/Photoshop Elements 15
Exec=sh -c "wine PhotoshopElementsEditor.exe \\$(WINEDEBUG=-all winepath -w %u)"
Icon=9403_Adobe Photoshop Elements 15.0.0
MimeType=image/*
Type=Application
StartupNotify=true
StartupWMClass=adobe photoshop elements 15.0.exe
Comment=Run Adobe Photoshop Elements 15 with Wine
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

Unfortunately, it just does not possible to pass the name of an image file to Photoshop Elements 15 under WINE. This is a bit surprising since Microsoft Word 2007 under WINE supported "open with" immediately without any changes to the WINE-created desktop icon. In any case, here is my .desktop file:

[Desktop Entry]
Name=Adobe Photoshop Elements 15
Path=/home/wayneb/.wine/drive_c/Program Files/Adobe/Photoshop Elements 15
Exec=sh -c "wine PhotoshopElementsEditor.exe \\$(WINEDEBUG=-all winepath -w %u)"
Icon=9403_Adobe Photoshop Elements 15.0.0
MimeType=image/*
Type=Application
StartupNotify=true
StartupWMClass=adobe photoshop elements 15.0.exe
Comment=Run Photoshop Elements 15 with Wine

Fortunately, I can still use Photoshop Elements by using the "Open" command and navigating to the file that is to be edited...

Wayne
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

NEW INFO: It really doesn't seem that the 'open with' option is running the .desktop file! No matter what I put in that file, "open with" just runs Photoshop Elements without, it seems, any arguments. Would you know what command is being used (and where it is located) when "open with" is specified??
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

FINALLY GOT MY PROBLEM SOLVED!

I ended up using a custom program (described below) which I've set as the default for opening JPG and similar image files. With this setup I can also just double-click an image file and have it come up in the Photoshop Elements 15 editor.

[I'm sorry, but it is not at all obvious how to insert code blocks in this forum. I hope you will excuse the small codes sections that I've inserted inline.]

==> The custom program for doing this is very simple and just starts a small Python program that actually runs Photoshop Elements:

#!/bin/bash

# Wayne B'Rells 10/15/2022

# This script should be specified as the "open with" program for JPG
# and similar image files. The pathname for the image file is passed
# to this script as $1. That pathname is then passed to the Python
# program RunPhotoshopEditor.py.

/usr/bin/python3.9 /home/wayneb/Downloads/RunPhotoshopEditor.py $1

==> Here is the Python program that does most of the work:

# Wayne B'Rells 10/15/2022

# This routine receives the full pathname of a file that is to be
# edited with Photoshop Elements 15.The pathname is passed as a
# series of list elements with an implied space between each
# element.

# This routine puts the pathname "back together', prepends a z:,
# puts single quotes around the result, and changes all forward
# slashes to backward slashes.

# The "fixed up" full pathname is then appended to the command
# that runs the Photoshop Elements Editor 15 under WINE.

import pyautogui,sys,os
numParts = len(sys.argv)
fullPath = ''
for i in range(1,numParts) :
fullPath += ' '+sys.argv
fullPath = "z:"+fullPath.strip()
fullPath = "'"+fullPath+"'"
fullPath = fullPath.replace('/','\\')

# Check resulting command if necessary.
# pyautogui.alert("wine /home/wayneb/.wine/drive_c/Program\ Files/Adobe/Photoshop\ Elements\ 15/PhotoshopElementsEditor.exe " + fullPath)

# Start Photoshop Editor with the specified file.
os.system("wine /home/wayneb/.wine/drive_c/Program\ Files/Adobe/Photoshop\ Elements\ 15/PhotoshopElementsEditor.exe " + fullPath)

I'm not sure why it was so difficult to implement "open with" for Photoshop Elements, but as least a solution DOES seem possible!

Wayne
wbrells
Level 2
Level 2
Posts: 10
Joined: Wed Oct 12, 2022 2:56 pm

Re: Photoshop Elements 15 works but problem with "open with"

Post by wbrells »

Sorry - I notice that the line in the 'for' loop is shown incorrectly. If should be indented and sys.argv should should have [ i ] appended.
Locked