0

I am new in mac development. I have one problem. I made framework for Aperture that store images on particular place with some other information like username, password, no. of images and ftp server name etc. Then my another application start automatically, that application upload images on ftp server. My problem is how to start uploader application automatically. I think i can use script file and call this script file to first application. Please give me suggestion.

Amit Gujjar
  • 683
  • 1
  • 8
  • 20

2 Answers2

2

You can use open command with -a option

open -a appName  


NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/bin/open"];
[task setArguments:[NSArray arrayWithObjects:@"-a",@"appName",nil]];
[task launch];
[task release];
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
0

Thanks trojanfoe and Parag Bafna. My solution is...

   NSTask *task = [[NSTask alloc] init];
   NSBundle *bundle = [NSBundle bundleWithPath:[[NSWorkspace sharedWorkspace]  fullPathForApplication:@"Path Finder"]]];
  [task setLaunchPath:[bundle executablePath]];
   NSArray *arguments = [NSArray arrayWithObjects:@"Argument1", @"Argument2", nil];
   [task setArguments:arguments];
  [task launch];

I solve my problem. Thanks to all.

Amit Gujjar
  • 683
  • 1
  • 8
  • 20
  • @ trojanfoe .. Why? If i am reason then sorry. – Amit Gujjar Jul 24 '13 at 13:16
  • Well you basically used Parag Bafna's answer (from a comment I originally posted) so his answer should be accepted. It's not reasonable to post your own answer and accept it using bits of answers provided by others, otherwise where is the motivation to answer at all? You also appear a bit stingy with your upvotes... – trojanfoe Jul 24 '13 at 13:19
  • No i used other link. http://stackoverflow.com/questions/5048677/launching-an-mac-app-with-objective-c-cocoa . – Amit Gujjar Jul 24 '13 at 13:24