Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/AppleScript/NSAppleScriptMBS with properties
Required plugins for this example: MBS MacCocoa Plugin, MBS MacBase Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/AppleScript/NSAppleScriptMBS with properties
This example is the version from Wed, 27th Oct 2020.
Project "NSAppleScriptMBS with properties.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
dim s as String
dim a as NSAppleScriptMBS
s=s+"property hello : ""Hallo Leute"""+chr(13)
s=s+"property just : ""Just a test"""+chr(13)
s=s+"display dialog hello"+chr(13)
s=s+"return just"+chr(13)
'MsgBox "The script:"+chr(13)+s
a=new NSAppleScriptMBS(s)
// compile
call a.Compile
// show names
dim names() as string = a.properties
MsgBox Join(names,EndOfLine)
// query value
MsgBox a.valueDescriptorForProperty("hello").stringValue
// change value
dim o as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithString("just a test")
call a.setValueDescriptorForProperty("hello", o)
// and query again
MsgBox a.valueDescriptorForProperty("hello").stringValue
quit
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
ExternalFile info
End ExternalFile
End Project
See also:
The items on this page are in the following plugins: MBS MacCocoa Plugin.