attachlist_gridview new_gridview

attach_gridview_by_name


The attach_gridview_by_name function attaches a grid window on the desktop to a CGridView object by matching the grid window's title. The new CGridView object is returned. This is a global function that is not a member of the CGridView class.

This function is useful for directly selecting a grid window from the Mira desktop without pausing the script to select it from a list. For example, the script might attach a grid window you created with a known title or a window that was created in a previous script. The window title can be saved and retrieved using a text file or the Windows Registry using the CRegistry class.

Syntax

CGridView = attach_gridview_by_name( sTitle )

bullet.gif    sTitle is the target window title.

bullet.gif    On success, a new CGridView object is returned.

bullet.gif    On failure, nil is returned.

Example

The following script attaches a grid window that was created by a previous script. The window title (name) was previously saved to the Windows Registry but the window remains on the Mira desktop. The Grid Window was saved under the key "grid window title". A new CGridView object is returned if the grid window exists.

R = new_registry("grid stuff")

-- open the registry key "grid stuff"

sTitle = R.GetStr("grid window title", "No Title")

-- get name of saved window, default: "No Title"

V = attach_gridview_by_name( sTitle )

-- attach the named grid window

if V ~= nil then

-- if window was attached...

  Printf("Window named '%s': %p\n", sTitle, V )

-- print a success message

else

 

  Printf("Window not found\n")

 

end

 

Related Topics

CGridView class

CRegistry class

attachlist_gridview

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.