Jump to content

General advice needed from a newbie


Recommended Posts

Hi guys hope you are all well and can help.

Guys hopefully you can clarify if what Im needing here is to understand more about the following"

...What constitutes multi-dimensional arrays versus single arrays .

...How you get different data appearing on the same line in a delimited format as opposed to starting a new line.

Im not entirely sure, but ill try and explain what im trying to do and hopefully you kind gurus will shed light on what you do in similar circumstances.

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

Scenario 1: Gettting a file list

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

Let's say I want to get a list of files from a folder and do the same thing...write this information to a file, so it looks like below:

============================= data.txt

d:\test\file1.txt

d:\test\file2.txt

d:\test\file3.txt

How would you write that information so that each new entry, was actually on the same line, so it would look like below:

============================= data.txt

d:\test\file1.txt, d:\test\file2.txt, d:\test\file3.txt

Also, would this be called on 1 dimensional array, since we are only talking about the "dimension" - filelist?

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

Scenario 2: Gettting cpu, memory etc in a list

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

Let's say I want to audit a machine, and get information about cpu, memory, etc, and write this information to a file.

Instead of each type of data eg.cpu, memory, appearing on its own line, I wanted that data to appear comma-delimited on a single line, so maybe something like below:

============================= data.txt

cpu, 2GHz, memory, 1024MB

Sorry if im a bit vague here, and probably asking more than one question in the same one.

Im trying to understand moreso, how you typically build or format data into a text file when you are talking about multiple types of information.

I know this would vary for what your end goal is, but any help or examples would be of great help to myself and greatly appreciated.

Link to comment
Share on other sites

As for scenario #2, how about something like this:

#Include <WinAPI.au3>
$cpu = @CPUArch
$CPUSpeed = RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz")
$CPUSpeed = StringLeft($CPUSpeed, 3)
$CPUSpeed = Round($CPUSpeed, 2) / 100
$Memory = MemGetStats()
$Memory = StringLeft ($Memory[1], 3)
$Memory = Round($Memory, 2) / 100

MsgBox(0, "", "CPU = " & $cpu & " Architecture" & " / " & $CPUSpeed & " GHz" & " / " & $Memory & " Gigs of RAM")

#include <ByteMe.au3>

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...