Re: Double Tell - Tell by Variable Question
Re: Double Tell - Tell by Variable Question
- Subject: Re: Double Tell - Tell by Variable Question
- From: Dave <email@hidden>
- Date: Thu, 25 Jun 2015 15:54:55 +0100
> On 25 Jun 2015, at 14:46, Shane Stanley <email@hidden> wrote:
>
> On 25 Jun 2015, at 11:19 pm, Dave <email@hidden> wrote:
>>
>> I’ve looked at this:
>>
>> http://stackoverflow.com/questions/4609351/applescript-tell-by-variable-dilemma
>>
>>
>> But you still need to hardwire a String into the Script, is there anyway of avoiding this?
>
> What are you trying to achieve?
Well I have an application that need to communicate with a group of target apps via AppleScript. I’m using the technique described here:
http://appscript.sourceforge.net/asoc.html
So, from the example:
// MyASClass.h
#import <Cocoa/Cocoa.h>
@interface MyASClass : NSObject
// Note: C primitives are only automatically bridged when calling from AS into ObjC.
// AS methods with boolean/integer/real parameters/results must declare NSNumber*:
- (NSNumber *)square:(NSNumber *)aNumber;
@end
-- MyASClass.applescript
script
MyASClass
property parent : class "NSObject"
on square_(aNumber)
return aNumber ^ 2
end square_
end script
Obviously this is a very simple example, in read like, the method “square_” in the Script (called from Objective-C) would most like need to target an application, so it would be something like this:
on square_(aNumber)
tell application “Calculator”
set myResult to the square of aNumber
return myResult
end tell
end square_
I’m trying to avoid the use of “Calculator” and pass the App ID (or name or process id or whatever) into the “square” method.
All the Best
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden