VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Custom IE Dialog - Session List (

dluther 02-19-2013 06:41 PM

Custom IE Dialog - Session List
2 Attachment(s)
Hi everyone,

I created a custom IE dialog to address the lack of a "session list" when using tabbed sessions in a single window. It uses the "InternetExplorer.Application" object and some interesting DHTML/Styles/embedded icons to display a list of sessions you can select -- kind of an object lesson (no pun intended) in DHTML development and SecureCRT scripting for myself.

I'm attaching the current VBS code and the image, just in case the embedded image doesn't work to this message -- just remove the ".txt" extension. Use it, play with it, make improvements and suggestions...

Many thanks to Mike at VanDyke Software for his prompt e-mail assistance and gentle guidance -- often when normal people are counting sheep.

Here's a screen shot:

dluther 02-20-2013 07:12 PM

BTW, There are a couple of properties you can use to set the window location to open the IE object at a specific location:



I think I'm close to figuring a way to get the screen XY coordinates of the main window -- just a bit more research into the inner workings of Windows, but I think it may be around this code:


set objWMIService = GetObject( "winmgmts://./root/cimv2" )
set colItems = objWMIService.ExecQuery( "Select * from Win32_Process where Name='SecureCRT.exe'", , 48 )

i = 1
for each objItem in colItems
    pStr = pStr + (CStr(i) & ": " & objItem.Caption & vbTab & objItem.ExecutablePath & VbCrLf)
    i = i + 1

    j = 1
    for each objProperty in objItem.Properties_
      pStr = pStr + ("  " & CStr(j) & ": " & objProperty.Name & ": " & objProperty.Value & VbCrLf)
      j = j + 1
' You can figure out what to do with "pStr"

Anyway, the "Handle" (and "ProcessID") should yield another object that I can query for the XY coordinates of the main SecureCRT window -- I just haven't found it. Yet.

From there, I should be able to adjust the coordinates to place the window somewhere inside the main window.

miked 02-25-2013 09:33 AM

Here are a couple other approaches to finding SecureCRT's window position, in lieu of having a CRT object method or property: parse part of SecureCRT's Global.ini file, use AutoIT or similar third party application.

In the SecureCRT configuration folder you'll find a file named Global.ini. The following two lines in Global.ini show the last saved SecureCRT window position:
D:"X Position"=000000a9
D:"Y Position"=00000063

When you start SecureCRT, the X and Y positions will be accurate. If you start SecureCRT then move the window, it gets a little more complicated (still do-able). You'd need to save SecureCRT's settings to update the position within Global.ini before parsing out the variables/values needed. If you don't actually want to change settings you could backup the Global.ini to a different name, save SecureCRT settings, extract the X and Y position, then restore the Global.ini.

Alternatively, AutoIT and similar third party programs have functions which help you extract the window position. If you're comfortable installing a third party application, or already use AutoIT, then this approach may be worthwhile.

All times are GMT -6. The time now is 09:04 PM.