On Thu, 08 Mar 2012 14:32:07 +1100, Prime Coderama <[email protected]> 
said:
>If no Terminal app is open, the following code opens TWO Terminal windows. Why 
>is it doing this? I only want one window to open.
>
>If only one Terminal window is open, then the following code opens only ONE 
>additional window.
>
>NSAppleScript* terminal = [[NSAppleScript alloc] initWithSource:
>                           [NSString stringWithFormat:
>                                @"tell application \"Terminal\"\n"
>                                @"    activate\n"
>                                @"    do script \"echo %@\"\n"
>                                @"    tell the front window\n"
>                                @"    set title displays shell path to false\n"
>                                @"    set title displays custom title to 
> true\n"
>                                @"    set custom title to \"My session! %@\"\n"
>                                @"    end tell\n"
>                                @"end tell", name, name]];
>
>[terminal executeAndReturnError:nil];

It actually might help you to read my AppleScript book! See p. 278 on the 
meaning of launch and on what applications do when they are launched implicitly 
by a tell block.

m.

--
matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to