Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Cascade Vista TN3270 Windows

Description
I use a TN3270 client called Vista TN3270 (the name Vista was used well before the abomination that was Windows 6). I sometimes have double digit sessions open, and I like to have portions of all the windows displaying so I can click on them. Each session has an ID that I've configured to display in the title. This script scans the window title, looks for the session ID as I set it, and then based on the ID (A-Z, 0-9) sets the X coordinate based on it with an offset. For example, session A is positioned at (64,32), session B is at offset (88,32), etc. This script normally runs at window open, however I have bound it to a function key in case the window is moved accidentally. I used the "Launch an Application and Move It to a Specific Location" and "Move Only A Specific Window of an Application" scripts as bases.
Language
C#.net
Minimum Version
Created By
zarchasmpgmr
Contributors
-
Date Created
Jul 5, 2019
Date Last Modified
Jul 5, 2019

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
		// modify the windowTitleToMatch string below to specify the title of the window you want moved by the Window Location rule
        // modify the locationX and locationY int values below to set the location the window should be moved to if its window title matches
        int locationX = 64;
        const int locationY = 32;
        const int offsetX = 24;
		
		// get the title of the window detected by the Window Location rule
		string windowTitleActual = BFS.Window.GetText(windowHandle);

		int openParen = windowTitleActual.IndexOf("(");
		if (openParen > 0)
		{
            int closeParen = windowTitleActual.IndexOf(")", openParen + 1, 2);
            if (closeParen > 0)
            {
                const string sessionIDValues = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                String sessionID = windowTitleActual.Substring(openParen + 1, 1);
                int sessionX = sessionIDValues.IndexOf(sessionID);
                locationX = locationX + offsetX * sessionX;
                BFS.Window.SetLocation(windowHandle, locationX, locationY);
            }
        }
	}
}