相关疑难解决方法(0)

将操作分配给Automator中的变量以在Shell脚本中使用

在此输入图像描述

好的,这件事现在让我发疯了.所以Action 1选择一个文件夹(我想将该文件夹的路径保存为var_1)和Action 3选择一个文件(我想将该文件的路径保存为var_2)

所以最后...

var_1 = '/Users/Prometheus/Desktop/'
var_2 = '/Users/Prometheus/Documents/a.txt'
Run Code Online (Sandbox Code Playgroud)

那么我如何在shell脚本中使用这些变量及其值与python?我不能使用sys.argv,因为它们被设置为一些奇怪的变量

我通常会把'Ask for Finder Item'> Run Shell Script然后

import sys

variable = open(argv[1]).read()
Run Code Online (Sandbox Code Playgroud)

但在这种情况下我无法使用它.我的脚本是在python中所以我宁愿留在python中,因为我不懂任何其他语言

python variables macos shell automator

3
推荐指数
1
解决办法
5543
查看次数

标签 统计

automator ×1

macos ×1

python ×1

shell ×1

variables ×1