Won't Applescript command use defined ivars?
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