Please correct this script to call xml element

Hi all

How to fix this script for 'lev1sec1' calls 'H1' in the paragraph style, and "lev2sec1" must call "H2".

Issue 1:

This is the code: this works very well for xml file below.

var myDocument = app.documents.item(0);
    var myPage = myDocument.pages.item(0);
  //Create a tag to style mapping.
  myDocument.xmlImportMaps.add(myDocument.xmlTags.item("heading_1"), myDocument.paragraphStyles.item("H1"));
  myDocument.xmlImportMaps.add(myDocument.xmlTags.item("heading_2"), myDocument.paragraphStyles.item("H2"));
  myDocument.xmlImportMaps.add(myDocument.xmlTags.item("para_1"), myDocument.paragraphStyles.item("TXF"));
  myDocument.xmlImportMaps.add(myDocument.xmlTags.item("body_text"), myDocument.paragraphStyles.item("TX"));
  //Map the XML tags to the defined styles.
  myDocument.mapXMLTagsToStyles();

3.png

2nd question:

Another xml file has different coding as below, but its presentation as below, lev1 (H1) and lev2 (H2) all have two same < title > tag, how do I set '< id article = "ch01lev1sec1" > < title >' for H1, < id article = "ch01lev2sec1" > < title > H2. For your reference, I enclose below the snapshot.

4.png

2.png1.png

Please help with this problem.

by

hasvi

Hasvi,

Try this.

#include "glue code.jsx";
var doc = app.activeDocument,
    ruleSet = new Array (new AddReturns);
__processRuleSet(doc.xmlElements.item(0), ruleSet);
function AddReturns()
{
    this.name = "MapStyles";
    this.xpath = "//section[@id]";
    this.apply = function(element)
    {
        if(element.xmlAttributes.itemByName("id").value === 'ch01lev1sec1')
        {
                element.applyParagraphStyle('H1')
            }
        if(element.xmlAttributes.itemByName("id").value === 'ch01lev2sec1')
        {
                element.applyParagraphStyle('H2')
            }
        }
    }

Kind regards

Cognet

Tags: InDesign

Similar Questions

  • Please correct my script setting of hyphenation

    Hello

    1. I want to put the break = false for all title levels, level CAP details saved in .txt file format. For example 'title detail.txt' has the heading level paragraph style names: H1, H2, BT, CT, CN.
    2. Otherwise if the hyphenation = true in the styles of normal paragraph (such as TX, EXT) I have to change the setting of the hyphenation. This one I also finished as the script below

    app.activeDocument.paragraphStyles.everyItem () = {} .properties

    hyphenateWordsLongerThan:6,

    hyphenateAfterFirst:3,

    hyphenateBeforeLast:3,

    hyphenateLadderLimit:2,

    hyphenationZone: "1 p",

    hyphenateCapitalizedWords:true,

    hyphenateLastWord:false,

    hyphenateAcrossColumns:false,

    }

    If (myPara [i] .hyphenation = false)

    I want to implement the 1 point in detail in my script, so please correct my script.

    Thank you

    Hi Cognet,

    Great thanks for your help in timing, thanks again.

    by

    hasvi

  • Please see this script of api 3d javacript refence

    //-------------------------------------------------------------
    -Do not change the tags XML-
    //-------------------------------------------------------------

    < AcroForm >
    < ACRO_source > Animation: Annot1:MouseUp:Action1 < / ACRO_source >
    < ACRO_script >
    / * belongs to: AcroForm:Animation:Annot1:MouseUp:Action1 * /.
    ATMO = getAnnots3D (0) [0] .context3D;

    atmo.toggleSpinIt ();


    < / ACRO_script >
    < / AcroForm >

    < AcroForm >
    < ACRO_source > collapse: Annot1:MouseUp:Action1 < / ACRO_source >
    < ACRO_script >
    / * belongs to: AcroForm:Collapse:Annot1:MouseUp:Action1 * /.
    ATMO = getAnnots3D (0) [0] .context3D;

    atmo.collapseIt ();

    < / ACRO_script >
    < / AcroForm >

    < AcroForm >
    < ACRO_source > explode: Annot1:MouseUp:Action1 < / ACRO_source >
    < ACRO_script >
    / * belongs to: AcroForm: explode: Annot1:MouseUp:Action1 * /.
    ATMO = getAnnots3D (0) [0] .context3D;

    atmo.explodeIt ();

    < / ACRO_script >
    < / AcroForm >

    < AcroForm >
    < ACRO_source > graph: Annot1:MouseUp:Action1 < / ACRO_source >
    < ACRO_script >
    / * belongs to: AcroForm:Graphic:Annot1:MouseUp:Action1 * /.
    ATMO = getAnnots3D (0) [0] .context3D;

    ATMO. Flow.toggle ();


    < / ACRO_script >
    < / AcroForm >


    I'm new to this 3d refence javascript

    in above code

    atmo.toggleSpinIt ();

    atmo.collapseIt ();

    atmo.explodeIt ();

    ATMO. Flow.toggle ();

    are they above functions are built in functions or custom function. Because when you debug the i impossible stepinto functions above.

    js where these method are stroed. Please let me know

    Please report it in the Acrobat Scripting forum. If you are unable to get help here, there is a forum of Acrobat 3D features.

  • Forum motorcycle technicians. Please correct this forum even once.

    Today started receiving script (8) of IE on each forum thread errors.

    Mark, the Manager of forums worked to fix this.

    I don't seem to get the errors today.  This was fixed for you?

  • I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    Hello

    Can the code below is useful for you, but I do not know how to sort.

    Change the tag based on your employment application.

  • Excluding xml in this script elements...

    This script (Green4ever) Insert '\r' after the element:

    var myDoc = app.activeDocument;
    var inddRooElement = myDoc.xmlElements.item(0);
    var xPathElements = inddRooElement.evaluateXPathExpression("//*");
    var elementCount = xPathElements.length;
    for(var eId=0; eId<elementCount; eId++){
        var thisXpathElement = xPathElements[eId];
        thisXpathElement.insertTextAsContent("\r", XMLElementPosition.AFTER_ELEMENT);
        }
    alert("Done");

    But I need some XML elements are excluded.
    How I can exclude some Elements XML ?
    How to make exclude all items who have in the tag " < p > "?

    Thank you...

    Try:

    var xPathElements = inddRooElement.evaluateXPathExpression("//*[not(ancestor::p)]");
    

    or, if you want to exclude p

    var xPathElements = inddRooElement.evaluateXPathExpression("//*[not(ancestor-or-self::p)]");
    

    Jeff

  • How to pass the content of an xml element in the text frame in inDesign Script

    var XMLFile = File.openDialog ("select XML Files... ») ;

    var doc = app.activeDocument;

    If (!) App.Documents.Length)

    {alert ("ERROR: Document not opened");}

    return;

    }

    doc.importXML (XMLFile);

    var firstFigureNode = doc.xmlElements [0] .xmlElements [1] .xmlElements [0];

    var lableNode = firstFigureNode.xmlElements [0];

    var lableNodeText = lableNode.contents;

    myFrame var = doc.textFrames.add ({geometricBounds: [-13, 13, 3, -3]});

    lableNodeText.move (LocationOptions.AFTER, myFrame.texts [0]);

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

    My requirement is: == > > move the content of an xml element in the text by inDesign Script block, but XML InDesign file Structure should not be change & data in the XML Structure should remain as it was before...

    I tried to code above, but it does not work...

    Please can someone help me in solving this problem...

    It does not work correctly...

    It moves firstFigureNode in myFrame...

    firstFigureNode.placeXML (myFrame);

    ===>> For Apple Script try below Code ===>>

    myFrame markup using firstFigureNode

  • I need the XML elements appear in the various paragraphs...  Could do with a script?

    I need of the XML elements appear in different paragraphs ...
    Pourrait to do this with a script?

    Thank you...

    You can use this / Puedes usar esto

    insertTextAsContent("\n",XMLElementPosition.beforeElement);
    //  or
    insertTextAsContent("\r", XMLElementPosition.afterElement);
    

    Necesitaria mas information,

  • Please help me simplify this Script

    Hello

    I made a menu of magnyfying based on this tutorial: http://www.flashkit.com/tutorials/Interactivity/Navigation/Mac_OS_X-Aaron_Ha-722/index.php

    The problem: it's that I have 20 Menu items. Whenever I want to change something, there are too many things to change.

    The answer, I am lloking for: I guess that there is a much smarter and shorter way to do this using only a few lines of script and some xml or txt files:

    1 - create Movie Clip with button inside
    2 the list of the items to create in this txt file (lets say "list_of_movies_containing_a_button.txt")
    3 put the buttons separated by 40px on Y and X = 0
    4-instance name each button with this other txt file
    5 - put inside each button, the text on this third file. text_appearing_in_each_button.txt
    6 - for all buttons, use this color on Over and another color on the mouse to the top of style.css (?)
    Links 7 - each button to the url defined in the file Links.txt.
    8-all buttons behave in the way...

    Do you understand what I mean?
    Can you help me please? Thank you very much

    Here is the script of the 17th century, that I use now (with only 10 points in this example)


    onClipEvent (load) {}
    function checkOffset (LARGE_INTEGER) {}
    If (LARGE_INTEGER <-120) {}
    LARGE_INTEGER = - 120;
    } ElseIf (LARGE_INTEGER > 120) {}
    LARGE_INTEGER = 120;
    }

    LARGE_INTEGER return;
    }
    function if (offset) {}
    Return 100 * (2-(1 * (Math.abs (offset) / 120)));
    }
    }
    onClipEvent (mouseMove) {}
    Get the x cursor and is coordinated
    y = getProperty ("_root.drag", FLF);
    x = getProperty ("_root.drag", _x);
    Find the offset of the cursor for each icon based on the starting location of the icon
    HomeOffset = y - 200;
    NewsEventsOffset = y - 240;
    ScheduleOffset = y - 280;
    ManualOffset = y - 320;
    DirectionsOffset = y - 360;
    LessonOffset = y - 400;
    ContactUsOffset = y - 440;
    MP3CollectionOffset = y - 460;
    BookmarkOffset = y - 500;
    LinksOffset = y - 540;
    If the cursor is in menu
    If (x > = 0 and x < = 100 and y > = 100 and y < = 700) {}
    Make sure that the offsets are within acceptable limits
    HomeOffset = checkOffset (HomeOffset);
    NewsEventsOffset = checkOffset (NewsEventsOffset);
    ScheduleOffset = checkOffset (ScheduleOffset);
    ManualOffset = checkOffset (ManualOffset);
    DirectionsOffset = checkOffset (DirectionsOffset);
    LessonOffset = checkOffset (LessonOffset);
    ContactUsOffset = checkOffset (ContactUsOffset);
    MP3CollectionOffset = checkOffset (MP3CollectionOffset);
    BookmarkOffset = checkOffset (BookmarkOffset);
    LinksOffset = checkOffset (LinksOffset);
    Move the Home icon
    setProperty ("_root. Home page', FLF, 200-HomeOffset);
    setProperty ("_root. (Homepage», _xscale, if (HomeOffset));
    setProperty ("_root. (Homepage», _yscale, if (HomeOffset));
    Move news and events icon
    setProperty ("_root. NewsEvents", FLF, 230-NewsEventsOffset);
    setProperty ("_root. NewsEvents ", _xscale, if (NewsEventsOffset));
    setProperty ("_root. NewsEvents ", _yscale, if (NewsEventsOffset));
    Move the calendar icon
    setProperty ("_root. Planning', FLF, 260-ScheduleOffset);
    setProperty ("_root. Planning', _xscale, if (ScheduleOffset));
    setProperty ("_root. Planning', _yscale, if (ScheduleOffset));
    Move the manual icon
    setProperty ("_root. Manuel', FLF, 290-ManualOffset);
    setProperty ("_root. Manual', _xscale, if (ManualOffset));
    setProperty ("_root. Manual', _yscale, if (ManualOffset));
    Move the fashion icon
    setProperty ("_root. Route", FLF, 320-DirectionsOffset);
    setProperty ("_root. (Operating instructions", _xscale, if (DirectionsOffset));
    setProperty ("_root. (Operating instructions", _yscale, if (DirectionsOffset));
    Move the icon of the lesson
    setProperty ("_root. Lesson', FLF, 350-LessonOffset);
    setProperty ("_root. Lesson,"_xscale, if (LessonOffset));
    setProperty ("_root. Lesson,"_yscale, if (LessonOffset));
    Move the Contact us icon
    setProperty ("_root. ContactUs', FLF, 380-ContactUsOffset);
    setProperty ("_root. ContactUs', _xscale, if (ContactUsOffset));
    setProperty ("_root. ContactUs', _yscale, if (ContactUsOffset));
    Move the icon Collection MP3
    setProperty ("_root. MP3Collection', FLF, 410-MP3CollectionOffset);
    setProperty ("_root. MP3Collection ', _xscale, if (MP3CollectionOffset));
    setProperty ("_root. MP3Collection ', _yscale, if (MP3CollectionOffset));
    Move the bookmark icon
    setProperty ("_root. Bookmark", FLF, 440-BookmarkOffset);
    setProperty ("_root. Bookmark", _xscale, if (BookmarkOffset));
    setProperty ("_root. Bookmark", _yscale, if (BookmarkOffset));
    Move the icon links
    setProperty ("_root. Links', FLF, 470-LinksOffset);
    setProperty ("_root. Links,"_xscale, if (LinksOffset));
    setProperty ("_root. Links', _yscale, if (LinksOffset));
    } else {}
    setProperty ("_root. («Home», FLF, 200);
    setProperty ("_root. «Home», _xscale, 100);
    setProperty ("_root. «Home», _yscale, 100);
    setProperty ("_root. (NewsEvents", FLF, 240);
    setProperty ("_root. NewsEvents", _xscale, 100);
    setProperty ("_root. NewsEvents", _yscale, 100);
    setProperty ("_root. (Annex", FLF, 280);
    setProperty ("_root. Annex', _xscale, 100);
    setProperty ("_root. Annex', _yscale, 100);
    setProperty ("_root. (Manual", FLF, 290);
    setProperty ("_root. Manuel', _xscale, 100);
    setProperty ("_root. Manuel', _yscale, 100);
    setProperty ("_root. (Operating instructions", FLF, 320);
    setProperty ("_root. Operating instructions", _xscale, 100);
    setProperty ("_root. Operating instructions", _yscale, 100);
    setProperty ("_root. (Lesson', FLF, 350);
    setProperty ("_root. Lesson,"_xscale, 100);
    setProperty ("_root. Lesson,"_yscale, 100);
    setProperty ("_root. (ContactUs', FLF, 380);
    setProperty ("_root. ContactUs', _xscale, 100);
    setProperty ("_root. ContactUs', _yscale, 100);
    setProperty ("_root. (MP3Collection', FLF, 410);
    setProperty ("_root. MP3Collection', _xscale, 100);
    setProperty ("_root. MP3Collection', _yscale, 100);
    setProperty ("_root. (Signet', FLF, 440);
    setProperty ("_root. Bookmark", _xscale, 100);
    setProperty ("_root. Bookmark", _yscale, 100);
    setProperty ("_root. (Links", FLF, 470);
    setProperty ("_root. Links,"_xscale, 100);
    setProperty ("_root. Links', _yscale, 100);
    }
    }

    .

  • Error: "SQLDUMPER library failed initialization.your installation is either corrupt or has been tampered with please uninstall then re run the installer to correct this problem.

    Original title: "SQLDUMPER.

    When I start my laptop windows xp, an error message appears "SQLDUMPER library failed initialization.your installation is either corrupt or has been tampered with please uninstall then re run the installer to correct this problem.

    Hi mark25666,
     
    Here's a similar post on this issue. Check the suggestion given in the link and see if it helps you too the question of fixing.
     
    If this is not enough, post your query in the SQL Server instances for better assistance.
  • I can sign into my hotmail, but I can't open or delete emails. Please advise on how to correct this problem.

    I can sign into my hotmail, but I can't open or delete emails.  Please advise on how to correct this problem.

    View all Windows Live and Hotmail questions in the appropriate forum found here:
    http://windowslivehelp.com/

  • "Error - a problem prevented the document under analysis. Please try again, or to correct this information, see Help and Support or the documentation that came with the scanner"while trying to scan using HP G4050 on windows 7

    A problem prevented the document are analyzed. Windows 7 - HP G4050 scanner.
    I have a HP G4050 which worked fine with Vista.  After the upgrade to Windows 7, I get the following error when scanning:

    A problem prevented the document are analyzed.  Please try again, or to correct this information, see Help and Support or the documentation that came with the scanner.

    I get a different error during an attempt of an overview.  It starts to get an overview of the page, gets about 2 inches to the bottom of the page and then I get the following error:

    An error occurred when you set the properties of the scanner.  If another program is scanning, please wait to complete, and then try again.

    I downloaded the latest driver (and reinstalled several times) of HP with no luck.  No errors are recorded in the Application events.

    I'm going nuts trying to figure out this one!  Thanks for your help.

    BT

    Update:

    I finally had time to unplug the scanner, wait 60 seconds and then plug it again.

    Problem solved.

    Scan of stupid...

    BT

  • My LR6 in Windows10 was arrested following a software without correct closure error. When the reopening, LR6 gives the message "your catalog is always opened by another program. Please close this program "." But no other program is open. How early to solv

    My LR6 in Windows10 was arrested following a software without correct closure error. When the reopening, LR6 gives the message "your catalog is always opened by another program. Please close this program "." But no other program is open. How early to solve this problem?

    There is a file with a name ending in. BLOCK in the same folder as your catalog Lightroom.

    Remove this item. LOCK file. Do not remove anything else.

  • bought photoshop elements several weeks ago and started the download process, but I had to stop... needed to upgrade my mac so I could continue... now it won't let me continue and download the program. What should I do to correct this?

    bought photoshop elements several weeks ago and started the download process, but I had to stop... needed to upgrade my mac so I could continue... now it won't let me continue and download the program. What should I do to correct this?

    What do you mean won't you of... What is the error message?

    kglad links in response to #1 here can help https://forums.adobe.com/thread/1930162

  • Need help please this script... LucD? :-)

    Everything works as expected, but I have a problem with the two parts of the script. They are the bits where he itterates the NETWORK card and hard drives (pink and blue sections below).

    Problem with the NIC (Pink) loop - it only shows nic 0, and if there are multiple network cards - they are not out in the CSV file. Also returns only 0 NETWORK adapter MAC address and not the other nic MAC addresses...

    Problem with loop (blue) disc - it returns only the first TWO discs even if some of my VM 4 or even 5 discs...

    No idea why this is happening. This script is not my work, but I found it very useful for what I need...

    Script:

    Claire

    $VirtualCenter = Read-Host "Enter the Virtual Center server name".

    $FileLocation = Read-Host "Please Enter full Path and file name to save the output.  Must end in .csv or .txt.

    $Cred = get-Credential

    SE connect-VIServer $VirtualCenter - Credential $Cred

    $stats = @)

    #Uncomment the two lines if you want to inventory just a cluster instead of all the VMS in vCenter

    #$VMCluster = Read-Host "Please enter the name of the Cluster.

    #$ServerList = get-VM-location $VMCluster

    #If the two given lines are deleted, then comment out the following line

    $ServerList = get - VM

    {Foreach ($Guests to $ServerList)

    $Guest = $Guests.Name.ToUpper)

    Write-Progress-activity "Create VMware Guest Inventory" - Status "Treatment VM guest $Guest" # display progress bar

    $VMGuest = get - VM $Guest | Get-View

    $VM = get - VM $Guest

    $ESXHost is (get - VM $Guest). Host.Name.ToUpper)

    $VMHost = get-vmhost $ESXHost | Get-View

    $row = new-Object System.Object

    $row | Add-Member-Type NoteProperty-name 'Guest' - value $VMGuest.Name.ToUpper)

    $row | Add-Member-Type NoteProperty - name "Power status" - value $VM. Guest.State

    $row | Add-Member-Type NoteProperty - Name "Guest OS full name"-value $VM. Guest.OSFullName

    $row | Add-Member-Type NoteProperty-name "Comments RAM (MB)" - value $VM. MemoryMB

    $row | Add-Member-Type NoteProperty - Name 'Comments vCPU Count' - value $VM. NumCPU

    $row | Add-Member-Type NoteProperty - name "Guest VMTools status" - value $VMGuest.Guest.ToolsStatus

    $row | Add-Member-Type NoteProperty-name "Guest VMTools Version" - value $VMGuest.Guest.ToolsVersion

    $row | Add-Member-Type NoteProperty - name 'Guest status VMTools Version' - value $VMGuest.Guest.ToolsVersionStatus

    $row | Add-Member-Type NoteProperty - name "Comments VMTools status running" - value $VMGuest.Guest.ToolsRunningStatus


    $NICCount = 0

    ForEach ($vNic in $VM. Guest.Nics) {}


    $NIC_IP = "Guest IP Address for the NETWORK adapter" + $NICCount + "."

    $NIC_MAC = "MAC address of Guest for the NETWORK adapter" + $NICCount + "."

    $NIC_vSwitch = "Guest vSwitch network for the NETWORK adapter" + $NICCount + "."

    $row | Add-Member-Type NoteProperty - name $NIC_IP-$VMGuest.Guest.IpAddress value

    $row | Add-Member-Type NoteProperty - name $NIC_MAC-$vNic.MacAddress value

    $row | Add-Member-Type NoteProperty - name $NIC_vSwitch-$vNic.NetworkName value

    $NICCount ++

    }

    $DiskCount = 0

    $DT = @)

    ForEach ($vDisk in $VM. Guest.Disks) {}

    $DriveLetter = 'Comments Drive' + $DiskCount + ' ".

    $DriveSize = 'Comments Drive' + $DiskCount + 'size '.

    $DriveFree = 'Comments Drive' + $DiskCount + 'free space '.

    $vDiskCap = [math]: Round (($vDisk.Capacity)/1 GB)

    $vDiskFree = [math]: Round (($vDisk.FreeSpace)/1 GB)

    $row | Add-Member-Type NoteProperty - name $DriveLetter-$vDisk.Path value

    $row | Add-Member-Type NoteProperty-name $DriveSize - value $vDiskCap

    $row | Add-Member-Type NoteProperty-name $DriveFree - value $vDiskFree

    $DiskCount ++

    $DriveTotals = "" + $row. $DriveLetter + "" + $row. $DriveSize + ';

    $DT += $DriveTotals

    }


    $row | Add-Member-Type NoteProperty - Name 'Host name' - value $VMHost.Summary.Config.Name.ToUpper)

    $row | Add-Member-Type NoteProperty - name 'number of Sessions on the host' - value $VMHost.vm.Count

    $row | Add-Member-Type NoteProperty - Name "Is a member of the host Cluster" - value (Get-Cluster - VMHost $ESXHost). Name.ToUpper)

    $row | Add-Member-Type NoteProperty - name "Hosting provider" - value $VMHost.Hardware.SystemInfo.Vendor

    $row | Add-Member-Type NoteProperty - name 'Model home' - value $VMHost.Hardware.SystemInfo.Model

    $HostRam = [math]::Round(($VMHost.Summary.Hardware.MemorySize)/1Go)

    $row | Add-Member-Type NoteProperty - name 'RAM to host' - value $HostRam

    $row | Add-Member-Type NoteProperty - name "CPU model of home" - value $VMHost.Summary.Hardware.CpuModel

    $row | Add-Member-Type NoteProperty - name 'number of CPU host' - value $VMHost.Summary.Hardware.NumCpuThreads

    $row | Add-Member-Type NoteProperty - name 'The host CPU speed' - value $VMHost.Summary.Hardware.CpuMhz

    $row | Add-Member-Type NoteProperty - Name 'Name of the product to home' - value $VMHost.Summary.Config.Product.Name

    $row | Add-Member-Type NoteProperty - name 'Version of the product to home' - value $VMHost.Summary.Config.Product.Version

    $row | Add-Member-Type NoteProperty - name of the Generation of product to home' - value $VMHost.Summary.Config.Product.Build

    $row | Add-Member-Type NoteProperty - name of the "Service Console to host" - value $VMHost.Config.Network.ConsolevNic [0]. Spec.IP.IPAddress

    $row | Add-Member-Type NoteProperty - name "the subnet mask of Console Hosting Service" - value $VMHost.Config.Network.ConsolevNic [0]. Spec.IP.SubnetMask

    $row | Add-Member-Type NoteProperty - name of the "Service Console 1 to host" - value $VMHost.Config.Network.ConsolevNic [1]. Spec.IP.IPAddress

    $row | Add-Member-Type NoteProperty - name "the subnet mask of Console 1 Hosting Service" - value $VMHost.Config.Network.ConsolevNic [1]. Spec.IP.SubnetMask

    $row | Add-Member-Type NoteProperty - Name "vMotion Host IP Address" - value $VMHost.Config.vMotion.IPConfig.IpAddress

    $row | Add-Member-Type NoteProperty - Name "VMotion the subnet mask of the host" - value $VMHost.Config.vMotion.IPConfig.SubnetMask


    $stats += $row



    }

    $stats | Export-Csv-Force. \$FileLocation - NoTypeInformation

    Invoke-Item. \$FileLocation

    Thanks for your help

    PS. I'm a complete NOOB with Powercli, so try to find my way around it yet.

    PPS - if someone has a better VM inventory script - please be so kind as to pointing me to it...

    Thought as well, but I'm afraid he wil cover the possibilities.

    Assume the following:

    VM1, 3 cards, 2 hard drives

    VM2, 2 cards, 5 hard drives

    The order will be VM1, VM2 with the effect that you get 2 hard drives for VM2.

    The alternative I came with us to make Dummy entries and always use the maximum columns for network cards and hard drives.

    If you want to get

    NIC1 NIC2, NIC3 HD1 HD2 HD3 HD4 HD5

    VM1 x x x x x na na na

    VM2 x x na x x x x x

    See if it works for you.

Maybe you are looking for