attachlist_textview new_textview

attach_textview_by_name


The attach_textview_by_name function attaches a text window from the Mira desktop to a CTextView object by matching the text window's title. The new CTextView object is returned. This is a global function that is not a member of the CTextView class.

This function is useful for directly selecting a text window from the Mira desktop without pausing the script to select it from a list. For example, the script might attach a text 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

CTextView = attach_textview_by_name( sTitle )

bullet.gif    sTitle is the target window title.

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

bullet.gif    On failure, nil is returned.

Example

The following script attaches a text window using a target name obtained from the Windows Registry. This name was previous saved under the key "text window title" after using the CTextView:SetTitle method to create a unique name. A new CTextView object is returned if the text window exists.

R = new_registry("text stuff")

-- open the registry key "text stuff"

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

-- return a window title previously saved

V = attach_textview_by_name( sTitle )

-- attach the named text 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

CTextView class

GetTitle

SetTItle

CRegistry class

attachlist_textview

 

 


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