你如何检查一个人是否有头像?你怎么解开它?你如何从文件加载头像?来自网络,Facebook,gravatar?AppleScript可以读取哪些图像类型?是否可以使用AppleScript将现有头像复制到剪贴板?
编辑
好的,我知道如何检查一个人是否有头像
on run
using terms from application "Address Book"
my hasImage(person (random number from 1 to length of (get people of application "Address Book") of application "Address Book") of application "Address Book")
end using terms from
end run
on hasImage(myPerson)
using terms from application "Address Book"
try
set garbage to image of myPerson
garbage
true
on error number -2753
false
end try
end using terms from
end hasImage
Run Code Online (Sandbox Code Playgroud) on runme(message)
if (item 1 of message = 145) then
set x to item 2 of message
else if (item 1 of message = 144) then
set y to item 2 of message
end if
if (item 1 of message = 145) then
return message
else
set y to x * 8
return {item 1 of message, y, item 3 of message}
end if
end runme
Run Code Online (Sandbox Code Playgroud)
我是Applescript的新手.我正在接收MIDI音符消息(消息).它们采用三个数字的形式(IE:145,0,127)
我需要做的是听一个以145开头的midi音符编号,然后查看它的'第2项.然后我需要将它乘以8并将其保存为以144开头的midi音符编号的项目2.
对于145的每个音符,将会有144个以144开头的音符.所以我需要保留该变量,直到出现145个音符.
问题是,我认为每次midi音符通过时,这个脚本都会运行新的?我需要以某种方式记住每个音符实例的y变量,直到带有145的新音符出现并更改它...
像泥一样清澈?
我正在尝试使用以下代码在AppleScript文件上放置彩色标签:
set theFile to "HDD:Path:to:the:file.ext"
tell application "Finder"
set label of file theFile to 3
end tell
Run Code Online (Sandbox Code Playgroud)
但是当我在终端中运行它时,osascript theScript.scpt我收到以下错误:
theScript.scpt:144:178:执行错误:Finder出错:无法将启动盘文件夹"Path"的文件夹"the"的文件夹"file.ext"的标签设置为3. (-10006)
任何想法,为什么我有一个问题,我怎么能让它工作?
我读到没有像NSWorkspace for iOS那样的东西
不幸的是,我想在我的应用程序中使用一个可以运行其他应用程序的按钮(在后台).没有NSWorkspace可以吗?
我有一个用于创建作业文件夹的Applescript.Applescript会询问项目名称以及文件夹的存储位置.输入作业名称和文件夹位置后,脚本将创建主文件夹和四个子文件夹.
现在,我希望脚本在当前子文件夹中创建编号的子文件夹,并提示用户询问用户要创建多少个文件夹.那可能吗?
tell application "Finder"
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
set loc to choose folder "Choose Parent Folder Location"
set newfoldername to JobName
set newfo to make new folder at loc with properties {name:newfoldername}
make new folder at newfo with properties {name:"Job Materials"}
make new folder at newfo with properties {name:"Previews"}
make new folder at newfo with properties {name:"PSDs"}
make new folder at newfo with properties {name:"VX"}
end tell
Run Code Online (Sandbox Code Playgroud) 我已经创建了目录结构并将a文件放在A目录中:
~/A
~/B
Run Code Online (Sandbox Code Playgroud)
在AppleScript的,我试图移动文件a从A到B.这是我的代码:
on run
tell application "Finder"
move POSIX file "~/A/a" to POSIX file "~/B"
end tell
end run
Run Code Online (Sandbox Code Playgroud)
但是当我运行脚本时,我得到错误:
error "Finder got an error: Handler can’t handle objects of this class." number -10000
Run Code Online (Sandbox Code Playgroud)
这是我的问题的简化版本.有人能帮帮我吗?
我很困惑 - 我一直在谷歌搜索一个小时,并尝试了十种不同的形式,set posixDirectory to POSIX path of (parent of (path to aFile) as string)但我似乎无法做到正确.
我正在通过这样做获得完整的POSIX路径(包括文件名)
set posixFilePath to POSIX path of aFile
现在,我如何获得目录的POSIX路径?我得到各种错误取决于我做什么...不能制作别名..不能得到别名的父...
我认为这应该有用,但不是......
set posixDirectory to POSIX path of ((parent of aFile))
我有一些苹果脚本代码:
tell application "System Events"
key code 97
end tell
Run Code Online (Sandbox Code Playgroud)
如何osascript -e在终端中将代码编写为命令?每次我尝试使用\n或等等,我都会收到错误.对不起,如果我不够具体.
我正在尝试在Objective-C中执行简单的AppleScript.代码是:
NSString *emailString = @"tell application \"Mail\" to activate";
NSAppleScript *emailScript = [[NSAppleScript alloc] initWithSource: emailString];
NSDictionary *errorDict = NULL;
[emailScript executeAndReturnError: &errorDict];
Run Code Online (Sandbox Code Playgroud)
并得到了这个恼人的错误:
NSAppleScriptErrorMessage:Mail出错:应用程序未运行.NSAppleScriptErrorRange:NSRange:{27,8} NSAppleScriptErrorBriefMessage:应用程序未运行.NSAppleScriptErrorNumber:-600 NSAppleScriptErrorAppName:Mail
如果我从脚本编辑器执行脚本,这没问题.我需要一些帮助 - 谢谢!
我想找到一种方法如何通过键盘快捷键禁用/启用热角.我找到了这个苹果脚本
property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example
tell application "System Preferences"
set current pane to pane id "com.apple.preference.expose"
tell application "System Events"
tell window "Mission Control" of process "System Preferences"
click button "Hot Corners…"
tell sheet 1
tell group 1
set theCurrentValues to value of pop up buttons
if theCurrentValues is {"-", "-", "-", "-"} then
repeat with i from 1 to 4
set thisValue to item i of theSavedValues
tell pop up button i …Run Code Online (Sandbox Code Playgroud) applescript ×10
finder ×2
macos ×2
terminal ×2
addressbook ×1
automator ×1
bash ×1
directory ×1
ios ×1
ipad ×1
label ×1
nsworkspace ×1
objective-c ×1
osascript ×1