Jump to content

Write File & Name resolution:


zuk
 Share

Recommended Posts

Hello all !!

I need 2 things that I'm not able to find myself ( :"> ),

- If possible, to resolve name from IP addresses

- But essentially, to write data at a specific line (I know how to do with filewritetoline...) AND at a specific place (NOT the beginning of the line).

For exemple, the file I need to fill in (from Ms software inventory analyser):

---------

[MSIA]

MODE=1

OutputLocation=C:\Program Files\Microsoft Software Inventory Analyzer\Reports

Consolidate=1

HtmlFormat=1

XlsFormat=0

TextFormat=0

DomainList=

MachineList= <- Here's where I want to write, after the "="

ProductList=(software names)

AuditMachineList=(my pc);

EmailSummaryReport=0

EmailIDs=

---------

So here's my biggest pb: When I try to write here, I'm overwriting the "MachineList=", and each IP address is written and written here... Not one after the other... :ph34r:

My test code:

------------------------------------

#include <File.au3>

$IPR_SCY_128 = "163.157.128."

$MSIA_File = "C:\Program Files\Microsoft Software Inventory Analyzer\Msia.cli"

$IPEND1 = "255"

$i = 1

Do

Ping(($IPR_SCY_128 & $i),100)

If @error = 0 Then

_FileWritetoline($MSIA_File, 9, $IPR_SCY_128 & $i & ";", 1)

$i = $i + 1

Else

$i = $i + 1

EndIf

Until $i = $IPEND1

$i = 1

------------------------------------

I'm able to write a file with all pinging IP addresses, but not in this file, where I want, queued and separated with ";".

And, if it's easily possible, I would like to put names instead of IP. But it's not imperative.

So if anybody can help me out... That will be cOOl :lmao:

(I did not find ideas in the forum, maybe I did not use appropriate search sentence, I'm not english !)

Cheers

Link to comment
Share on other sites

  • Moderators

Looks like you are using an .ini, why not use the IniRead*/ IniWrite() functions in the help file?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Looks like you are using an .ini, why not use the IniRead*/ IniWrite() functions in the help file?

Thx for your answer,

In fact this is an "Msia.cli" file, which is similar to a txt file.

So is this possible to use "Ini" functions with that ??

Link to comment
Share on other sites

  • Moderators

Thx for your answer,

In fact this is an "Msia.cli" file, which is similar to a txt file.

So is this possible to use "Ini" functions with that ??

I'd bet if you gave it a whirl, you might be suprised :lmao: .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'd bet if you gave it a whirl, you might be suprised :) .

Hum not sure to understand :lmao:

But I've tried, and unfortunately now I got this with that code:

#include <File.au3>

$IPR_SCY_128 = "xxx.128."

$IPEND1 = "255"

$i = 1

$MSIA_File = "C:\Program Files\Microsoft Software Inventory Analyzer\Msia.cli"

Do

Ping(($IPR_SCY_128 & $i),100)

If @error = 0 Then

;_FileWritetoline($MSIA_File, 9, $IPR_SCY_128 & $i & ";", 1)

IniWrite($MSIA_File, "", "MachineList=", $IPR_SCY_128 & $i & ";")

$i = $i + 1

Else

$i = $i + 1

EndIf

Until $i = $IPEND1

$i = 1

------------

[MSIA]

MODE=1

OutputLocation=C:\Program Files\Microsoft Software Inventory Analyzer\Reports

Consolidate=1

HtmlFormat=1

XlsFormat=0

TextFormat=0

DomainList=

MachineList=

ProductList=(softwares)

AuditMachineList=(mypc);

EmailSummaryReport=0

EmailIDs=

[]

MachineList==xx.128.1; <- MY RESULT :geek:

MachineList==xxx.128.3;

...

------------

Well, it's NOT OK yet :ph34r:

Edited by zuk
Link to comment
Share on other sites

Well I'm still a nOOb !

To bypass my first pb, I'm now writing another file: OK, I got all my required data (IP).

Now I'm trying to copy all files from "ping_ok.txt" to any other file... And I don't how to do !! :">

FileWrite/Filecopy...

Exemple:

Here's the file formated as I wish:

163.157.128.1;163.157.128.3;163.157.128.4;163.157.128.16;... ... ...

I want to add this in this file, at this line:

[MSIA]

MODE=1

OutputLocation=C:\Program Files\Microsoft Software Inventory Analyzer\Reports

Consolidate=1

HtmlFormat=1

XlsFormat=0

TextFormat=0

DomainList=

MachineList=<- I WANT TO COPY HERE

ProductList=(softwares)

AuditMachineList=(my pc);

EmailSummaryReport=0

EmailIDs=

---

Can somebody tell me how copy the data (and just the datas) from the file up to the 2nd file ??

Thx per advance, and excuse my "nOOb-ility" :lmao:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...