Examples pack v482, 2007.07.31 - including examples of undocumented objects
Xtrema_UserLib.skeleton (folder, c++ project - vc6 or newer)
|// older examples follow.|
Xtrema x32 v1.0b389
Unicode RTF member sample movie & projector. (info)
Unicode XML to proplist parser.
Generates a proplist from a unicode xml string, using string references for simplicity, and low memory usage.
|xtrLsEdit.zip||Xtrema Unicode Lingo Script Editor Bridge [ 1.29 MB ]
Adds the ability to include unicode strings in Director scripts, using any external unicode text editor (e.g. notepad).
1. Unicode strings in Director
When using the Xtrema's _u('string') command in a Director's script, 'string' is expected to be a unicode encoded string. Director's build-in editor cannot display unicode strings, but all utf-8 and utf-7 characters can be safely included in a script.
E.g. _u("αβ") will be displayed as _u("I±I²"), or as something similar - system locale dependant.
With the above command, Director will pass the string "I±I²" to Xtrema, which will recognize the string as the unicode string "αβ".
So, an external editor is not needed in order to include unicode strings in Director's scripts. But it is required for them to be displayed correctly while editing one.
2. Why is this app needed?
According to the above, any text editor could be used directly - all it would take would be to configure director to use the desired external editor.
Close, but not quite. Some external editors require a BOM (small header in the beginning of the file that defines the encoding) in order to identify the file, or, in most cases, automatically add a BOM when saving a unicode file, even if the file did not include a BOM. Additionally, some editors may not identify the encoding correctly.
Since Director does not support unicode, BOMs are unknown to it, so the BOM will appear as garbage at the beginning of the script, resulting in script errors when executing the script.
3. What it does
Not much. Just addresses the above issue by writing a BOM to the file prior to launching the .ls editor and removing it before returning control to Director.
a: Make sure that .ls files are associated with a Unicode text editor:
Right click on the included .ls file xtrLsEdit_Script2.ls, select 'open with' and select the editor you wish to use. Before clinking 'ok', select the 'always use the selected program...' check box.
( path to notepad on XP: C:\WINDOWS\system32\notepad.exe | suggested alternative: notepad2)
Now, double-click the file to test if it is associated with the editor you selected - close the file, but don't save it, if asked! (see section 2).
b: Set up Director to use an external editor for scripts:
Go to edit>preferences>editors, select 'script' and click 'edit'.
Click 'browse' and select the 'xtrLsEdit.exe' file.
Select 'use external editor'.
You are done.
Now, to test the movie, copy the file Xtrema.x32 to your Director's Xtras' folder (if you haven't done so already) and open and run the xtrLsEdit_Sample.dir.
To edit a script, double-click it.
When done editing, save the file, and close the editor - the xtrLsEdit.exe will, at that point, perform any modifications required and quit. After that, you can click 'done' or 'cancel' in Director's pop-up window, to either update the script or discard the changes.
You can safely edit the scripts with the internal editor as well, long as you don't modify the unicode data (the symbol-like data in the quotes).
Source Code Note:
The xtrLsEdit.exe file is a Director projector, using a special version of Xtrema, containing only the required string commands, plus process and window commands from classes not included in the public beta. Soon as a version including these classes is released, the source file of the xtrLsEdit will be made available for download.
|// older examples - may not work with beta .3xx+|
|xtrFlashText.zip||Use flash text box to display unicode characters
Director movie - Import unicode clipboard data, convert, and pass to flash for display.
|xtrUniToAnsi.zip||Imports and converts Unicode text to Ansi Rtf text that Director can display. [1.80 MB]
Director movie (source) + projector.
Select and copy to clipboard unicode text, from e.g. a word processor.
This program will split a Unicode string to smaller, ANSI strings, and will set the font of each parsed string according to its codepage.
The same scripts can be used to parse for MacOS, long as the required code pages are installed (regional options).
ANSI Code Pages Supported by the 'toSL' command:
|xtrHtmlReadable.zip||Html Compact / Expand [14KB]
Sample script - shrink (by removing white spaces), or expand an html document to a readable layout.
The compact part is quite simple - just a couple lines of code.
The expand routine makes use of references and selection properties.