LSDynamic 1.5

give life to your LiteStep

LSDynamic is a module for LiteStep which moves windows in a fluid way by using scripts based on the timer. Windows being referred by their classes and titles (or tooltips), so you can also move *Shortcut. Displacements can be linear or circular, with an acceleration, and the whole based on intervals of time in ms. Scripts are like a timeline under Premiere.

-= Syl =-



Table of contents


History
    12/03/2002 - ver 1.4
    • Added wildcard (*) for the end of a caption name.
    • Added flags for circular movement.
    • Fixed a bug with Layercut.
    03/02/2002 - ver 1.3
    • Added DynLayeredShortcut.
    • Restore a layered shortcut just restore his initial alpha transparency.
    28/01/2002 - ver 1.2a
    • Added pause and resume to the bang command.
    • Fixed class argument for the move keyword in the macro.
    • Fixed arguments for the relay macro, and default parameter.
    • Thanks to xnowfall for his bug reports.
    22/01/2002 - ver 1.2
    • Updated pos with <relative> position.
    • Updated caption to use *.
    • Added size.
    • Added documentation in french.
    • Change the way to manage windows caption, slower but safer (the overflow shouldn't happen anymore).
    13/12/2001 - ver 1.1
    • Layered shortcuts can't be restored properly so just restore other layered windows (like Notepad).
    • Added relay.
    12/12/2001 - ver 1.0a
    • Fixed window class initialization.
    • Fixed "ShorcutClass" to "ShortcutClass" in examples.
    • Fixed tables in the readme.
    11/12/2001 - ver 1.0
    • First release.

    started the 03/12/2001.


Installation

Copy LSDynamic.dll in your module directory and load the module:

LoadModule "c:\LiteStep\Modules\LSDynamic.dll"

if c:\LiteStep\Modules\ is your module directory of course...
Then, to run the examples, go to the examples section.



Usage

LSDynamic allow you to define, in your step.rc, movements and macros, with timed movements inside, that you will call by using bangs command.
You will have to specify the window class and the window caption of the window that you want to move. To help you, you can use Winspy, a freeware that gives you these informations.
For shortcuts, the window class is "ShortcutClass" and the window caption is the tooltip that you defined when you created the shortcut.

Syntax color:

<value>

you must specifie a value

<value>

a value

<value>

the value is optional

keyword

this is a keyword

keyword

the line with this keyword is optional

Movement syntax

A movement define how your window will move. You can define a movement into a macro, but it's easier to understand if you define it outside a macro definition.
When a movement is define, you can use it into many macros. Here is a movement definition with all the possible options:

*dyn <move-type> "move-name"
*dyn hwnd <window-class>
*dyn caption <window-caption>
*dyn range <start-time> <end-time>
*dyn pos <x-pos> <y-pos> <relative>
*dyn dest <x-pos> <y-pos> <relative>
*dyn acc <position-acceleration>
*dyn center <x-pos> <y-pos> <relative>
*dyn c-dest <x-pos> <y-pos> <relative>
*dyn c-acc <center-acceleration>
*dyn r-dest <ray-length>
*dyn r-acc <ray-acceleration>
*dyn angle <angle-in-degree>
*dyn a-acc <angle-acceleration>
*dyn alpha <start-alpha> <end-alpha>
*dyn alpha-acc <alpha-acceleration>
*dyn size <width> <height>
*dyn ~<move-type>

Definition

<move-type>:
There are two type of movements, linear and circular. A linear movement is a straight line from the initial position to the destination. A circular movement make the window follow a circular path.
The "move-name" is how you will reference the movement in the macro.
Here are the definition for each type:

*dyn linear "move-name"
*dyn hwnd <window-class>
*dyn caption <window-caption>
*dyn range <start-time> <end-time>
*dyn pos <x-pos> <y-pos> <relative>
*dyn dest <x-pos> <y-pos> <relative>
*dyn acc <position-acceleration>
*dyn alpha <start-alpha> <end-alpha>
*dyn alpha-acc <alpha-acceleration>
*dyn size <width> <height>
*dyn ~linear

*dyn circular "move-name"
*dyn hwnd <window-class>
*dyn caption <window-caption>
*dyn range <start-time> <end-time>
*dyn pos <x-pos> <y-pos> <relative>
*dyn center <x-pos> <y-pos> <relative>
*dyn c-dest <x-pos> <y-pos> <relative>
*dyn c-acc <center-acceleration>
*dyn r-dest <ray-length>
*dyn r-acc <ray-acceleration>
*dyn angle <angle-in-degree>
*dyn a-acc <angle-acceleration>
*dyn alpha <start-alpha> <end-alpha>
*dyn alpha-acc <alpha-acceleration>
*dyn size <width> <height>
*dyn flags <flags>
*dyn ~circular

hwnd:
Specify the window class of the window you want to move. for example, the <window-class> of a shortcut is ShortcutClass.
Tf you don't specify a hwnd for the movement, the window class is the same that you define on a move line in a macro, or in the macro.
If you don't specify a hwnd for the macro, the window class is the same that you have put in the bang command.
If you don't give a <window-class>, the default window class is ShortcutClass.

caption:
Specify the window caption of the window you want to move. for example, the <window-caption> of a shortcut is his tooltip.
You can specify several caption at the same time like this:
*dyn caption "caption1" "caption2" "caption3" "..."
This syntax is also available where you have to specify captions.
If you don't specify a caption for the movement, the window caption is the same that you define on a move line in a macro, or in the macro.
If you don't specify a caption for the macro, the window caption is the same that you have put in the bang command.
You must at least specify a window caption somewhere.
You can use * to select all windows of the <window-class>.
Or just specify a * at the end of the name if you want to select multiple windows that begin with the same name (for example "caption *" will select "caption 1", "caption 2", "caption 3"...). You must put name with wildcard before other names ("caption *" "name *" "test 1" "test 2").

range:
The action is enable when the timer is between <start-time> and <end-time>. The range will be added with the range in the macro on the move line. If you don't specify a range for the movement, the range is the one you specify on the move line in the macro.

dest:
Define the destination of the window. You should specify a destination to make the linear movement.
The <relative> flag allow the position to be relative to the window.
If this flag isn't set, negative co-ordinate are relative to the opposite edge of the screen (like shortcut co-ordinates). If the flag is set (it acceptes value like "1", "true", "something"...), and if there is a sign in the co-ordinates (+ or -), the co-ordinates are relative to the initial position of the window (if there's no sign, the co-ordinates are relative to the screen).

pos:
This keyword move the window to a position when the movement begin, where <x-pos> and <y-pos> are the co-ordinates. Negative co-ordinate are relative to the opposite edge of the screen (like shortcut co-ordinates). If you don't specify a pos, the default position is the window position. <relative> position is relative to the window position.

size:
You can change the size of the window, just specify the new <width> and <height> of the window.

acc, r-acc, c-acc, a-acc, alpha-acc:
Define the acceleration to reach the destination. The default value is 100.
How does it work ?

acc < 100: o      o    o   o  oo ooo

acc = 100: o  o  o  o  o  o  o  o  o

acc > 100: ooo oo  o   o    o      o

The acceleration isn't restrainte between 0 and 200 because you can make some very interesting effects according to the value of this one.

alpha:
Apply alpha blending to the window, from <start-alpha> to <end-alpha>. These values are between 0 and 255.

center:
Specify the center of the circle. The window will move around the center

c-dest:
Specify the destination of the center of the circle.

r-dest:
Specify the final ray. The initial ray is computed with the center of the circle and the window position.

angle:
The window will move around the center from the window inital position, where the angle is equal to zero, to the final position on the circular path, obtained with the angle in degree.

flags:
For the moment, there is only one flag for circular movement:
C: when the ray is computed, LSDynamic will move the window from the top/left corner (if DynNoCircularRelativeToWindowCenter isn't specify) or from the window center (if DynNoCircularRelativeToWindowCenter is specify). By default, the ray is computed from the window center.


Macro syntax

The macro is the way you will use the movements you defined.
*dyn macro "macro-name"
*dyn flags <flags>
*dyn hwnd <window-class>
*dyn caption <window-caption>
*dyn move <start-time> <end-time> <move-name>
*dyn move <start-time> <end-time> <move-name> <window-class> <window-caption>
*dyn move <start-time> <end-time> <move-name> caption <window-caption>
*dyn exec <start-time> <end-time> <command>
*dyn pause <start-time> <end-time> <move-name>
*dyn resume <start-time> <end-time> <move-name>
*dyn win-stats <start-time> <end-time> <flags> <window-class> <window-caption>
*dyn win-stats <start-time> <end-time> <flags> caption <window-caption>
*dyn restore <window-caption>
*dyn relay <relay-mode> <macro-name>

Definition

macro:
You can execute the macro with the bang command which is the "macro-name".

flags:
The possible <flags> are:
L: the macro will Loop.
O: a command can only be executed One time.

move:
This command moves a window with the script <move-name> during the time <start-time> and <end-time>. You can also specify a <window-class> and <window-caption>. If you don't want to specify the <window-class>, use the keyword caption
exec:
Execute a command during the time <start-time> and <end-time>.

pause:
Pause the <macro-name> when the time is between <start-time> and <end-time>.
resume:
Resume the paused <macro-name> when the time is between <start-time> and <end-time>.

win-stats:
This will show or hide the window during <start-time> and <end-time>. The available <flags> are hide and show.

restore:
Restore the window with the caption <window-caption> when the macro is finishing.

relay:
The macro, if it is stop, will give the relay to <macro-name> by using <relay-mode> which are:

  • default: stop the current macro ans start the relay macro.


  • Settings

    DynTimerUpdate <delay-in-ms>
    The macro will be updated every <delay-in-ms>.
    The default value is 10 ms.

    DynNoCircularRelativeToWindowCenter
    By default, when you make a circular movement, the co-ordinates are the center of the window. But you can force LSDynamic to take the top-left corner of the window to make the circular movement.

    DynNoHandleStorage
    By default, the windows handle are stored in a list to speed up windows detection, but if you want to move other windows than shortcut, and that windows can be closed, you should this option.

    DynStoreBadHandle
    If you only use LSDynamic with shortcuts, you can use this option to speed up again detection if a have specifie a bad window class or caption.

    DynForceLayerRestoration
    This option restore the window layer (layer is used for alpha blending) and free some memory. Normally it would speed up, but...

    DynLayeredShortcut
    If you use Layercut, enable the fast transparency.

    DynInternalAlpha <window-class> <window-class> <window-class> ...
    Allow LSDynamic to change the alpha of a module that support internal alpha (like Layercut). You must specify the window class that the module manage (for example ShortcutClass for Layercut). This system is just useful if the module manage the way to change alpha.

    How does it work:
    Specify a variable WM_ALPHA:

    #define WM_ALPHA (WM_USER + 0x42)

    In your module, prepare it to receive the WM_ALPHA message in the dispatcher:

    MESSAGE(onUpdateAlpha, WM_ALPHA)

    Then update the alpha of your window:

    void onUpdateAlpha(Message& message)
    {
      if (message.lParam < 0)
        updateAlpha(alpha_initial);
      else
        updateAlpha(message.lParam);
    }


    Of course, the last thing depend on how you manage the transparency.

    Bangs

    !macro-name default
    Run the macro.

    !macro-name stop
    Stop the current macro, and give the relay if there was a relay keyword in it.

    !macro-name pause
    Pause the macro execution.

    !macro-name resume
    Resume the macro execution.

    !macro-name caption <window-caption>
    !macro-name <window-class> <window-caption>
    Run the macro with the <window-class> and <window-caption>

    !DynRunning
    Show which macros are currently running.

    !DynChangeMoveType <move-name> <move-type>
    Change the type of the movement.

    !DynPauseAll
    !DynResumeAll
    To pause and resume all macros.



    LsBox

    To use LSDynamic with LsBox, specify this line in your box:

    *ModuleHook !DynModuleHook

    Then in the macro, the class name is LsBoxClass, and the caption name is your box name.



    Examples

    To run examples, copy the images in your image directory and the rc files in your LiteStep directory. Then include dyn.rc in your step.rc:
    include "c:\litestep\dyn.rc"
    You must load mzscript just to run the first bang !init_dyn with:
    *mzscript start !init_dyn default
    (this line is in the dyn.rc, if it doesn't work, try to put this line in your default script rc file, or run it with a hotkey).
    I try to show you with this example how LSDynamic works, so I just use mzscript to initialise the example. I don't manage if a macro has been executed, so clic just once on the big shortcut to initialise the second group, but don't clic on it a second time.



    Tips

    You should use Winspy to view <window-class> and <window-caption>.

    If you define a movement in a macro, you can also use it in other macros.

    You should pass <window-class> and <window-caption> threw bang command instead of define it in the movement or in a macro.

    LSDynamic doesn't mind in which group a shortcut is, so to have the shortcut working, you should show it with the !ShortcutGroupShow bang and then toggle the stat with win-stats. By this way, a shortcut can be in a group and can be hidden while the others are shown, the group are not altered.

    <start-time> and <end-time> can overlap another movement, you can make many movements at the same time.

    Changing the size of a transparent window isn't recommanded, or you will experience really big slowdown ^_^;



    Troubleshooting

    If the shortcut always swap its stat between normal and mouse_over, or if you can't get the window caption, use my modified shortcut2.dll.

    There is a problem with alpha blending when you use it on a shorcut which isn't ontop. You can't use alpha with child window (window create with the flag WS_CHILD). The modification I made on the shortcut module was just to allow you to use LSDynamic with ontop shortcut (the caption was disable if it was ontop).

    Some strange things can happen if you use multiples macros on same windows at the same time...

    If your shortcut is hidden when LiteStep is launched, it doesn't exist yet, you should toggle its stat before using it.

    A little slowdown should happen when the shortcut tooltip appears.

    A bug can happen when you want to execute a macro inside a macro (with the exec keyword). Email me if this happen with your macros to see what I can do...



    Greetings

    I was inspired by Lain (the manga) and mzscript (the module).
    Thanks to the LSDev Team for having made the best shell replacement.
    Thanks to Nekoi, SeRIAL, NecroBorg, Terro, Kaze, Stafkiel, Krag, Nox, Fredo, Jule, Vince, and every one who supported me   =)
    Thanks to xnowfall for helping me to debug the 1.2 release.



    Contact

    If you have a problem, want a new feature, want to report a bug, email me.


    -= Syl =-
    Web: http://www.epita.fr:8000/~rouque_s/
    Mail: rouque_s@epita.fr
    ICQ: 84198930