个人学习笔记存放地

技巧

上一篇 / 下一篇  2008-04-22 13:55:00 / 个人分类:MAC

1. 启动应用程序
system("open /Applications/Safari.app");
The "open" command works as if you double-clicked the file.

system("/Applications/Safari.app/Contents/MacOS/Safari");

You would get a new instance of Safari. Much like opening multiple instances of IE in Windows. But this isn't Mac behavior. so use "open" instead.

2. help
If it's a help file, don't forget that OS X provides a standard framework for dealing with those. Otherwise, you could use something like the following, which will open a resource file using the default application for that file type:
  Code:
NSString *path = [[NSBundle mainBundle] pathForResource: @"yourfile" ofType: @"html"];
BOOL success = [[NSWorkspace sharedWorkspace] openFile: path];

There's also Launch Services

 


TAG: Safari framework 技巧 Applications app

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

我的栏目

日历

« 2008-08-22  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 229
  • 日志数: 17
  • 图片数: 1
  • 文件数: 4
  • 建立时间: 2008-01-26
  • 更新时间: 2008-07-09

RSS订阅

Open Toolbar