我在我的mac上使用emacs在Xcode中编程.它在大多数情况下都非常有效.我双击xcode中的文件,然后在现有的emacs窗口中将其拉出来.我编译,并获得语法错误,双击,它们出现在活动的emacs窗口中.大.
这是与emacs交谈的所有XCode.有没有人知道如何让emacs与XCode交谈?例如,我希望能够在emacs中设置断点并让gdb的XCode版本确认它.
我想编写鼠标按钮来显示/隐藏Finder.我编写了以下AppleScript并将其绑定到我的鼠标按钮:
tell application "System Events"
--When this script is run,
-- the frontmost application will be this script itself
--Get the name of this script as it is running and hide it,
-- so that the previous frontmost application is in front again
set theName to name of the first process whose frontmost is true
set visible of process theName to false
set theName to name of the first process whose frontmost is true
end tell
if theName is "Finder" …Run Code Online (Sandbox Code Playgroud) 每当我尝试使用AppleScript退出应用程序时,都会出现以下错误
发生了类型为-9874的错误.
我正在使用的AppleScript命令是
tell application "app_name"
quit
end tell
Run Code Online (Sandbox Code Playgroud)
有人可以帮帮我吗?
我一直试图这样做很长一段时间,并没有找到一种有效的方法来做到这一点.目前我一直在尝试列出我所知道的所有字体:
set the font_list to {"Arial","Comic Sans MS","Arial Black",...}
Run Code Online (Sandbox Code Playgroud)
但是编写所有字体需要花费很长时间,我知道Mac上有很多字体.是否有更有效的方法来获取系统上的所有字体,在文本文档中写入一堆东西,然后将每个连续行的字体设置为下一个字体(即第1行的字体是字体1,第2行的字体是字体2等)?
我知道如何将纯文本复制到剪贴板:
oascript -e 'set the clipboard to "plain text"'
Run Code Online (Sandbox Code Playgroud)
但问题是如何将html内容复制到剪贴板?例如,如何将以下html内容复制到剪贴板:
<b>bold text</b>
Run Code Online (Sandbox Code Playgroud)
当我将它粘贴到TextEdit中时,我得到粗体文本?
我在这里先向您的帮助表示感谢!
我找到了一个中间解决方案:
echo "<b>bold text</b>" | textutil -stdin -stdout -format html -convert rtf | pbcopy
Run Code Online (Sandbox Code Playgroud)
到目前为止这很好,但不幸的是我发现它不适用于图像标记:
echo "<img src=\"https://www.google.com/images/srpr/logo3w.png\">" | textutil -stdin -stdout -format html -convert rtf | pbcopy
Run Code Online (Sandbox Code Playgroud)
这不能完成我想要的工作,所以有人知道原因吗?
谢谢!
我找到了一个有效的解决方案并将其发布在下面:)
我正在尝试使这个脚本工作.它是一个Bash脚本,用于获取一些变量,将它们放在一起并使用结果发送AppleScript命令.手动粘贴从to_osa后面的变量回显osascript -e到终端的字符串按我的意愿工作并期望它.但是当我尝试将命令osascript -e和字符串组合在一起时to_osa,它不起作用.我怎样才能做到这一点?
the_url="\"http://stackoverflow.com/questions/1521462/looping-through-the-content-of-a-file-in-bash\""
the_script='tell application "Safari" to set the URL of the front document to '
delimiter="'"
to_osa=${delimiter}${the_script}${the_url}${delimiter}
echo ${to_osa}
osascript -e ${to_osa}
Run Code Online (Sandbox Code Playgroud)
除了手动工作之外,当我将所需命令写入脚本然后执行它时,脚本也可以工作:
echo "osascript -e" $to_osa > ~/Desktop/outputfile.sh
sh ~/Desktop/outputfile.sh
Run Code Online (Sandbox Code Playgroud) 在OS X的早期版本中,要允许AppleScript运行,您需要在"系统偏好设置"的"辅助功能"面板中选中"启用辅助设备访问".
对于Mavericks,现在这是一个按照安全和隐私 - >辅助功能启用的每个应用程序设置.如果从Jenkins任务中使用osascript从命令行运行脚本,如何启用辅助访问?据我所知,当时没有GUI任务授权; 我没有要求权限的消息对话框.我在Jenkins输出中得到的错误消息是:
take_screenshot_iossim.sh:246:303: execution error: System Events got an error: osascript is not allowed assistive access. (-1719)
Run Code Online (Sandbox Code Playgroud)
我还尝试将所有应用程序添加到权限对话框,仍然收到权限被拒绝错误.
我有一个AppleScript运行扫描到特定文件夹的扫描程序(命令行).我需要将参数传递给applescript,然后又将参数传递给终端.
在我想运行的终端中open -a /Applications/MyScanApp.app myargument,AppleScript运行.我怎么能通过这个论点?谢谢您的帮助!我通常是一名PHP程序员,这与我完全不同.
我的AppleScript:
tell application "Terminal"
do script "./myscanprogram myargument 2>&1"
end tell
Run Code Online (Sandbox Code Playgroud) 我无法找到如何将所选文本用作AppleScript和Automator的变量.
有任何想法吗?
任何人都可以提供一种方法来填充我的播放列表与csv文件/文本文件中的歌曲格式如下:歌曲标题,艺术家?我可以单独为标题做,但不能指定它必须有一定的艺术家.
编辑:以下是我如何通过标题获取它们的示例:
set TheFile to read file "Macintosh HD:Applications:Automator stuff:01b iTunes Scripts:SongList.txt"
tell application "iTunes"
set thePlaylist to playlist "SongList"
try
delete every track of thePlaylist
end try
set MySongs to paragraphs of (TheFile) -- read artist names (separated by newlines) from the file
repeat with AnItem in MySongs -- get all tracks from each artist
set AnItem to (contents of AnItem)
if AnItem is not "" then try -- don't bother with empty names
set MyTracks to (location of …Run Code Online (Sandbox Code Playgroud)