添加一个进度条的对话框A"做好shell脚本"在AppleScript的 [英] Adding a progress bar to a dialog for a "do shell script" in AppleScript

查看:914
本文介绍了添加一个进度条的对话框A"做好shell脚本"在AppleScript的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序我正在写在AppleScript的是移动圣伯纳德重定向LaunchDaemon到当前用户的目录中,以便用户可以访问在家里任何网站,但让他们把它放回去就回去之前学校。这样做的原因是,在学校,iPrism块任何网站,学校不希望你去,但圣伯纳LaunchDaemon块时,学生们在家里一样的网站,我认为这是没有必要做。

I have an app I'm working on written in AppleScript that moves the St. Bernard redirect LaunchDaemon to the current user's directory so that the user can access any website at home, but lets them put it back before they go back to school. The reason for this is that at school, iPrism blocks whatever website the school doesn't want you going to, but the St. Bernard LaunchDaemon blocks the same websites when the students are at home, and I think that it's unnecessary to do that.

不管怎样,我想一个进度条添加到对话框,显示shell脚本,删除应用程序的输入。任何人都知道该怎么做?

Anyway, I want to add a progress bar to a dialog that shows the input of the shell script that removes the app. Anyone know how to do that?

(我也想不会对显示对话框中的任何按钮删除...按钮,,而只是有进度条。这是可能的?)

(I also wanted to not have any buttons on the display dialog "Removing..." buttons "", but instead just have the progress bar. Is this possible?)

下面是code:

display alert "You may have to restart your computer after using this tool!" buttons {"Ok"} default button 1

set question to display dialog "RMR (Remove My Redirect)

Are you unable to go to a website at home because of that annoying St. Bernard Redirect?

If the answer is Yes, then RMR is your solution! Simply Choose Remove to remove it, and Replace to put it back." buttons {"Remove", "Replace", "Erase Evidence"} default button 3
set answer to button returned of question

if answer is equal to "Remove" then do shell script "mv /Library/LaunchDaemons/com.stbernard.rfcd.plist ~/"

if answer is equal to "Replace" then do shell script "mv ~/com.stbernard.rfcd.plist /Library/LaunchDaemons/"

if answer is equal to "Erase Evidence" then set question to display dialog "Are you sure? RMR will be deleted forever." buttons {"Yes", "No"} default button 2
set answer to button returned of question

if answer is equal to "No" then do shell script "echo"

-- Progress bar goes on the below dialog

if answer is equal to "Yes" then ¬
    tell application "Terminal"
        display dialog "Removing..." buttons ""
        do shell script "srm -rf ~/Downloads/RMR.app; history -c; killall Terminal"
        delay 20
        quit
    end tell

在此先感谢的人谁可以帮助!

Thanks in advance for anyone who can help!

推荐答案

在AppleScript的<一个href=\"https://developer.apple.com/library/$p$prelease/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_10/RN-10_10.html#//apple_ref/doc/uid/TP40000982-CH110-SW1\"相对=nofollow> MacOS X的10.10 或更高版本内置了术语,一个进度条。对于小程序,它运行在一个对话框中进度指示器。在脚本编辑器,它显示在状态栏中。改编此术语:

Applescript in MacOS X 10.10 or later has built-in terminology for a progress bar. For applets, it runs a progress indicator in a dialog box. In script editor, it shows in the status bar. Adapt this terminology:

set n to 10

set progress total steps to n
set progress description to "Script Progress"
set progress additional description to "This should be helpful"

repeat with i from 1 to n
    delay 1
    set progress completed steps to i
end repeat

这篇关于添加一个进度条的对话框A&QUOT;做好shell脚本&QUOT;在AppleScript的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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