Macos 在AppleScript中增加进度条
我有一个应用程序正在使用“SKProgressbar”。我希望在运行第二个shell脚本的过程的基础上,将这个进度条增加10。我不确定这是否可能。我已经提供了下面的脚本。我是新来的Macos 在AppleScript中增加进度条,macos,shell,progress-bar,applescript,Macos,Shell,Progress Bar,Applescript,我有一个应用程序正在使用“SKProgressbar”。我希望在运行第二个shell脚本的过程的基础上,将这个进度条增加10。我不确定这是否可能。我已经提供了下面的脚本。我是新来的 on open adisk set terminalcommand to "cd " & quoted form of (POSIX path of adisk) & " ; find . -name '.DS_Store' -type f -delete" do shell
on open adisk
set terminalcommand to "cd " & quoted form of (POSIX path of adisk) & " ; find . -name '.DS_Store' -type f -delete"
do shell script terminalcommand
set xxx to "cd " & quoted form of (POSIX path of adisk) & " ; find * -type f -exec md5 -r {} \\; > *New_File.md5"
set iconPath to ((path to me) as text) & "Contents:Resources:droplet.icns"
tell application "SKProgressBar"
activate
set floating to false --> default is true
set position to {500, 550} --> default is {1000, 750}, origin point is bottom left
set width to 400.0 --> default is 500.0
set title to "CreateMD5"
set header to "Processing..."
set header alignment to center
set footer to "" --> default is empty string
set footer alignment to center --> default is left
-- image path can be HFS or POSIX path, default is missing value (no image)
set image path to iconPath
tell progress bar
set minimum value to 0.0 --> default is 0.0
set maximum value to 100.0 --> default is 100.0
set current value to 0.0 --> default is 0.0
end tell
set show window to true --> default is false
tell progress bar
set indeterminate to false --> default is true
start animation
increment by 10.0
do shell script xxx
stop animation
end tell
quit
end tell
activate
display dialog " MD5 Complete!" with icon 1 buttons {"Close", "Open Directory"} cancel button 1 default button 2
tell application "Finder"
open adisk
end tell
end open
这方面的任何帮助都会很好。如果简单的答案是“否”,那么我将继续并尝试解决一些问题。我不熟悉SKProgressbar的工作原理,但是如果它在脚本结束后没有重置所有内容,您不能反转整个过程吗?与其尝试在applescript中运行bash脚本,为什么不制作一个applescript,只将条数增加1,然后让bash脚本在整个代码中调用它呢 例如 然后
#!/bin/bash
#/Some/Location/my_bash_script.sh
for x in {1..10}; do
#do stuff here
osascript /Users/user_name/Desktop/update_progbar.scpt
done
我认为没有任何方法可以知道shell脚本的进度,所以我怀疑你能做到这一点。通常,您只需在shell脚本之前启动一个不确定的进度条,然后停止。谢谢。经过更多的研究和你的回答,我发现这是唯一可行的选择。这比我现在拥有的要好:)
#!/bin/bash
#/Some/Location/my_bash_script.sh
for x in {1..10}; do
#do stuff here
osascript /Users/user_name/Desktop/update_progbar.scpt
done