Populating Custom Properties from a text file

(imported topic written by SystemAdmin)

We have a requirement to create some custom properties for inventory purposes. I know I can add fields to the database. We would like to scan a .mif file that is created in the root of the C drive and use the values in there to update the machine information. What is the correct syntax to do this? Below is a sample of the file contents:

=========================================================================

START GROUP

NAME = “NHHN_INFO”

ID = 1

CLASS = “NHHN_INFO”

DESCRIPTION = “NHHN custom computer information”

START ATTRIBUTE

NAME = “CHANGE_TIME”

ID = 1

ACCESS = READ-ONLY

Type = STRING(16)

VALUE = “2011/05/30-14:32”

END ATTRIBUTE

START ATTRIBUTE

NAME = “CHANGE_TYPE”

ID = 2

ACCESS = READ-ONLY

Type = STRING(20)

VALUE = “New”

END ATTRIBUTE

START ATTRIBUTE

NAME = “TEAM”

ID = 3

ACCESS = READ-ONLY

Type = STRING(2)

VALUE = " "

END ATTRIBUTE

START ATTRIBUTE

NAME = “ADMIN”

ID = 4

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “kjavorsk”

END ATTRIBUTE

START ATTRIBUTE

NAME = “BUILDING”

ID = 5

ACCESS = READ-ONLY

Type = STRING(64)

VALUE = “Business Center”

END ATTRIBUTE

START ATTRIBUTE

NAME = “FLOOR”

ID = 6

ACCESS = READ-ONLY

Type = STRING(2)

VALUE = “2”

END ATTRIBUTE

START ATTRIBUTE

NAME = “IDF”

ID = 7

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “NH-17thst-H&D”

END ATTRIBUTE

START ATTRIBUTE

NAME = “DATA_PORT”

ID = 8

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “PORT_CONFIRMED”

ID = 9

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “Confirmed”

END ATTRIBUTE

START ATTRIBUTE

NAME = “DEPARTMENT”

ID = 10

ACCESS = READ-ONLY

Type = STRING(64)

VALUE = “9420”

END ATTRIBUTE

START ATTRIBUTE

NAME = “PC_ASSET_ID”

ID = 11

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “isd03800”

END ATTRIBUTE

START ATTRIBUTE

NAME = “NEAREST_PHONE_EXT”

ID = 12

ACCESS = READ-ONLY

Type = STRING(8)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “PRIMARY_USER”

ID = 13

ACCESS = READ-ONLY

Type = STRING(64)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “PRIMARY_USER_TYPE”

ID = 14

ACCESS = READ-ONLY

Type = STRING(20)

VALUE = “IS”

END ATTRIBUTE

START ATTRIBUTE

NAME = “MON_SER”

ID = 15

ACCESS = READ-ONLY

Type = STRING(32)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “MON_TYPE”

ID = 16

ACCESS = READ-ONLY

Type = STRING(32)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “MON_ASSET_ID”

ID = 17

ACCESS = READ-ONLY

Type = STRING(10)

VALUE = “na”

END ATTRIBUTE

START ATTRIBUTE

NAME = “NOTES”

ID = 18

ACCESS = READ-ONLY

Type = STRING(256)

VALUE = “na”

END ATTRIBUTE

END GROUP

END COMPONENT

=================================================================

Thanks,

Mooney

(imported comment written by SystemAdmin)

There are at least a few ways to do this (e.g., action script to grab lines and store in registry, run vbs/perl script to parse the data and store in slightly simpler format (csv, xml, etc.) to be pulled by relevance elsewhere, or use relevance to pull the data directly). I’m going to give you an example for the third option.

preceding text of first “%22” of following text of first " = %22" of line ((line number of line whose(it contains “NAME = %22CHANGE_TYPE%22”) of file “c:\temp\mif\nhhn_info.mif”)+4) of file “c:\temp\mif\nhhn_info.mif”

(This code assumes the format and line order is fixed/controlled, otherwise you’re going to have issues.)

And you’d probably want to add at least one IF statement around it to validate the existence of the file, a matching Name entry and a valid Value, but this should give you something to work from.

-Jim

(imported comment written by SystemAdmin)

Jim, This worked perfectly. It’s exactly what we wanted. THANKS!!! :smiley: