Applescript的"choose from list“用户交互有一个"cancel”按钮--我希望这个"cancel“按钮告诉脚本立即停止执行。换句话说:
set wmColor to choose from list {"Black", "Black for all", "White",
"White for all"} with prompt "What color should the watermark be?"
default items "
我想知道是否可以在Applescript中更改Dialog窗口的外观,例如通过自定义图片或图标更改图标(注意,停止,警告)。
如果有可能改变排版(对齐,字体,粗体.等)
如果是,你能帮我一个例子,我的代码或提供一个链接到一个良好的教程请!
set folderName to text returned of (display dialog "Please enter new folder name:" default answer "Folder_Name")
set loc to choose folder "Choose Parent Folder
我遇到了在AppleScript和bash之间传递多个变量的问题。
我可以用这样的方法得到一个变量
updatedName="$(osascript -e 'set the answer to text returned of (display dialog "What is your name" with title "Question" default answer buttons {"Cancel", "Save"} default button "Save")' return ans
我有一个另存为应用程序的AppleScript。第一次运行时,它会询问用户是否要将其移动到Applications文件夹。我希望能够做的是,在它被移动后,让脚本退出本身,然后重新打开。
显然我不能说
tell me to quit
tell me to activate
在执行quit命令后,...because将停止运行。
有什么建议吗?
我正在尝试创建一个脚本,通过AppleScript / script使用终端询问用户他们想要分割什么AppleScript。到目前为止我的情况是这样的。
我试图让输入显示在这一行:
do script "spleeter separate -i (text returned of input).mp3 -p spleeter:2stems -o output"
在终端中,它只是说没有找到匹配的(输入返回的文本)。
这是我的密码:
set input to display dialog "What would you like to convert?" defa
我正在尝试创建一个自动化服务,允许我说选定的文本。
我希望能够使用键盘快捷方式,然而,我也想使用键盘快捷方式结束服务之前,它完成。
我不知道如何使服务停止一旦开始运行。
这是我在Automator中的applescript代码
on run {input, parameters}
say input using "Alex" speaking rate 400
return input
end run
我知道你可以在系统里说课文。但它在每分钟300英里的时候就达到最大值了。我需要这个做300多个。因此,自动化服务。
谢谢你的帮助。
因此,我想在我的AppleScript中的shell中使用一个AppleScript命令。我想在我的整个磁盘中搜索特定的文件类型,所以我做了如下操作:
set theItems to do shell script "find / -name '*.mp3'" with administrator privileges
set theItems to paragraphs of theItems
repeat with theFile in theItems
--some code that process every file here
end rep
我正在制作一个applescript,它自动向桌面添加仪表板小部件。要做到这一点,我需要设置仪表板设置为“作为覆盖”,而不是“作为空间”或“关闭”。这是在系统首选项>任务控制中。此外,在按下“返回/输入”键之前,如何停止脚本?这就是我必须要做的(不更改设置或enter键):
set icon to (path to me as string) & "Contents:Resources:icon.icns" on delay duration set endTime to (current date) + duration repeat while
我正在开发一个AppleScript,它使用文件名作为参数调用Python脚本,类似于:
set descriptionFiles to (every file of current_folder whose name extension is "txt")
repeat with textFile in descriptionFiles
-- run a Python script that clears the xml tags and reformat the text of the file
do shell script "python3
我使用SSH安全Shell客户端连接到服务器并运行我的脚本。
我想在某些情况下停止脚本,所以当我使用exit时,不仅脚本会停止,而且所有客户端都会断开与服务器的连接!以下是代码:
if [[ `echo $#` -eq 0 ]]; then
echo "Missing argument- must to get a friend list";
exit
fi
for user in $*; do
if [[ !(-f `echo ${user}.user`) ]]; then
echo "
我正在从一个终端启动一个新的终端窗口:
osascript -e 'tell app "Terminal" to do script "myProgram.sh"'
由于新进程没有结束(它基本上是一个服务器),所以我希望能够在某个时候使用AppleScript停止它。
如果我这样做了:
osascript -e 'tell app "Terminal" to close window id {windowId}'
我收到警报框"Do you want to terminate running process
是否有一种方法来响应在AppleScript中询问信息的shell脚本?
我有一个脚本,它运行一个命令,在终端中运行时会问两个问题。
我已经知道答案了,我不得不这样做一千次。我是否可以输入这些响应,所以当shell脚本提示我输入这些响应时,它会继续这个过程吗?
示例:
on run {email}
set result to do shell script "myprocess \"" & email & "\""
keystroke "file.png" + "enter"
我想做的是
echo "foo
foo
foo
....[many many lines of foo here]
foo" > "/Users/myname/destination.txt"
通过Applescript,但是当foo行中的字符达到一定数量时,它会返回一个错误(看起来是255392个字符。)
所谓“通过Applescript”,我的意思是用AppleScript的"do shell脚本“尝试这一点,当退出状态为非零时停止进程,并返回以下内容:"error "The command exited with a non-
我写了一个AppleScript,告诉终端做一个脚本。
on run
tell application "Terminal"
set currentTab to do script ("...")
end tell
end run
但是,我希望仅在从终端窗口获得特定输出时才触发它运行。
做这件事最好的方法是什么?
我试过了:
tell application "Terminal"
if contents of front window contains "..." then
我试图在AppleScript中找出try语句。我要编译它,但它做不到我想要它做的事情。
try
do shell script "cat " & passData
on error
display dialog "Create a password to protect this file. After creating the password, you will need to enter it every time in order to access the app." default answer "" buttons {&
我的AppleScript中有代码,一旦do shell script运行,它就会显示进度窗口。如何让进度窗口上的按钮终止shell脚本?
下面是我的代码示例:
tell application "ASObjC Runner"
reset progress
set properties of progress window to {button title:"Abort", button visible:true, indeterminate:true}
activate
show progress
end tell
set s
我尝试过以下几种方法,但似乎无法做到这一点:
do script "cd ~/desktop/test; for x in ls -1 | sed -e 's/^\(.\).*/\1/' | sort -u; do mv -i ${x}?* $x done"
我想在applescript中执行这个命令。我在applescript中运行它,并得到一个关于"“标记的错误,但不知道如何纠正它。我完全是applescript的新手。愿意学习只是有点失落。
谢谢
这是我想点击的网页。
( )
在那里,我想使用AppleScript点击“资产负债表”或“现金流”。
下面是我正在尝试的AppleScript:
tell application "Safari"
activate
do JavaScript "document.getElementsByClassName('t')[3].click();" in front document
end tell
当我尝试AppleScript时,网页上似乎没有错误,但是标记()没有"href",它可能不像我预期的那样工作。我猜页
我想知道applescript应用程序是否可以运行shell脚本,然后在shell脚本执行完成之前退出。当服务器运行给定的时间量时,这将非常有用。不需要applescript在后台持续运行,有没有办法独立运行函数?
set server_name to text returned of (display dialog "Choose server." default answer "")
set success to do shell script "if [ -f \"/Users/jessefrohlich/Documents/Minecra
我正在制作一个applet,提示用户从列表中进行选择,我的列表当前有169个项目。当生成列表时,窗口从显示的顶部延伸到底部,这对用户来说有点不堪重负。
我想知道是否有人知道一种方法来编辑由“从列表中选择”生成的窗口的边界属性。
下面是我使用的代码(不包括编译列表并将其存储在“pkgList”中的单独代码):
set userChoice to (choose from list pkgList with title "Title" with prompt "Choose file:" OK button name "OK" cancel butt
我有一个shell脚本的小片段,它可能会抛出许多错误。我当前将脚本设置为在出现所有错误时全局停止。然而,我想对这一小节稍有不同。
下面是代码片段:
recover database using backup controlfile until cancel || true;
auto
我希望这最终会抛出一个“找不到文件”错误。但是,我想继续执行此错误。对于任何其他错误,我希望脚本停止。
实现这一目标的最佳方法是什么?
Bash版本3.00.16
我尝试了以下代码(伪代码),但是当我试图停止我的线程时,我总是得到一个死锁。问题是Join()等待线程完成,而挂起的Invoke()操作也在等待完成。我该如何解决这个问题呢?
Thread workerThread = new Thread(BackupThreadRunner);
volatile bool cancel;
// this is the thread worker routine
void BackupThreadRunner()
{
while (!cancel)
{
DoStuff();
ReportProgress();
我正在尝试构建一个AppleScript来启动我的shell脚本。
路径结构如下
/Users/ryan/myscript/
applescript.scpt
bash.sh
我的AppleScript如下:
tell application "Terminal"
set folder_path to path to me
set run_cmd to "/bin/bash " & folder_path & "/bash.sh"
do script ru
几天前我做了这个下载脚本:
do shell script "curl -L -o ~/Desktop/file.dmg 'https://download.mozilla.org/?product=firefox-27.0.1-SSL&os=osx&lang=en-GB' > ~/Desktop/status 2>&1 &"
set fileSize to 0
set curTransferred to 0
set curProgress to 0
repeat until curProgress = "10