草庐IT

applescript-objc

全部标签

AppleScript 中的 Ruby 风格字符串插值

有没有办法在AppleScript中实现Ruby风格的字符串插值?我需要一种灵活的方式来创建字符串模式。ruby:fn="john"=>"john"ln="doe"=>"doe"addresses=[]=>[]addresses["jdoe@company.com"]addresses["jdoe@company.com","john.doe@company.com"]苹果脚本:setfnto"john"setlnto"doe"settheAddressesto{}#jdoe@company.comcopy[somethinghere]&"@company.com"totheendof

javascript - 使用 JavaScript 而非 AppleScript 实现自动化的邮件规则

我正在尝试使用Javascript而非AppleScript来构建Mail.app规则(在OSXYosemite上),但我仍然停留在基础知识上。我在AppleScript中看到这段代码:usingtermsfromapplication"Mail"onperformmailactionwithmessagestheMessagesforruletheRule#actualcodehereendperformmailactionwithmessagesendusingtermsfrom但我不清楚这如何转化为JavaScript。我是否定义了一个函数?设置回调?我不清楚。我看到有perfo

javascript - 为什么 Applescript 中的 'do javascript' 调用在输入到浏览器中的相同代码执行时不执行?

我想弄清楚为什么在Safari位置栏中键入相同的javascript代码时我的Applescript什么都不做。转到搜索结果页面,例如:http://www.google.com/search?q=test.对于正确的行为,将其输入地址栏并按回车键:javascript:document.getElementsByClassName('vspib')[0].click();您会看到它为第一个搜索结果选择放大镜。这就是我想通过javascript实现的。所以我输入了以下内容:tellapplication"Safari"activatedoJavaScript"document.getE

xml - Applescript - 解析 XML

我尝试创建Applescript以从.xfdf中提取值XFDFTextNotClearIncorrectdimensionIncorrectTextAppleScriptsettheXMLFileto((choosefile)asstring)tellapplication"SystemEvents"tellXMLelement"xfdf"ofcontentsofXMLfiletheXMLFilesettypeTextto(valueofXMLelement"p")setnameTextto(valueofXMLelement"p")endtellendtell当我运行脚本时出现此错误

iphone - 可以在运行时使用 Objc/iPhone 代码针对 xsd 验证 xml

我有在运行时读入的xml文件,是否可以在运行时使用ObjC对xsd文件验证xml?这可以在java中完成和c#..但我需要在我的iPhone应用程序中运行它。 最佳答案 我认为您无法在iOS上使用ObjC来执行此操作。我认为您需要使用libxml2。Here'sanexampleofasimpleCprogramthatvalidatesXMLagainstXSD.Hereareinstructionsonaddinglibxml2toanXCodeproject. 关于iphone-可

windows - AppleScript 获取窗口的标题

我尝试获取应用程序的标题(并将其复制为var)到目前为止,这是我的代码,但这是失败的tellapplication"app"activateendtelltellapplication"SystemEvents"setfrontApptonameoffirstapplicationprocesswhosefrontmostistrueendtelltellapplicationfrontAppifthe(countofwindows)isnot0thensetwindow_nametonameoffrontwindowendifendtell结果:error"appgotanerror

javascript - AppleScript 可以访问浏览器选项卡并在其中执行 javascript 吗?

我很好奇AppleScript是否可以访问浏览器中的每个特定选项卡并在其中执行一些javascript。有人有想法吗? 最佳答案 对于GoogleChrome,使用AppleScriptChromiumSuite中的execute:execute v:Executeapieceofjavascript.executespecifier:Thetabtoexecutethecommandin.javascripttext:Thejavascriptcodetoexecute.例子:tellapplication"GoogleChrom

php - 如何从 php 执行 applescript

有人知道如何告诉php执行applescript吗? 最佳答案 您可以通过PHP的exec()function运行程序osascript并传递AppleScript代码或文件:exec('osascript-e\'tellapp"iTunes"toplay\'');exec('osascriptpath/to/script'); 关于php-如何从php执行applescript,我们在StackOverflow上找到一个类似的问题: https://stac

在命令行中的单独窗口中运行AppleScript Progress Bar?

要显示从命令行中显示对话框,我只使用$osascriptFile.scpt但是,ProgressBar功能不受限制地对话框窗口,因为它适应了当前的应用程序,例如一个查找器窗口,其中进度更新显示在窗口底部。file.scpt看起来像这样。setnumUpdatesto100setprogresstotalstepstonumUpdatessetprogresscompletedstepsto0setprogressdescriptionto"Updating..."setprogressadditionaldescriptionto"Preparingtoprocess."setcycleto1

java - 将 Java 代码移植到 ObjC 时,如何最好地表示已检查的异常?

我正在努力将Java代码库移植到Cocoa/Objective-C,以便在桌面MacOSX上使用。Java代码有很多和很多方法,并已检查异常(exception)情况如:doubleasNumber()throwsFooException{...}在Objective-C中表示这些的最佳方式是什么?异常或错误输出参数?-(CGFloat)asNumber{...//possibly[FooExceptionraise:format:];}或-(CGFloat)asNumberError:(NSError**)outError{...}我感觉输出错误通常是Objective-C的更好解决