agentland.software
Class MSWindowsDisplayAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.software.MSWindowsDisplayAgent
- public class MSWindowsDisplayAgent
- extends AgentAgent
- implements MSWindowsDisplay
Overview
This is a agent designed to control the windows
on a MSWindows 95/98/NT/2000 box. In the instance of an
upgrade beyond that, testing should be done to make sure that
the libraries and the constant values are the same
This basically works by using neva's(www.nevaobject.com)
coroutine functionality to pass commands based out of
user32.dll, which handles window management. Specifically,
this acts as an interface to showWindow, setWindowPosition,
and setActiveWindow. All of the arguments, with the exception
of the window name, are handled exactly as normal win32
calls, using the same constants(all of these constants are
listed in here). Window names, however, are abstracted away
from the integer pointers that windows uses as references.
Instead, this agent takes in string arguments as windows.
They are matched to the names of windows and that integer
is used. If, after the first pass, no such name is found,
a second pass is done comparing all of the window names
to the window requested using the closeEnough() procedure.
At current, this procedure either looks to see if the name
requested is a substring of the whole name in a non-case-sensitive
fashion or looks to see if the window name begins with the
given string. The default method is beginning matching, but
the user can switch this using the setWindowSelectionMethod()
function. Note that the first matching window will be used
and there is *not* a specification for the order in which
they will be resolved, as it depends on the system-level
implementation of Hashtable.enumerate.
If a window with no matches is requested OR windows returns
an error attempting to preform the op, a MSWindowsDisplayException
will be thrown. Note that this exception does contain some
more information than a standard exception and should be
looked at if the need for debugging window operations arises.
- See Also:
- Serialized Form
Method Summary |
void |
activateWindow(String w)
|
Vector |
enumerateWindows()
|
void |
hideWindow(String w)
|
void |
maximizeAndActivateWindow(String w)
|
void |
minimizeWindow(String w)
|
void |
resizeWindow(String w,
int x,
int y,
int width,
int height,
int placement,
int options)
|
void |
restoreWindow(String w)
|
void |
runCommand(String command)
Run a command on behalf of the sending program (so controller
programs do not have to be tied to a particular machine) |
void |
sendKeyPress(int key)
|
void |
sendKeyToWindow(int key,
String name)
|
void |
sendMetaKeyPress(int key)
|
void |
sendMetaKeyToWindow(int key,
String name)
|
void |
sendModifiedKeyPress(int modifier,
int key)
|
void |
sendModifiedKeyPressToWindow(int modifier,
int key,
String name)
|
void |
setWindowSelectionMethod(int METHOD)
|
void |
showWindowOperation(String w,
int cmd)
|
String |
windowContaining(String str)
Returns a window name containing a substring |
Methods inherited from class metaglue.AgentAgent |
addMonitor,
alive,
defrost,
defrostAll,
defrostBoolean,
defrostInt,
defrostString,
fixAttribute,
fixAttribute,
freeze,
freeze,
freeze,
freezeAll,
freezeVar,
getAgentID,
getAttribute,
getCatalog,
getCatalogID,
getDesignation,
getFrozenVariables,
getLogLevel,
getMetaglueAgent,
getMetaglueAgentID,
getOccupation,
getProperties,
getSociety,
log,
log,
log,
obtainMetaglueAgent,
obtainMetaglueAgent,
obtainMetaglueAgentByName,
reliesOn,
reliesOn,
reliesOn,
reliesOnSynch,
removeFrozen,
replaceExceptionHandler,
setFreezeName,
setLogLevel,
setLogName,
shutdown,
startAgent,
startAgentOn,
startAgentOn,
startup,
status,
tiedTo,
tiedTo,
tiedTo,
tiedTo,
tieToDesignation,
whereAreYou |
DEFAULT
public static final int DEFAULT
FIND_SUBSTRING
public static final int FIND_SUBSTRING
BEGINS_WITH
public static final int BEGINS_WITH
SW_FORCEMINIMIZE
public static final int SW_FORCEMINIMIZE
SW_HIDE
public static final int SW_HIDE
SW_MAXIMIZE
public static final int SW_MAXIMIZE
SW_MINIMIZE
public static final int SW_MINIMIZE
SW_RESTORE
public static final int SW_RESTORE
SW_SHOW
public static final int SW_SHOW
SW_SHOWDEFAULT
public static final int SW_SHOWDEFAULT
SW_SHOWMAXIMIZED
public static final int SW_SHOWMAXIMIZED
SW_SHOWMINIMIZED
public static final int SW_SHOWMINIMIZED
SW_SHOWMINNOACTIVE
public static final int SW_SHOWMINNOACTIVE
SW_SHOWNA
public static final int SW_SHOWNA
SW_SHOWNOACTIVE
public static final int SW_SHOWNOACTIVE
SW_SHOWNORMAL
public static final int SW_SHOWNORMAL
SW_NORMAL
public static final int SW_NORMAL
showCmdString
public static final String[] showCmdString
HWND_BOTTOM
public static final int HWND_BOTTOM
HWND_NOTOPMOST
public static final int HWND_NOTOPMOST
HWND_TOP
public static final int HWND_TOP
HWND_TOPMOST
public static final int HWND_TOPMOST
SWP_ASYNCWINDOWPOS
public static final int SWP_ASYNCWINDOWPOS
SWP_DEFERERASE
public static final int SWP_DEFERERASE
SWP_DRAWFRAME
public static final int SWP_DRAWFRAME
SWP_FRAMECHANGED
public static final int SWP_FRAMECHANGED
SWP_HIDEWINDOW
public static final int SWP_HIDEWINDOW
SWP_NOACTIVATE
public static final int SWP_NOACTIVATE
SWP_NOCOPYBITS
public static final int SWP_NOCOPYBITS
SWP_NOMOVE
public static final int SWP_NOMOVE
SWP_NOOWNERZORDER
public static final int SWP_NOOWNERZORDER
SWP_NOREDRAW
public static final int SWP_NOREDRAW
SWP_NOREPOSITION
public static final int SWP_NOREPOSITION
SWP_NOSENDCHANGING
public static final int SWP_NOSENDCHANGING
SWP_NOSIZE
public static final int SWP_NOSIZE
SWP_NOZORDER
public static final int SWP_NOZORDER
SWP_SHOWWINDOW
public static final int SWP_SHOWWINDOW
VK_LBUTTON
public static final int VK_LBUTTON
VK_RBUTTON
public static final int VK_RBUTTON
VK_CANCEL
public static final int VK_CANCEL
VK_MBUTTON
public static final int VK_MBUTTON
VK_XBUTTON1
public static final int VK_XBUTTON1
VK_XBUTTON2
public static final int VK_XBUTTON2
VK_BACK
public static final int VK_BACK
VK_TAB
public static final int VK_TAB
VK_CLEAR
public static final int VK_CLEAR
VK_RETURN
public static final int VK_RETURN
VK_SHIFT
public static final int VK_SHIFT
VK_CONTROL
public static final int VK_CONTROL
VK_CTRL
public static final int VK_CTRL
VK_MENU
public static final int VK_MENU
VK_ALTERNATE
public static final int VK_ALTERNATE
VK_ALT
public static final int VK_ALT
VK_META
public static final int VK_META
VK_PAUSE
public static final int VK_PAUSE
VK_CAPITAL
public static final int VK_CAPITAL
VK_KANA
public static final int VK_KANA
VK_HANGUEL
public static final int VK_HANGUEL
VK_HANGUL
public static final int VK_HANGUL
VK_JUNJA
public static final int VK_JUNJA
VK_FINAL
public static final int VK_FINAL
VK_HANJA
public static final int VK_HANJA
VK_KANJI
public static final int VK_KANJI
VK_ESCAPE
public static final int VK_ESCAPE
VK_CONVERT
public static final int VK_CONVERT
VK_NONCONVERT
public static final int VK_NONCONVERT
VK_ACCEPT
public static final int VK_ACCEPT
VK_MODECHANGE
public static final int VK_MODECHANGE
VK_SPACE
public static final int VK_SPACE
VK_PRIOR
public static final int VK_PRIOR
VK_NEXT
public static final int VK_NEXT
VK_END
public static final int VK_END
VK_HOME
public static final int VK_HOME
VK_LEFT
public static final int VK_LEFT
VK_UP
public static final int VK_UP
VK_RIGHT
public static final int VK_RIGHT
VK_DOWN
public static final int VK_DOWN
VK_SELECT
public static final int VK_SELECT
VK_PRINT
public static final int VK_PRINT
VK_EXECUTE
public static final int VK_EXECUTE
VK_SNAPSHOT
public static final int VK_SNAPSHOT
VK_INSERT
public static final int VK_INSERT
VK_DELETE
public static final int VK_DELETE
VK_HELP
public static final int VK_HELP
VK_0
public static final int VK_0
VK_1
public static final int VK_1
VK_2
public static final int VK_2
VK_3
public static final int VK_3
VK_4
public static final int VK_4
VK_5
public static final int VK_5
VK_6
public static final int VK_6
VK_7
public static final int VK_7
VK_8
public static final int VK_8
VK_9
public static final int VK_9
VK_A
public static final int VK_A
VK_B
public static final int VK_B
VK_C
public static final int VK_C
VK_D
public static final int VK_D
VK_E
public static final int VK_E
VK_F
public static final int VK_F
VK_G
public static final int VK_G
VK_H
public static final int VK_H
VK_I
public static final int VK_I
VK_J
public static final int VK_J
VK_K
public static final int VK_K
VK_L
public static final int VK_L
VK_M
public static final int VK_M
VK_N
public static final int VK_N
VK_O
public static final int VK_O
VK_P
public static final int VK_P
VK_Q
public static final int VK_Q
VK_R
public static final int VK_R
VK_S
public static final int VK_S
VK_T
public static final int VK_T
VK_U
public static final int VK_U
VK_V
public static final int VK_V
VK_W
public static final int VK_W
VK_X
public static final int VK_X
VK_Y
public static final int VK_Y
VK_Z
public static final int VK_Z
VK_LWIN
public static final int VK_LWIN
VK_RWIN
public static final int VK_RWIN
VK_APPS
public static final int VK_APPS
VK_SLEEP
public static final int VK_SLEEP
VK_NUMPAD0
public static final int VK_NUMPAD0
VK_NUMPAD1
public static final int VK_NUMPAD1
VK_NUMPAD2
public static final int VK_NUMPAD2
VK_NUMPAD3
public static final int VK_NUMPAD3
VK_NUMPAD4
public static final int VK_NUMPAD4
VK_NUMPAD5
public static final int VK_NUMPAD5
VK_NUMPAD6
public static final int VK_NUMPAD6
VK_NUMPAD7
public static final int VK_NUMPAD7
VK_NUMPAD8
public static final int VK_NUMPAD8
VK_NUMPAD9
public static final int VK_NUMPAD9
VK_MULTIPLY
public static final int VK_MULTIPLY
VK_ADD
public static final int VK_ADD
VK_SEPARATOR
public static final int VK_SEPARATOR
VK_SUBTRACT
public static final int VK_SUBTRACT
VK_DECIMAL
public static final int VK_DECIMAL
VK_DIVIDE
public static final int VK_DIVIDE
VK_F1
public static final int VK_F1
VK_F2
public static final int VK_F2
VK_F3
public static final int VK_F3
VK_F4
public static final int VK_F4
VK_F5
public static final int VK_F5
VK_F6
public static final int VK_F6
VK_F7
public static final int VK_F7
VK_F8
public static final int VK_F8
VK_F9
public static final int VK_F9
VK_F10
public static final int VK_F10
VK_F11
public static final int VK_F11
VK_F12
public static final int VK_F12
VK_F13
public static final int VK_F13
VK_F14
public static final int VK_F14
VK_F15
public static final int VK_F15
VK_F16
public static final int VK_F16
VK_F17
public static final int VK_F17
VK_F18
public static final int VK_F18
VK_F19
public static final int VK_F19
VK_F20
public static final int VK_F20
VK_F21
public static final int VK_F21
VK_F22
public static final int VK_F22
VK_F23
public static final int VK_F23
VK_F24
public static final int VK_F24
VK_NUMLOCK
public static final int VK_NUMLOCK
VK_SCROLL
public static final int VK_SCROLL
VK_LSHIFT
public static final int VK_LSHIFT
VK_RSHIFT
public static final int VK_RSHIFT
VK_LCONTROL
public static final int VK_LCONTROL
VK_RCONTROL
public static final int VK_RCONTROL
VK_LMENU
public static final int VK_LMENU
VK_RMENU
public static final int VK_RMENU
VK_BROWSER_BACK
public static final int VK_BROWSER_BACK
VK_BROSWER_FOREWARD
public static final int VK_BROSWER_FOREWARD
VK_BOWSER_REFRESH
public static final int VK_BOWSER_REFRESH
VK_BROWSER_STOP
public static final int VK_BROWSER_STOP
VK_BROWSER_SEARCH
public static final int VK_BROWSER_SEARCH
VK_BROWSER_FAVORITES
public static final int VK_BROWSER_FAVORITES
VK_BROWSER_HOME
public static final int VK_BROWSER_HOME
VK_VOLUME_MUTE
public static final int VK_VOLUME_MUTE
VK_VOLUME_DOWN
public static final int VK_VOLUME_DOWN
VK_VOLUME_UP
public static final int VK_VOLUME_UP
VK_MEDIA_NEXT_TRACK
public static final int VK_MEDIA_NEXT_TRACK
VK_MEDIA_PREV_TRACK
public static final int VK_MEDIA_PREV_TRACK
VK_MEDIA_STOP
public static final int VK_MEDIA_STOP
VK_MEDIA_PLAY_PAUSE
public static final int VK_MEDIA_PLAY_PAUSE
VK_LAUNCH_MAIL
public static final int VK_LAUNCH_MAIL
VK_LAUNCH_MEDIA_SELECT
public static final int VK_LAUNCH_MEDIA_SELECT
VK_LAUNCH_APP1
public static final int VK_LAUNCH_APP1
VK_LAUNCH_APP2
public static final int VK_LAUNCH_APP2
VK_OEM_1
public static final int VK_OEM_1
VK_OEM_PLUS
public static final int VK_OEM_PLUS
VK_OEM_COMMA
public static final int VK_OEM_COMMA
VK_OEM_MINUS
public static final int VK_OEM_MINUS
VK_OEM_PERIOD
public static final int VK_OEM_PERIOD
VK_OEM_2
public static final int VK_OEM_2
VK_OEM_3
public static final int VK_OEM_3
VK_OEM_4
public static final int VK_OEM_4
VK_OEM_5
public static final int VK_OEM_5
VK_OEM_6
public static final int VK_OEM_6
VK_OEM_7
public static final int VK_OEM_7
VK_OEM_8
public static final int VK_OEM_8
VK_OEM_102
public static final int VK_OEM_102
VK_PROCESSKEY
public static final int VK_PROCESSKEY
VK_PACKET
public static final int VK_PACKET
VK_ATTN
public static final int VK_ATTN
VK_CRSEL
public static final int VK_CRSEL
VK_EXSEL
public static final int VK_EXSEL
VK_EREOF
public static final int VK_EREOF
VK_PLAY
public static final int VK_PLAY
VK_ZOOM
public static final int VK_ZOOM
VK_NONAME
public static final int VK_NONAME
VK_PA1
public static final int VK_PA1
VK_OEM_CLEAR
public static final int VK_OEM_CLEAR
MSWindowsDisplayAgent
public MSWindowsDisplayAgent()
throws RemoteException,
MSWindowsDisplayException
setWindowSelectionMethod
public void setWindowSelectionMethod(int METHOD)
throws RemoteException
- Specified by:
- setWindowSelectionMethod in interface MSWindowsDisplay
enumerateWindows
public Vector enumerateWindows()
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- enumerateWindows in interface MSWindowsDisplay
windowContaining
public String windowContaining(String str)
throws RemoteException,
MSWindowsDisplayException
- Returns a window name containing a substring
- Specified by:
- windowContaining in interface MSWindowsDisplay
maximizeAndActivateWindow
public void maximizeAndActivateWindow(String w)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- maximizeAndActivateWindow in interface MSWindowsDisplay
hideWindow
public void hideWindow(String w)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- hideWindow in interface MSWindowsDisplay
minimizeWindow
public void minimizeWindow(String w)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- minimizeWindow in interface MSWindowsDisplay
restoreWindow
public void restoreWindow(String w)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- restoreWindow in interface MSWindowsDisplay
activateWindow
public void activateWindow(String w)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- activateWindow in interface MSWindowsDisplay
showWindowOperation
public void showWindowOperation(String w,
int cmd)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- showWindowOperation in interface MSWindowsDisplay
resizeWindow
public void resizeWindow(String w,
int x,
int y,
int width,
int height,
int placement,
int options)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- resizeWindow in interface MSWindowsDisplay
sendKeyPress
public void sendKeyPress(int key)
throws RemoteException
- Specified by:
- sendKeyPress in interface MSWindowsDisplay
sendModifiedKeyPress
public void sendModifiedKeyPress(int modifier,
int key)
throws RemoteException
- Specified by:
- sendModifiedKeyPress in interface MSWindowsDisplay
sendMetaKeyPress
public void sendMetaKeyPress(int key)
throws RemoteException
- Specified by:
- sendMetaKeyPress in interface MSWindowsDisplay
sendKeyToWindow
public void sendKeyToWindow(int key,
String name)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- sendKeyToWindow in interface MSWindowsDisplay
sendMetaKeyToWindow
public void sendMetaKeyToWindow(int key,
String name)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- sendMetaKeyToWindow in interface MSWindowsDisplay
sendModifiedKeyPressToWindow
public void sendModifiedKeyPressToWindow(int modifier,
int key,
String name)
throws RemoteException,
MSWindowsDisplayException
- Specified by:
- sendModifiedKeyPressToWindow in interface MSWindowsDisplay
runCommand
public void runCommand(String command)
throws RemoteException
- Run a command on behalf of the sending program (so controller
programs do not have to be tied to a particular machine)
- Specified by:
- runCommand in interface MSWindowsDisplay