using the latest Beta Objective Basic is now capable to handle AppleScript calls via NSAppleScript and NSAppleEventDescriptor:
- Code: Select all
Declare Class "NSAppleEventDescriptor"
Declare Function "NSAppleEventDescriptor" - (NSString *)stringValue
Declare Function "NSAppleEventDescriptor" - (DescType)descriptorType
Declare Function "NSAppleEventDescriptor" - (NSInteger)numberOfItems
Declare Function "NSAppleEventDescriptor" - (NSAppleEventDescriptor *)descriptorAtIndex:(NSInteger)anIndex
Declare Function "NSAppleEventDescriptor" + (NSAppleEventDescriptor *)alloc
Declare Class "NSAppleScript"
Declare Function "NSAppleScript" + (id)alloc
Declare Function "NSAppleScript" - (id)initWithSource:(NSString *)source
Declare Function "NSAppleScript" - (id) executeAndReturnError: (NSError **) errorInfo
Event AwakeFromNib()
Dim myScriptString As String
Dim myASScript As NSAppleScript
Dim myAEDescriptor As NSAppleEventDescriptor = Nil
Dim err As id = Nil
myScriptString = "choose URL"
myASScript=myASScript.initWithSource(myScriptString)
myAEDescriptor = myASScript.executeAndReturnError(errinfo := err)
Alert(myAEDescriptor.stringValue())
End Event
Using
- Code: Select all
myScript="tell application \"System Profiler\"\nset detail level of document 1 to basic\nset theProfile to profile of document 1\nend tell"
Have Fun
Udo