ExamplesPack v482

Examples pack v482, 2007.07.31 - including examples of undocumented objects
package includes:


Xtras/Xtrema.x32
Xtrema v1.0.482


xList_vs_dirList_benchmarks.dir
Benchmarks of Xtrema's xLists versus Director's list objects. The xList object is backwards compatible to Director's list/propList, but from 50% to many times faster. It supports unicode strings, and also includes several new features, like e.g. performing case insensitive searches in a list.


xService_enumerateServices.dir
Enumerate and display info for installed services/drivers. Can also be expanded to modify/remove services, since the xService object provides support for all service related functions.
xService_projectorToService.dir
Register a projector to run as an NT service. Note, simplified: an application needs to perform specific tasks on startup to be accepted as a service by the OS. This part will be automatically handled by Xtrema, long as you make sure it is initialized (just call any of it's commands) early in your project.


xTextMem_unicodeTextAndEmbeddedImages.dir
Unicode text member with embedded images.
Drag/drop : dragging is supported, but dropping onto the stage is not enabled yet. Will be added soon.
Importing/exporting links: Importing wordpad links has been disabled in this version. Code that will allow advanced link i/o (link within link, links overlapping) is being developed.


Xtrema_UserLib.skeleton (folder, c++ project - vc6 or newer)
Xtrema_UserLib.dll      (the compiled dll)
xUserLib_embed_DLL_inDirector.dir
A sample movie and a skeleton project for rapidly creating a c++ dll and calling it's functions from lingo.
No XDK required.


xVar_ActiveDirectory.dir
Calling activeX objects from lingo. This example is an active directory browser. Supports protocols like WinNT, LDAP, IIS.


  // older examples follow.
Xtrema.x32

Xtrema x32 v1.0b389

Classes Included:
- String Object
- Text member

xtrRtf.zip

Unicode RTF member sample movie & projector. (info)

xtrXmlToList.dir

Unicode XML to proplist parser.

Generates a proplist from a unicode xml string, using string references for simplicity, and low memory usage.
No error checking included.

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.

4. Installation
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.
Then, hit one of the two green buttons at the bottom of this page.

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:
-- 1250 windows-1250 | ANSI - Central Europe
-- 1251 windows-1251 | ANSI - Cyrillic
-- 1252 windows-1252 | ANSI - Latin I
-- 1253 windows-1253 | ANSI - Greek
-- 1254 windows-1254 | ANSI - Turkish
-- 1255 windows-1255 | ANSI - Hebrew
-- 1256 windows-1256 | ANSI - Arabic
-- 1257 windows-1257 | ANSI - Baltic
-- 1258 windows-1258 | ANSI/OEM - Viet Nam
-- 874 windows-874 | ANSI/OEM - Thai


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.