Micro Focus QTP (UFT) Forums
Create Terminal as object - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Create Terminal as object (/Thread-Create-Terminal-as-object)



Create Terminal as object - dapeamel - 02-16-2018

Hello everyone,

I am very new to UFT,

I did read the thread

https://www.learnqtp.com/forums/Thread-help-about-CreateObject

I am currently is doing automation for MainFrame also Terminal emulation.

now is my question how do I create an object of the Terminal?

Path to exe file
"C:\Program Files (x86)\IBM\Personal Communications\"

this is my atempt below:


Code:
Public Sub CreateTerminal()
    
    
Function Terminal()
    
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTeOptions 'As QuickTest.TeOptions ' Declare the TE Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.SetActiveAddins Array("TeWindow") ' Activate the Terminal Emulator Add-in
qtApp.Launch ' Start UFT
qtApp.Visible = True ' Make the UFT application visible
Set qtTeOptions = qtApp.Options.TE ' Return the TE Options object

' Configure the Terminal Emulator options

' Set global Terminal Emulator options (apply to all emulators)

qtTeOptions.ScreenTitleRow = 1 ' Set the screen title location
qtTeOptions.ScreenTitleCol = 1
qtTeOptions.ScreenTitleLength = 30

qtTeOptions.AutoAdvance = False ' Specifies that the emulator does not support auto-advance fields
qtTeOptions.AutoSyncKeys = "13" ' Record a Sync step each time the Enter key is pressed while recording the test
qtTeOptions.RecordMenusAndPopups = True 'Enable recording of emulator popups and menus
qtTeOptions.RecordCursorPosition = True 'Record cursor position steps
qtTeOptions.UsePropertyPattern = True ' Use default property pattern file
qtTeOptions.PropertyPatternsFile = "C:\Program Files\HPE Software\Unified Functional Testing\Dat\PropertyPatternConfigTE.xml"

' Specify the current emulator
qtTeOptions.CurrentEmulator = "IBM Pcom" ' Set the current emulator as Host On-Demand 8.0

' Set options that are specific to the current emulator
qtTeOptions.Protocol = "autodetect" 'Let UFT detect the session protocol
qtTeOptions.BlankLines = 0 ' No blank lines at the bottom of the emulator window.
qtTeOptions.CodePage = 0 ' Use the default code page conversion
qtTeOptions.HllapiDllName = "C:\Program Files\IBM\EHLLAPI\pcshll32.dll" ' Specify the HLLAPI dll to use
qtTeOptions.HllapiProcName = "hllapi" ' Specify the HLLAPI function to use
qtTeOptions.VerifyHllapiDllPath = True ' Display a warning message if the HLLAPI dll is not found
qtTeOptions.ScreenLabelUseAllChars = True ' Use protected and unprotected fields to identify the screen label.
qtTeOptions.WindowTitlePrefix = "MyTerminal" ' Identify the terminal window based on its window title prefix.
qtTeOptions.TrailingMode = True ' Trim white characters when recording in context-sensitive mode
qtTeOptions.TrailingFieldLength = 5 ' if the field begins with more than five black characters.
qtTeOptions.BeepOnSync = False ' Do not beep after each Sync step.
qtTeOptions.UseKeyEvent "@R", "17;52" ' Replay the TE_RESET key using the CTRL+R keyboard event.
qtTeOptions.SyncTime = 200 ' Wait 200 milliseconds before checking the emulator status

' Clean up
Set qtTeOptions = Nothing ' Release the TE Options object ' Release the Te Options object
Set qtApp = Nothing ' Release the Application object ' Release the Application object



End Function

End Sub


now is my question do I make the object visible also called from another function in another sub function?

Thank you in advance