• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Won't Applescript command use defined ivars?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Won't Applescript command use defined ivars?


  • Subject: Won't Applescript command use defined ivars?
  • From: Chris Paveglio <email@hidden>
  • Date: Tue, 30 Aug 2011 12:01:30 -0700 (PDT)

I am starting to work on an application that must expose 1 Applescript command. (It's rather challenging to understand and implement.)
I don't understand what is happening with this code: If I have an ivar that is global in scope, when the Applescript command is accepted, that ivar won't be used. Why would that be ignored at all? What am I missing here?
Chris

For example (code simplified):

@interface...
{
NSString *userName;
}

@implementation...

-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    userName = NSUserName();
}

-(id)performDefaultImplementation
{
NSDictionary * theArguments = [self evaluatedArguments];
NSString *filePath = [self directParameter];

NSNumber *tcNumber = [theArguments objectForKey:@"tcNumber"];
NSString *operationType = [theArguments objectForKey:@"operationType"];
//the globals won't pass in properly when called from script
[self logEventDoc:filePath operType:operationType withTC:[tcNumber longValue]];
return nil;
}


-(void)logEventDoc:(NSString *)docPath operType:(NSString *)opType withTC:(long)tcNumber
{
NSString *theCommand = [NSString stringWithFormat:@"SpLogEventEtc %@ %D %@ %@", docPath, tcNumber, opType, userName];
//for testing, let's just do our favorite NSLog
NSLog(@"%@", theCommand);
//user name prints as (NULL) !!?? Why not using userName?
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Won't Applescript command use defined ivars?
      • From: Martin Wierschin <email@hidden>
    • Re: Won't Applescript command use defined ivars?
      • From: Scott Ribe <email@hidden>
  • Prev by Date: Re: stdout or stderr file path on iPhone?
  • Next by Date: Re: stdout or stderr file path on iPhone?
  • Previous by thread: Re: stdout or stderr file path on iPhone?
  • Next by thread: Re: Won't Applescript command use defined ivars?
  • Index(es):
    • Date
    • Thread