Workspace 起動設定オプション
起動オプション
NSString * const NSWorkspaceLaunchConfigurationAppleEvent; NSString * const NSWorkspaceLaunchConfigurationArguments; NSString * const NSWorkspaceLaunchConfigurationEnvironment; NSString * const NSWorkspaceLaunchConfigurationArchitecture;let NSWorkspaceLaunchConfigurationAppleEvent: String let NSWorkspaceLaunchConfigurationArguments: String let NSWorkspaceLaunchConfigurationEnvironment: String let NSWorkspaceLaunchConfigurationArchitecture: String
解説
launchApplicationAtURL:options:configuration:error: メソッドで使用
NSWorkspaceLaunchConfigurationAppleEvent
アップルイベント
NSWorkspaceLaunchConfigurationArguments
起動時の引数
NSWorkspaceLaunchConfigurationEnvironment
環境変数
NSWorkspaceLaunchConfigurationArchitecture
アーキテクチャ
NSBundleExecutableArchitectureI386
386
NSBundleExecutableArchitecturePPC
PowerPC
NSBundleExecutableArchitectureX86_64
x86 64ビット
NSBundleExecutableArchitecturePPC64
PowerPC 64ビット
フレームワーク
ApplicationKit
クラス
NSWorkspace
使用可能
10.6-
更新時のバージョン
OS X 10.10.3
Swift1.2
例文
//NSWorkspace launchApplicationAtURL:options:configuration:error: @IBAction func function009(sender: AnyObject) { let theWorkspace : NSWorkspace = NSWorkspace.sharedWorkspace() var anError: NSError? let andPrint = NSWorkspaceLaunchOptions.AndPrint.rawValue let mask = Int( andPrint ) // cast from UInt let theURL : NSURL = NSURL(fileURLWithPath: "/Applications/iTunes.app")! let theOption : NSNumber = NSNumber(integer: 0) //32ビットモードで起動 let theArc : NSNumber = NSNumber(integer: NSBundleExecutableArchitectureI386) //64ビットモードで起動 //let theArc : NSNumber = NSNumber(integer: NSBundleExecutableArchitectureX86_64) let theConfig : [NSObject : AnyObject] = [NSWorkspaceLaunchConfigurationArchitecture : theArc] if (theWorkspace.launchApplicationAtURL(theURL, options: NSWorkspaceLaunchOptions.Async, configuration: theConfig, error: &anError) != nil){ NSLog("YES") }else{ NSLog("NO") } }