NSString *string = [[[NSBundlemainBundle]resourcePath]stringByAppendingPathComponent:@"ping.scpt"];
NSLog(@"%@",string);
NSDictionary *errorInfo;
NSAppleScript *appleScript = [[NSAppleScriptalloc]initWithContentsOfURL:[NSURLfileURLWithPath:string]error:&errorInfo];
perror("script");
NSLog(@"%@",errorInfo);
Boolean isComple = [appleScriptcompileAndReturnError:&errorInfo];
NSLog(@"%d %@",isComple,errorInfo);
NSAppleEventDescriptor * descriptor = [appleScriptexecuteAndReturnError:nil];
NSLog(@"%@",[descriptorstringValue]);
//script
do shell script "ping www.baidu.com" with administrator privileges
“双语播放器”已在app store上架,欢迎大家前去下载(主要用于看电影,学英语,程序员一定要学好英语!)
这里是链接:
https://itunes.apple.com/cn/app/shuang-yu-bo-fang-qi-kan-dian/id950279764?mt=8