Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot identify Object "Notepad" error
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi,

I have a script where I'll have to read a value from the opened notepad, but I get error "Coonot Identify the Object "Notepad(of class window).Verify that this objects properties match an object currently displayed in your application.
I tried to use Descriptive Programming for the notepad, that did not work as well.
Strange thing is same exact code works with no issues on one machine but not on this one.
Can someone please share their experience if they faced this issue or any ideas to resolve it?I appreciate any help!
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi Bostonma,
Check this out:
Code:
Option Explicit

Const conForReading = 1

'Declare variables
Dim objFSO, objReadFile, contents

'Set Objects    
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile("C:\Temp\TextToRead.txt", 1, False)

'Read file contents
contents = objReadFile.ReadAll

'Close file
objReadFile.close

'Display results
wscript.echo contents

'Cleanup objects
Set objFSO = Nothing
Set objReadFile = Nothing

'Quit script
WScript.Quit()
Reply
#3
Solved: 10 Years, 8 Months, 4 Weeks ago
@Manish - I think the requirement in original query is bit different than the solution you provided for.
I think bostanma wants it from an opened Notepad and getting error for Window object. (May be this is what Bostanma wants to do here, lets confirm it) also in the code 'wscript' object has not been initiated anywhere, you can not use the code in QTP.

@Bostanma, - Manish has provided is an alternate way to read a text file, if this is not that what you are looking for, Please paste your lines of Code here, so that I can understand what actually you are trying to do.

Reply
#4
Solved: 10 Years, 8 Months, 4 Weeks ago
Yes Saket,
Sorry I missed to change wscript.echo to msgbox and remove WScript.Quit()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  not able to identify an webelement object Ninjukp 0 2,101 01-10-2018, 09:25 PM
Last Post: Ninjukp
  General Object Error(Find Object Error) akhandesh 1 3,412 02-24-2016, 01:05 PM
Last Post: sindhus
  Not Able to Identify Object during Recovery Scenario Phani 2 3,095 01-25-2016, 01:26 PM
Last Post: arunshuklainbox
  UFT 12.02 Compatibility for IE 11.0 : Fail to identify the defined Object Amruta_121 9 10,487 01-11-2016, 12:45 PM
Last Post: vinod123
  Can not identify this object. Please help. axn700 3 2,960 10-31-2015, 10:59 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)