我最近开始玩Pashua,但似乎给我带来了一些麻烦。目前我正在将它用于shell脚本(Bash),并编辑了示例文件以接近我的愿望结果,但还没有到达那里。
我注意到一些事情。 Pashua有一个名为“Pashua.sh”的文件,我假设它试图找到应用程序以及bundle资源。现在我想知道,这是一个强制性文件,意思是:
我不能只在我自己的shell脚本中调用Pashua应用程序吗?即使我知道它永远不会改变的确切目的地。
我真的需要这个Pashua.sh文件吗?
我的最后一个问题是将图像重新定位到左上角。它只是不起作用,因为输入框位于顶部。我也放置了图像的绝对位置,但它不起作用。
#!/bin/bash -x
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Include pashua.sh to be able to use the 2 functions defined in that file
source "$MYDIR/pashua.sh"
# Define what the dialog should be like
# Take a look at Pashua's Readme file for more info on the syntax
conf="
# Set window title
*.title = App Store
# Add a text field
tf.type = password
tf.x = 100
tf.y = 200
tf.label = Example textfield
tf.width = 310
# Add a cancel button with default label
cb.type = cancelbutton
cb.tooltip = This is an element of type “cancelbutton”
db.type = defaultbutton
db.tooltip = This is an element of type “defaultbutton” (which is automatically added to each window, if not included in the configuration)
"
if [ -d '/Volumes/Pashua/Pashua.app' ]
then
# Looks like the Pashua disk image is mounted. Run from there.
customLocation='/Volumes/Pashua'
else
# Search for Pashua in the standard locations
customLocation=''
fi
# Get the icon from the application bundle
locate_pashua "$customLocation"
bundlecontents=$(dirname $(dirname "$pashuapath"))
if [ -e "$bundlecontents/Resources/AppIcon@2.png" ]
then
conf="$conf
img.type = image
img.x = 25
img.y = 25
img.maxwidth = 64
img.path = $bundlecontents/Resources/AppIcon.icns"
fi
pashua_run "$conf" "$customLocation"
echo "Pashua created the following variables:"
echo " tb = $tb"
echo " tf = $tf"
echo " ob = $ob"
echo " pop = $pop"
echo " rb = $rb"
echo " cb = $cb"
echo " chk = $chk"
echo ""
img.*
线条接近开头$conf
。