如何从文本框Mac应用程序直接在Photoshop上打开文件 [英] How to open files directly on Photoshop from a text box Mac Application

查看:121
本文介绍了如何从文本框Mac应用程序直接在Photoshop上打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,亲爱的编程社区.希望每个人都保持安全.

Hello dear programming community. Hope everyone is staying safe.

我在成百上千个目录中有成千上万个图像文件,发现它们会花费一些时间.

I have thousands of image files in hundreds of directories and finding them can take time.

我希望能够一次在文本框中输入5或6个文件名,应用程序将查找图像并在photoshop上将其打开.

I want to be able to input 5 or 6 file names at a time into a text box and the application would find the images and open them up on photoshop.

谁能指出我正确的方向.

Can anyone point me in the right direction.

谢谢

推荐答案

您可以使用Automator和一些bash脚本来做到这一点.启动Automator,然后创建一个新的应用程序.然后单击Utilities(带注释的黄色),然后将Run Shell Script(带注释的洋红色)拖到右侧(带青色的注释)并放下.

You can do this with Automator and a little bash script. Start Automator, and create a new application. Then click Utilities (annotated yellow) and then drag Run Shell Script (annotated magenta) to the right side (annotated cyan) and drop.

现在将以下代码粘贴到右侧:

Now paste the following code into the right side:

# You can edit these parameters to suit your local situaton
LOCATION="/Users/mark/Photos"
PHOTOSHOP="Adobe Photoshop CC 2019"

# Pop up a dialog asking for filenames
list=$(osascript -e 'Tell application "System Events" to display dialog "Enter filenames to Photoshop - separate with commas:" default answer ""' -e 'text returned of result' 2>/dev/null)

# Make array of filenames from list, splitting on commas
IFS=',' read -ra fnames <<< "$list"

# Generate full paths of each filename, in another array
fullpaths=()
for f in "${fnames[@]}"; do
     # Try to find file, ignoring case, in specified location
    full=$(find "$LOCATION" -iname "$f" -print 2> /dev/null)
    # Add to list to pass to Photoshop if found
    [ ! -z "$full" ] && fullpaths+=("$full")
done

# Start Photoshop with the specified files
open -a "$PHOTOSHOP" "${fullpaths[@]}"

现在将应用程序保存在桌面上,我叫我FindAndShop.然后,您可以双击运行它.这就是您回答问题的全部.以下只是美化!

Now save the application on your Desktop, I called mine FindAndShop. You can then double-click it to run it. That is all you need to answer your question. The following is just prettification!

这里正在起作用:

如果需要,可以更改图标,所以我在Photoshop中制作了一个新的方形图标并复制了图像,然后右键单击我闪亮的新应用程序,然后选择了Get Info.现在单击青色区域,然后在屏幕顶部的菜单栏上,依次单击EditPaste:

If you want to, you can change the icon, so I made a new, square icon in Photoshop and copied the image, then I right-clicked my shiny new app, and chose Get Info. Now click the cyan area, then on the menu bar at the top of the screen, click Edit then Paste:

现在该应用在我的桌面上看起来像这样:

Now the app looks like this on my Desktop:

这篇关于如何从文本框Mac应用程序直接在Photoshop上打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆