Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Verify if notepad is open
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi

I tried to write this code but it did not work.can someone please suggest me howto verify a notepad is open and if Yes then close?

'Close notepad if it is open
Code:
If Window("regexpwndtitle:=Notepad","regexpwndclass:=Notepad","is owned window:=False","is child window:=False").Exists Then
Window("regexpwndtitle:=Notepad","regexpwndclass:=Notepad","is owned window:=False","is child window:=False").Close
End If
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
SystemUtil.CloseProcessByName("notepad.exe")

This will close all the opened notepads.
Thanks,
SUpputuri
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
hi,

your code is correct.probably you might have kept opened multiple notepads.

Regards
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Above code is only to close one notepad. If their are more than one notepad to be closed then try with this code:


Code:
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = notepad
“)
For Each objProcess in colProcess
objProcess.Terminate()
Next
Regards,
Seema Gupta
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Fifth word from every thousand line in notepad files. sallu.iet@gmail.com 0 931 01-17-2020, 09:58 AM
Last Post: sallu.iet@gmail.com
  [UFT] [WPF] Verify if the cell contains an image robertosalemi 0 1,896 10-25-2016, 06:57 PM
Last Post: robertosalemi
  Need to verify the drop down values based on condition santhoshmscsoftware 1 2,905 05-04-2016, 11:28 PM
Last Post: supputuri
  verify that parent properties match object currently displayed in your application. sona 0 3,133 02-21-2016, 12:00 PM
Last Post: sona
Exclamation How to verify whether pdf is completely loaded or not in webpage nmakkena 1 2,671 08-27-2014, 04:09 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)