PDA

View Full Version : Project Method Help



AaronCooper
12-18-2004, 08:32 PM
I have a project where I need Autoplay to read the computers MAC address and then change various setting depending on what it's MAC address is.

Example: What I am hoping to do:

I have a list of 100+ machine and their MAC address:
Have Autoplay read a (text, other file) to do a IF (MAC) then (Values to pass back to Autoplay or LIST of actions {future EXE to run}). I would like Autoplay to be able to read the MAC address and list of thing to do or change from a TEXT file or some other file so that I can change the ONE file, rather than editing the Autoplay core Application each time I add a Computer or change a NIC card.

More info:

The basic things I wish to Change are thing in the Computer Name (via reg edit), A few Text files that are used to report reboot notices to me, even possible NIC setting as DNS or WINS setting may change.

I do not use Autoplay on a daily or weekly time frame so it is harder for me to invision the best method to do this.

I have been able to do what I want by have a LONG list of IF-THEN one for each MAC, but this requires editing the APP each time I add a computer that I support.

Thanks in Advance

Please reply to both me and the list

Stefan_M
12-19-2004, 01:40 AM
A simple way is to work with an INI File like

[MAC-Adress1]
PC_NAME

[MAC-Adress2]
PC_NAME

read all sections with [table]INIFile.GetSectionNames
Then use your if condition inside a for loop


Stefan_M

TJ_Tigger
12-19-2004, 08:16 AM
I was thinking something similar to what StefanM suggested. I was thinking of a SQLite database to store information with a key that would equal the MAC address of the PCs that you wanted to change.

Then you could search the db to find the MAC Address and if there was something in the db then you could perform your actions. Check to see if there were values in the different columns and if so then perform some specific action.

Have a table like this
MAC Change1 Change2 Change3 Change4
123456789 pcname1 another change anotherchange NULL
234567890 pcname2 anotherchange NULL NULL


Same concept can be done with the INI as Stefan suggested.

Get all the section names, use a for loop to traverse the table comparing each section name to your MAC address. If a match is found then get the value names where each value name performs a certain action. Then again use a for loop to enumerate the table of value names and perform the selected actions.

That would be fun to build.

AaronCooper
12-20-2004, 08:04 AM
Thanks for the suggestions, I will read up on on that, do u know of any examples. Like many people I can see the idea MUCH clearer with a working model.

Once again thanks for the response.

Stefan_M
12-20-2004, 02:36 PM
This project reads all sections and create files on the desktop depending on the defined values.

Stefan_M

TJ_Tigger
12-20-2004, 05:20 PM
Here was my stab at it. It also includes a function to setwallpaper that includes registry interaction and use of a dll. It also includes Original TJ_Tigger photography of the Scott Monument in Edinburg, Scotland. I tried to automate some aspects of the tool so it will read your MAC and put it into the INI file automatically for you. Just select an image on the right and click Test to have it do its thing. On the Test button you will see that it is similar to what StefanM did in that it reads in the section names and compares that with the MAC of the system. If there is a match it executes the code to get all the Value Names and compares those Value Names to a list of words and when there is a match it executes the code to do your update. So this project will change your wallpaper and display your PCName. There is a Restore button that will restore your wallpaper to it's original config.

HTH
Let me know if there are questions
Tigg

With my images in the folder it is too large to upload. Here is a link

ACINI.apz (http://s94928149.onlinehome.us/pub/ACINI.apz)

AaronCooper
12-20-2004, 09:02 PM
Thanks to BOTH of you, the examples help a great deal.

One of the things I am thinking of changing is the background, Thanks Tigger

TJ_Tigger
12-20-2004, 10:21 PM
Not a problem, hope it is of some help. The wallpaper was the quickest thing I could think of since the function already existed in another project.

Tigg