Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > 'inst.PathName' is null or not an object error

Reply
Thread Tools

'inst.PathName' is null or not an object error

 
 
Black Baptist
Guest
Posts: n/a
 
      01-14-2005
Can anyone tell me why the following snippet of code gives the error
'inst.PathName' is null or not an object



//extract just the file name
var arrExe = inst.PathName.split("\\");
var stateval = GetPropValue(svcs, "State", State);
var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
oService.setValues(Name, arrExe[arrExe.length-1], stateval,
startmodeval);
 
Reply With Quote
 
 
 
 
SpaceGirl
Guest
Posts: n/a
 
      01-14-2005
Black Baptist wrote:
> Can anyone tell me why the following snippet of code gives the error
> 'inst.PathName' is null or not an object
>
>
>
> //extract just the file name
> var arrExe = inst.PathName.split("\\");
> var stateval = GetPropValue(svcs, "State", State);
> var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
> oService.setValues(Name, arrExe[arrExe.length-1], stateval,
> startmodeval);


It means "inst.PathName.split" is either empty or has not been defined.
You need to make sure the object has been created.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
Reply With Quote
 
 
 
 
Black Baptist
Guest
Posts: n/a
 
      01-14-2005
SpaceGirl rambled on in alt.html:

> Black Baptist wrote:
>> Can anyone tell me why the following snippet of code gives the error
>> 'inst.PathName' is null or not an object
>>
>>
>>
>> //extract just the file name
>> var arrExe = inst.PathName.split("\\");
>> var stateval = GetPropValue(svcs, "State", State);
>> var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
>> oService.setValues(Name, arrExe[arrExe.length-1], stateval,
>> startmodeval);

>
> It means "inst.PathName.split" is either empty or has not been defined.
> You need to make sure the object has been created.
>


And how would I do that?
 
Reply With Quote
 
SpaceGirl
Guest
Posts: n/a
 
      01-14-2005
Black Baptist wrote:
> SpaceGirl rambled on in alt.html:
>
>
>>Black Baptist wrote:
>>
>>>Can anyone tell me why the following snippet of code gives the error
>>>'inst.PathName' is null or not an object
>>>
>>>
>>>
>>>//extract just the file name
>>> var arrExe = inst.PathName.split("\\");
>>> var stateval = GetPropValue(svcs, "State", State);
>>> var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
>>> oService.setValues(Name, arrExe[arrExe.length-1], stateval,
>>> startmodeval);

>>
>>It means "inst.PathName.split" is either empty or has not been defined.
>>You need to make sure the object has been created.
>>

>
>
> And how would I do that?


No way of telling from that code snippit. Not enough information!

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      01-14-2005

"Black Baptist" <(E-Mail Removed)> wrote in message
news:Xns95DE9DFCEFF8praythechurchcom@Letuspray...
> Can anyone tell me why the following snippet of code gives the error
> 'inst.PathName' is null or not an object
>
>
>
> //extract just the file name
> var arrExe = inst.PathName.split("\\");
> var stateval = GetPropValue(svcs, "State", State);
> var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
> oService.setValues(Name, arrExe[arrExe.length-1], stateval,
> startmodeval);


Google has no knowledge of what "inst.pathname" refers so that would mean
you would have to create the items yourself.
You can have links[0].pathname and location.pathname, but "inst" is not
recognized unless you define it with a function.




 
Reply With Quote
 
Black Baptist
Guest
Posts: n/a
 
      01-14-2005
<html>
<head>
<Title>Advanced System Information - Services</Title>
<Script Language="JScript" Src="CommonFunc.js"></script>
<link rel="STYLESHEET" type="text/css"
href="hcp://system/css/shared.css">
<link rel="STYLESHEET" type="text/css" href="msinfohss.css">
<Script Language="JavaScript">
var remoteServer = null;

function OnLoadHandler() {
_body.style.cursor= "wait";
_body.scroll = "no";
DisplayLocStrings();
SetProgressBarImage();
window.setTimeout("LoadChores(0)", TIMEOUT);
}

function DisplayLocStrings() {
WaitMessage.innerHTML = MSG_WAIT;
Refresh.innerHTML = TAG_REFRESH;

with(Services.all) {
Caption.innerHTML = TAG_SERVICES;
Col1.innerHTML = TAG_SERVICE;
Col2.innerHTML = TAG_EXECUTABLE;
Col3.innerHTML = TAG_STATUS;
Col4.innerHTML = TAG_STARTUP;
}
}

var INCR_UNIT = 100;//move progress bar in increments of INCR_UNIT
function LoadChores(taskId) {
try {

switch(taskId)
{
case 0:
remoteServer = GetServerName();
Title.innerHTML = (remoteServer ? (TAG_REMOTEADVINFO + " \\\\" +
remoteServer) : TAG_LOCALADVINFO) + " - " + TAG_SERVICES;
break;

case 1:
DrawProgressBar(INCR_UNIT, TAG_SERVICES);
break;
case 2:
var oServices = new myServices;
oServices.show();
break;

default:
taskId = -1;
_header.style.display = "none";
_data.style.display = "";
_body.style.cursor= "default";
_body.scroll = "auto";
}

if(taskId >= 0)
window.setTimeout("LoadChores(" + ++taskId + ")", TIMEOUT);
}

catch (e) {
HandleErr(e);
}
}

function ShowDetail(tr) {
with (tr.all) {
var msg = name.innerHTML + "\r" + exe.innerHTML + "\r" +
state.innerHTML + "\r" + startMode.innerHTML;
if(pchealth)
pchealth.MessageBox(msg, "OK");
}
}

//traverse the list and invoke display on each item.
function displayTableSegment(outerDiv, head) {
var strMsg = "<table width=\"100%\" cellspacing=0 cellpadding=0><tr
class=\"sys-table-cell-bgcolor1 sys-font-body sys-color-body\"><td
align='left' style=\"padding : 0.5em;\">%arg1%</td></tr></table>";
var cnt = 1;
var strHTML = "";
var tableElement = null;
if (document.all[outerDiv].length == null)
tableElement = document.all[outerDiv];
else
tableElement = document.all[outerDiv][0];
if (head==null)
tableElement.outerHTML = strMsg.replace(/%arg1%/, TAG_NONE);
else
{
var curr = head;
while (curr!=null) {
if (document.all[outerDiv].length == null)
tableElement = document.all[outerDiv];
else
tableElement = document.all[outerDiv][0];

if (cnt%2 == 0) {
if (tableElement.all["tr_" + outerDiv])
tableElement.all["tr_" + outerDiv].className = "sys-table-cell-
bgcolor1";
cnt = 1;
}
else {
if (tableElement.all["tr_" + outerDiv])
tableElement.all["tr_" + outerDiv].className = "sys-table-cell-
bgcolor2";
cnt++;
}

curr.show(tableElement);
strHTML += tableElement.outerHTML;
curr = curr.getNext();
}

tableElement.outerHTML = strHTML;
}
}

//////////////////////
//MyService
function myServiceSetValues(name, exe, state, startMode) {
this.m_name = intelliBreak(name, " ", 10);
this.m_exe = intelliBreak(exe, " ", 10);;
this.m_state = state;
this.m_startMode = startMode;
}

function myServiceShow(tableElement) {
tableElement.all["name"].innerHTML = this.m_name;
tableElement.all["exe"].innerHTML = this.m_exe;
tableElement.all["state"].innerHTML = this.m_state;
tableElement.all["startMode"].innerHTML = this.m_startMode;
}

//constructor
function myService() {
this.m_name = null;
this.m_exe = null;
this.m_state = null;
this.m_startMode = null;
this.m_next = null;

this.getName = new Function("return this.m_name;");
this.setNext = new Function("ptr", "this.m_next = ptr;");
this.getNext = new Function("return this.m_next;");
this.setValues = myServiceSetValues;
this.show = myServiceShow;
}
//EO MyService
//////////////////////

//////////////////////
//MyServices
function myServicesShow() {
displayTableSegment("services", this.m_head);
}

//constructor
function myServices() {
this.m_head = null;

this.show = myServicesShow;

var loc = wbemlocator;
var svcs = loc.ConnectServer(remoteServer);
svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;

var strQuery = "Select * From Win32_Service";
var colItems = new Enumerator(svcs.ExecQuery(strQuery));
for(; !colItems.atEnd(); colItems.moveNext())
{
var inst = colItems.item();
var oService = new myService();
with (inst)
{
//extract just the file name
//var arrExe = inst.PathName.split("\\");
var stateval = GetPropValue(svcs, "State", State);
var startmodeval = GetPropValue(svcs, "StartMode", StartMode);
//oService.setValues(Name, arrExe[arrExe.length-1], stateval,
startmodeval);
}
oService.setNext(this.m_head); //add before
this.m_head = oService;
}
}
//EO MyServices
//////////////////////

</Script>
</head>
<body ID="_body" onLoad="OnLoadHandler()" STYLE="cursor: wait" class="sys-
font-body sys-color-body sys-rhp-bgcolor">

<Span ID="Title" align="left" class="sys-font-heading3 sys-rhp-color-
title">&nbsp;</Span>

<DIV ID="_header">
<table width="100%" cellspacing="0" cellpadding="0" class="sys-font-body
sys-color-body" style="padding : 0.5em 0.5em 0.5em 0em;">
<tr>
<td>
&nbsp;
</td>
</tr>

<tr>
<td ID="WaitMessage" ALIGN="left" VALIGN=top class="sys-font-body-bold
sys-color-body">
&nbsp;
</td>
</tr>

<tr>
<td>

<table ID="Progress" border=0 cellspacing="0" cellpadding="0">
<tr>
<td rowspan="3"><img ID="ImgProgLeft" src="Graphics/r1_c1.gif"
width="4px" height="18px" border="0"></td>
<td><img src="graphics\r1_c2.gif" width="352px" height="3px"
border="0"></td>
<td rowspan="3"><img ID="ImgProgRight" src="Graphics/r1_c3.gif"
width="3px" height="18px" border="0"></td>
</tr>

<tr>
<td valign="center"><img width="8px" height="12px" id="Bar"
src="Graphics/greendot.jpg"></td>
</tr>

<tr>
<td><img src="Graphics/r3_c2.gif" width="352px" height="3px"
border="0"></td>
</tr>
</table>

</td>
</tr>

<tr>
<td>
<Span ID="StatusPerCent" align="left" VALIGN=top width="5%"></Span>
&nbsp;
<Span ID="StatusMsg" align="left" VALIGN=top></Span>
</td>
</tr>
</table>
</DIV>

<DIV ID="_data" STYLE="DISPLAY: none">
<table width="100%" class="table-noborder sys-table-color-border"
cellspacing="0" cellpadding="0">
<tr>
<td valign=top colspan="2">
<table width="100%" cellspacing="0" cellpadding="0" class="sys-font-
body sys-color-body">
<tr>
<td align="left" valign="bottom">
<A class="sys-link-normal" ID="Refresh" href="#"
onclick="window.location.reload()">refresh</a>
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td>&nbsp;
</td>
</tr>

<tr>
<td width="100%" valign=top>
<table ID="Services" width="100%" class="table-border sys-table-color-
border sys-font-body sys-color-body" cellspacing="0" cellpadding="0">
<th valign="top" align="left" class="sys-table-header-bgcolor1 sys-
toppane-header-color" style="padding : 0.5em;">
<IMG height=16 src="Graphics/system.GIF" width=16 border=0
align="absmiddle">
<span ID="Caption">&nbsp;</span>
</th>
<tr>
<td valign="top">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan=4>

<table width="100%" cellspacing="0" cellpadding="0" class="sys-
font-body sys-color-body">
<tr class="sys-table-cell-bgcolor1">
<td ID="Col1" width="30%" align="left" valign="top" class="sys-
font-body-bold table-rightborder table-bottomborder sys-table-color-
border" style="padding : 0.5em;">&nbsp;</td>
<td ID="Col2" width="23%" align="left" valign="top" class="sys-
font-body-bold table-rightborder table-bottomborder sys-table-color-
border" style="padding : 0.5em;">&nbsp;</td>
<td ID="Col3" width="17%" align="left" valign="top" class="sys-
font-body-bold table-rightborder table-bottomborder sys-table-color-
border" style="padding : 0.5em;">&nbsp;</td>
<td ID="Col4" width="20%" align="left" valign="top" class="sys-
font-body-bold table-bottomborder sys-table-color-border" style="padding :
0.5em;">&nbsp;</td>
</tr>
</table>

<table ID="services" width="100%" cellspacing="0"
cellpadding="0" class="sys-font-body sys-color-body">
<tr ondblclick="ShowDetail(this)" ID="tr_services">
<td ID="name" width="30%" align="left" valign="top"
class="table-rightborder sys-table-color-border" style="padding : 0.5em;">
&nbsp;</td>
<td ID="exe" width="23%" align="left" valign="top"
class="table-rightborder sys-table-color-border" style="padding : 0.5em;">
&nbsp;</td>
<td ID="state" width="17%" align="left" valign="top"
class="table-rightborder sys-table-color-border" style="padding : 0.5em;">
&nbsp;</td>
<td ID="startMode" width="20%" align="left" valign="top"
style="padding : 0.5em;">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>

</table>

</DIV>

<OBJECT ID="wbemlocator" WIDTH=0 HEIGHT=0
CLASSID="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6">
</OBJECT>

<OBJECT ID="pchealth" WIDTH=0 HEIGHT=0
CLASSID="CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7">
</OBJECT>

</body>
</html>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPX page jscript rt error: null is null or not an object Cirene ASP .Net 1 06-09-2008 07:59 PM
XMLHTTP - null is null or not an object Tim Platt Javascript 0 06-04-2007 08:42 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
IE SP2 solution for "null is null or not an object" and "broken" insertCell/insertRow putty Javascript 1 04-05-2005 07:11 PM
Slide Show Object: Null or Not An Object Error Jason Ferguson Javascript 0 02-19-2004 07:11 PM



Advertisments