如果我打开了几个OS-X Terminal.app窗口,如何将一个终端窗口移动到另一个空间?
我很高兴使用任何脚本或编程语言来实现这一点,但更喜欢AppleScript或调用标准框架.
(注意,这只是移动应用程序的一个窗口而不是所有窗口.)
我正在使用AppleScript,需要这样做:
set TextToWrite to " #!/bin/bash cd "$( dirname "$0" )" java -server -Xmx4G -jar ./craftbukkit.jar" "
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我需要在字符串中生成的文本中包含引号.我该怎么设置
#!/bin/bash cd "$( dirname "$0" )" java -server -Xmx4G -jar ./craftbukkit.jar"
Run Code Online (Sandbox Code Playgroud)
没有引号乱搞的AppleScript字符串?
以下是我想要的步骤:
以下是我第一次尝试编写AppleScript:
tell application "Xcode"
tell project "iphone_manual_client"
debug
end tell
close project "iphone_manual_client"
end tell
Run Code Online (Sandbox Code Playgroud)
这仅在xcode打开此项目时有效.我希望只在必要时才打开项目.
任何AppleScript专家都可以指出我正确的方向吗?谢谢.
-chuan-
有没有办法从命令行弹出OS X计算机上的所有已安装的硬盘驱动器卷?如果我可以将它包装在shell脚本中,那么Applescript就可以了.
我想编写一个脚本,当在某个应用程序上打开文档时,或者在应用程序退出之前,它会采取行动等.
有没有办法将脚本附加到应用程序中的事件?AppleScript是否支持任何形式的挂钩?
如果没有,我可以通过自己的方式获得我想要的东西吗?
我正在使用IDL自动为我的xcode项目生成源文件.有谁知道如何自动将生成的文件添加到项目中?目前,我必须从项目中删除当前文件并添加新文件.这真令人讨厌.
使用文件夹引用适用于头文件,但xcode不希望将文件夹引用中的任何文件识别为源文件.有没有人找到解决这个问题的方法?
我正在尝试使用我的iPhone通过蓝牙接近来解锁我的Mac,我正在使用的代码:
tell application "System Events"
tell security preferences
set require password to wake to false
end tell
end tell
tell application "ScreenSaverEngine" to quit
Run Code Online (Sandbox Code Playgroud)
它杀死了屏幕保护程序,没有显示密码框,但我得到的只是一个黑屏.所有应用程序仍在运行,但我将鼠标悬停在黑屏上.我在10.6.7版本上运行两个显示器.怎么了?谢谢.
lifehacker文章http://lifehacker.com/5816791/use-a-bluetooth-phone-or-device-to-lock-and-unlock-your-mac-when-youre-near
我试图从命令行或Python程序创建一个Finder别名.我在网上搜索[1] [2] [3],发现了这一点苹果:
$ osascript -e 'tell application "Finder" to make new alias at POSIX file "/Users/vy32/cyber.txt" to POSIX file "/Users/vy32/a/deeper/directory/cyber.txt"'
Run Code Online (Sandbox Code Playgroud)
不幸的是,它给了我这个错误:
29:133: execution error: Finder got an error: AppleEvent handler failed. (-10000)
Run Code Online (Sandbox Code Playgroud)
[1] http://hayne.net/MacDev/Bash/make_alias
[2] https://discussions.apple.com/thread/1041148?start=0&tstart=0
[3] http://hintsforums.macworld.com/showthread.php?t=27642
我究竟做错了什么?
我试图使用AppleScript在Finder中打开一个文件夹.以下是我的代码.我希望文件夹WorkSpace在Finder中打开,但它会打开父文件夹/Volumes/MyMacDrive/Mani并突出显示该WorkSpace文件夹.我想要WorkSpace文件夹的内容,但我得到的只是它的父文件夹的内容.我在这里失踪了什么..?
property the_path : "/Volumes/MyMacDrive/Mani/WorkSpace/"
set the_folder to (POSIX file the_path) as alias
tell application "Finder"
activate
if window 1 exists then
set target of window 1 to the_folder
else
reveal the_folder
end if
end tell
Run Code Online (Sandbox Code Playgroud) 有没有办法从python执行(并获得)AppleScript代码的结果而不使用osascript命令行实用程序或appscript(我不想使用它(我认为?)因为它不再开发/支持/推荐)?
理由:在我刚刚发布的另一个问题中,我描述了一个奇怪/不受欢迎的行为,我正在通过运行AppleScript来体验osascript.因为我实际上是从python脚本调用它,我想知道是否有办法osascript完全绕行,因为这似乎是问题所在 - 但是appscript(显而易见的选择?)现在看起来有风险......