Example: /MacClassic/AppleScript/AppleScript with Unicode

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/AppleScript/AppleScript with Unicode


Required plugins for this example: MBS MacClassic Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/AppleScript/AppleScript with Unicode

This example is the version from Wed, 27th Oct 2020.

Project "AppleScript with Unicode.xojo_binary_project"
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim a as AppleScriptMBS dim b as AppleScriptMBS dim t as TextConverter dim s as String a=new AppleScriptMBS if not a.CanUnicodeText then MsgBox "We need Apple Script 1.3 or newer for Unicode text handling." end if a.UnicodeText=true // use it // compile this source code s="display dialog ""Hello World!""" // MsgBox str(lenb(s)) // 29 t=GetTextConverter(GetTextEncoding(0),GetTextEncoding(256)) s=t.convert(s) // MsgBox str(lenb(s)) // 58 if it's now unicode (16bit, not UTF8!) a.Compile s b=new AppleScriptMBS // now we copy the binary code to another object b.Binary=a.Binary // and run it b.Execute // now decompile s=b.Source MsgBox str(lenb(s)) // 29 if returned as MacRoman and 58 if returned as Unicode MsgBox s Quit End EventHandler
End Class
ExternalFile info
End ExternalFile
End Project

See also:

The items on this page are in the following plugins: MBS MacClassic Plugin.


💬 Ask a question or report a problem