The Site of Computing

Asymetrix Toolbook

Asymetrix Toolbook can be utilised for many applications with the primary focus being on multimedia. The scripting is easy, and the power of the API is right at hand.

Here is a nice little object fx routine I heavily modified from a basic example by an unknown author. This allows you to use Asymetrix's standard transition effects on individual objects on one page. You can have an object fx appear, fx hide or have one object fx replace another with extreme ease.

to handle enterapplication
linkDLL "user"
int LockWindowUpdate (WORD)
End linkDLL

-- Link the kernel dll, which will handle Windows Memory Allocation and get the WINDIR
linkDLL "KERNEL"
INT GetWindowsDirectory ( STRING, INT )
WORD GlobalAlloc ( WORD, DWORD )
POINTER GlobalLock ( WORD )
INT GlobalUnlock ( WORD )
WORD GlobalFree ( WORD )
end linkDLL
end

to handle fx appear, pObjList, params, pOldObjList
--
-- appear = show/hide/replace
-- pObjList = list of objects eg. group "f1", or "group f1, group f2, group f3"
-- params = parameter string for transition command
-- pOldObjList = list of objects to be hidden in a replace only

local int i
local int a
local int x

If pObjList is null and object of self is not in "page,background,book"
set pObjList to objects of this page
end If

params = params & ""
pOldObjList = pOldObjList & ""

set sysLockScreen to true

a = itemcount(pObjList)

step i from 1 to a -- MAIN LOOP FOR pObjList
ob = item i of pObjList

a = itemcount(pObjList)
end step

-- PROCESS pOldObjList
a = itemcount(pOldObjList)

conditions
when appear contains "show"
step i from 1 to itemcount(pObjList)
obj = item i of pObjList

If visible of obj = False Then
show obj
End If
end step

when appear contains "hide"
step i from 1 to itemcount(pObjList)
obj = item i of pObjList

If visible of obj = True Then
hide obj
End If
end step

when appear contains "replace"
step i from 1 to itemcount(pOldObjList)
obj = item i of pOldObjList

If visible of obj = True Then
hide obj
End If
end step

step i from 1 to itemcount(pObjList)
obj = item i of pObjList

If visible of obj = False Then
show obj
End If
end step
end conditions

-- Reset sysLockScreen, get rid of Windows' Paint message

If params <> "" Then
get LockWindowUpdate (sysClientHandle)
sysLockScreen = false
get LockWindowUpdate (0)

set sysSuspendMessages to true

execute "transition """& params &""" to this page"
Else
sysLockScreen = false -- simply update the screen
End If

set sysSuspendMessages to false
end

Here's the actual implementation :

 

to handle buttonclick

send fx "show", "button b1, button b2", "dissolve speed 200"

send fx "hide", "button b2", "zoom speed 200"

send fx "replace", "button b2", "fade speed 200", button "b1"

end

Make More DLL's

It is easy to complement asymetrix's script with functions provided from custom C++ DLL's which easily counteracts any speed issues in the scripting. You can also create new functions which are either difficult or impossible to implement in openscript (asymetrix's own language). This is one of the primary reasons for 1) learning C, and 2) knowing the capabilities of different programming languages.

Specifically, the useful possibilities you have available when you implement a C++ DLL are potentially :

The possibilities are endless, and with Asymetrix Toolbook II Instructor 6.0's ability to accept OCX's, this makes for one powerful tool.

Generally, you make a DLL when the alternative using openscript doesn't meet the standard or is limited, or simply isn't possible using normal methods. The other great aspect of making DLL's is that all of your functionality is encapsulated. If you have a bug in a sort routine and you fix it, you do not need to change any of the implementation code, or re-compile the affected programs - they are automatically updated next time they are run.

Home