kkyy Super Contributor.
Super Contributor.
192 views

how to close exe execution windows and copy text content

Hi All,

I am executing the below command to execute the Test.exe in Silk Test classic scripts.

MainWin().Start ("C:\temp\Test.exe")

I am wondering how I can do the following.

1) How to close the execution window after the execution is done?

2) How to copy the print out message in the execution windows and save to a String variable.

I tried the below command for this purpose, but doesn't seem working for me.

SYS_Execute("start C:\temp\Test.exe", lsDirOut, EM_WAIT_UNTIL_FINISHED)

Thank you for any idea!

 

Tags (1)
0 Likes
1 Reply
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: how to close exe execution windows and copy text content

Hi Kkyy,

1) How to close the execution window after the execution is done?

You could try calling the Close() method against the application window to close it. e.g

UntitledNotepad.Close()

2) How to copy the print out message in the execution windows and save to a String variable.

You may be able to use the TextCapture() method to copy any text present on the windows, and save it to a String variable. e.g

String output = MyApp.TextCapture()

Print(output)

If TextCapture() fails to return the expected output, you may need to use Typekeys to highlight all of the text on the window, copy it to the clipboard; and then assign the contents of the clipboard to a List of String. e.g

[ ] UntitledNotepad.TextField.TypeKeys("Testing..Testing..1..2..3..")
[ ] UntitledNotepad.TextField.SetPosition(1, 9)
[ ] UntitledNotepad.TypeKeys("<Left Ctrl+a>")
[ ] UntitledNotepad.TypeKeys("<Left Ctrl+c>")
[ ] List of String output = Clipboard.GetText()
[ ]
[ ] Print(output)

Output:

[-] Testcase Test1 - Passed
[ ] {Testing..Testing..1..2..3..}

 

Thanks & Regards...

JohnM.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.